Old 21st November 2005, 01:20   #1
Eo.S.
Milkdrop Moderator
 
Join Date: Oct 2004
Posts: 114
sound() variable

I've been trying to use this but it definitely seems a bit weird, and the output doesn't seem to match up with values from the spectrum analysis in custom waveforms. Is it using a different FFT function?

I connected dy from screen left to right to the sound variable using a range of values around x to define the ranges for sound() and overlayed the values of a custom waveform and doesn't line up well at all.

Eo.S.
Eo.S. is offline   Reply With Quote
Old 21st November 2005, 04:39   #2
redi jedi
Will code for food
 
Join Date: Mar 2005
Location: orlando
Posts: 521
i think it comes from the same place as the custom wave spectrum. i'm not sure what processing it goes through before the wave gets it and after i do(pretty sure i used the same var[i think theres 2])
when i did my test, i set up one (wave)spectrum using the existing one, like
x=sample;
y=value1*.2+.75;

then set up another (wave) spectrum using sound(), without looking at my code it was something like->

[ dont copy and paste this, it prolly wont work]
offset=.1;
a=min(sample,1-offset)*512;
b=max(sample,offset)*512;
x=sample;
y=( sound(a,b)/(b-a) )*.2+.25;

i also built in a low and high var, to limit what went into the function( 40-375 worked good) when set up right, you can kind of "zoom" in on diffrent parts of the spectrum

close to that anyway, but you gotta divide by the diffrence of a and b because it just summs the "sound" bettween the two(i'm gonna fix this soon)

if you make the offset really small it outputs pretty close to the custom spectrum, when i made the offset like 25-75, i think, it seemed to work better than the built in one, i could see the main beat changing pitch, it was pretty cool, if i can find my test preset i'll post it for ya(may have lost it)

Blah!
redi jedi is offline   Reply With Quote
Old 21st November 2005, 07:39   #3
Eo.S.
Milkdrop Moderator
 
Join Date: Oct 2004
Posts: 114
actually i got it work better finally. But a few details to make things more useable.

If you set y to value1 in a waveform the spectrum analysis is linear. So all of the frequencies where you're going to want to see detail are packed really tight on the left side of the screen [11kHz is in the middle of the screen].
If you use
x = pow( sample, 1/6 );
instead of
x = samplel

it will 'change' this to the logarithmic scale of an FFT, and you can actually identify significant sounds in the music in the waveform.

In per-pixel dx/dy/etc code, you make x = pow(x,6) if you want use it in the sound() paramater.

The attached preset sets dy to match the waveform spectrum analysis. There's additional code to get the intensity values to better match up with human hearing. High frequencies are always much lower in volume in music because otherwise they'd be too loud. 100db is fine for bass frequencies, but 5000kHz at 100db would deafen you.
There's code in this to adjust the higher frequencies in music to appear close to the same volume as the mid and low so that they apear just as responsive as bass frequencies.

ex.
volume = sound( frequencylow, frequencyhigh );
volume = volume / pow( frequencylow , 0.5 );

Eo.S.
Attached Files
File Type: zip spectrum.zip (2.2 KB, 209 views)
Eo.S. is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > MilkDrop > MilkDrop Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump