[Closed] Maxscript Inputs??
Hi guys,
I am trying to take an audio file and some how convert it into a 3d form using maxscript. I was wondering if anyone has got any advice on where to start with this problem?!
I was wondering if its possible to wire up maxscript with another piece of audio analysis software and convert the data in real time? or would it be easier to try and reformat the whole track some how and then use that information as a massive array?
Im really stuggling with this so any advice or just thoughts on where you could start would be great!
Cheers
Search in this forum or at scriptspot.com for. There is a script that already does what you need if I remember correctly. It woeks with midi files. So search in this forum or at scriptspot.com for it. If no luck let me know and I’ll look for it too.
What do you mean by converting the sound file into 3d form? Do you mean a 3d representation of the wave file or something else? There’s already a built in audioFloat controller that uses a sound file’s amplitude to drive any other track (which you can access in maxscript). But if you’re talking about doing something more sophisticated than that, you may have to link to an external module.
Basically I want to use a audio file as an input to create a 3d form. I would like to base it on the fundamental structure of the music, so maybe use the frequency?
I do not imagine the output being a wave, rather a load of objects defined by the audio file?!?
If i could convert the audio into an array of x numbers i guess i could then loop through it and assign different 3d traits? something like this:
temparray = #(<audio as code>)
for i in temparray do
(
if i == x do
(
<something>
)
)
That is a very basic example but basically i would like to be able to run any audio file through the script to produce different forms, ie converting a radiohead’s creep would produce a very specific form.
Does that make sense?
Max does not do audio very well… ( understatment )
The only way I know to translate Audio to 3d movment is with “AudioController”. Check the standard help file. There’s a step by step example there…
These controllers work on the value of the wav form, so if you want to isolate different freqencies you’ll need to use an audio program, apply hi and lo pass filters and render out different wav files for each band range you’d like to have unique reactions.
Then in the max Motion Panel ( there is no script access to these controllers ) apply an Audiocontroller type. Example: Apply an AudioFloat to the Z position controller and when the music gets louder the object will move higher in its Z height.
Best of luck
Well, you could do what you’re talking about in max, but you’re working against its fundamental capabilities. You could put an audio controller on your sound file, step through time at the sample rate for the file (which is a very small increment compared to what max is used to) and read the value of the controller into an array. Then you have what is basically raw sound data in the array and you can do anything you want.
But, you’re working against the software here. There is no sound api in max so you’d have to write everything from scratch… not easy.
You’re better off using a package that has the capabilities you want and then importing some sort of file into max to do your 3d interpretative dance. Java has some nice audio functionality. Python may (don’t know, but it has to be better than max). Or maybe there’s a stand alone app out there that does what you want and can export it’s functionality. Don’t know.
Thanks for the help chaps!
I think in my situation it would be really good to convert the audio file into an array and then use the raw data that way.
I will have a look at java and see what i can do.
Thanks again for the help and if you have any other ideas please let me know!
Right I have managed to find a program (adobe audition) which i can use to create text files based on the audio file.
The problem I have now is that the output i get is just a long list of numbers seperated by spaces:
224.5 235.7
3465.7 -400
…etc
What i need to do now is convert this data into an array which i can then use in max. Iv been trying to do this for the last hour or so and im sure its a easy job but im stuggling again!!
Does anybody know a way i can convert this data into a maxscript array. I guess i just need to find a way to add commas in between all the numbers!
Any ideas??
You will want to look at “FileStream” in the maxscript help for more details, but essentially:
-- Create an empty array
local aValues = #()
-- Open your text file, for reading only
local fs = open "MySong.txt" mode:"r"
-- Read through the file until you reach the end
while not (eof fs) do (
-- Read the next value, delimited by a space or blank character
[b] [b]local text = readDelimitedString[/b] fs " "
[/b]
-- You may want to convert the value to a float at this stage
-- Append the value from the file to the array
append aValues text
)
close fs
The only issue I have currently (as this is wholly untested) is whether readDelimitedString will return the delimited character or not.
Either way, you may end up with a string with a space at the end and/or a text value which is nothing but an empty space character.
You could use trimLift and trimRight to remove any leading spaces and check for an empty string (text.count == 0) to filter out any empty spaces.
Hope that makes sense…
Shane
have a look at my max script FFTMAX on my webpage it maybe of some use for you ?
it does just what your looking for. but please note its still a w.i.p ok