In my quest to find the highest level of a sound file (and eventualy also a
way to graph the soundwave), this is what I've come up with so far, but it
doesn't seem to work....
=================
dim left, right, maxLeft, maxRight, maxBoth as Int16
dim m as movie
dim samples as MemoryBlock
dim SampleCount, pos as Integer
m = me.getMyMovie
if m = nil then Return
Samples=m.SoundRawDataMBS(0, m.DurationMBS, 2, 16, 44100)
//here I'm not sure if sampling at a lower rate wouldn't make less
//data to process and make faster function.
//I need only to scan for max values not to stream audio.
//even mono is probably fine, at 8 bits and 11k
//so maybe this would be enough
//Samples=m.SoundRawDataMBS(0, m.DurationMBS, 1, 8, 11025)
//or should I find and use the sampling rate of the file processed
SampleCount =Samples.Size
do
left = Samples.Int16Value(pos)
right = Samples.Int16Value(pos+2)
if maxLeft<left then maxLeft = left
if maxRight<right then maxRight = right
pos =pos+4
Loop until pos>=SampleCount
if maxRight>maxLeft then
maxBoth = maxRight
else
maxBoth = maxLeft
end if
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info