View Full Version : audio float controller help please

09 September 2005, 10:06 PM
Im writing a script to emulate an audio Vu meter. the thing is I need to read a wave file

I know how to add an audio float controller to control the height or what ever of a box.

but I donít know how to just read the value from a audio float controller without it being assigned to an object

I need to compare the value in the audio float controller to a value in an array like this

if audio >= lowgain[q] then ( run code )

where audio is the value I need to represent the value from a audio float controller

I was thinking maybe I could add a audio float controller to control the height of a box then hide the box

And read the height and make the value audio = the height of the box but this seems a bit messy and Iím not sure

How I would get the height of the box anyway

I hope someone can help

Thanks for reading

09 September 2005, 10:18 PM
Not only does TrackView provide stand-in Global tracks with all kinds of controllers, you can use MAXScript to create your own TrackView nodes and add controllers to them. So you could assign your audio controller to one of these tracks and read the value of the controller at the desired (or the current) time...

Check out the MAXScript Reference for details...

09 September 2005, 10:31 PM
Thanks Bobo

09 September 2005, 10:35 PM
Thanks Bobo

Here is an example.
Unfortunately, you don't seem to be able to assign the wave file to the controller via MAXScript, so you can only create the track and read the track, but have to pick the file manually...

theNode = trackViewNodes.Audio_Test
if theNode == undefined do
theNode = newTrackViewNode trackViewNodes "Audio Test"

theTrack = theNode.Audio_Track
theTrack = addTrackViewController theNode (audiofloat()) "Audio Track"


for t = 1 to 100 do
format "%\n" (at time t theTrack.value)

09 September 2005, 10:49 PM
Thanks again Bobo thats just what I needed :)

CGTalk Moderation
09 September 2005, 10:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.