FMOD: Improved Spectrum Analyser?
BlitzMax Forums/BlitzMax Programming/FMOD: Improved Spectrum Analyser?
| ||
Hi guys! Anyone here that ever made a Winamp(tm) like spectrum anaylser with fmod? So far I have only managed to come up with this. But that's not half as good as it should be... :/ Example: (you need a tune and the fmod.dll inside your folder!) Another problem is that when I turn down the volume of a tune the size of the spectrum bars shrinks accordingly. Any way to prevent that from happening? (So that the maximum width and height stay the same all time.) Thanks in advance! Grisu |
| ||
Can you not just divide the values returned into your static bank by the current volume as you draw the bars? Thus keeping the bars relative to the total volume at all times? |
| ||
Not quite sure what you mean Gabriel. Let alone know how to implement that. Why would i divide the value, wouldn't that decrease the total output. Sorry, I'm a newb in terms of this audio stuff. |
| ||
What I mean is this : If the volume is 1 OriginalBarheight/1= OriginalBarheight If the volume is 0.5 Barheight/0.5 = Barheight*2 = OriginalBarheight If the volume is 0.25 Barheight/0.25 = Barheight*4 = OriginalBarheight If the volume doesn't come as a decimal fraction then yes, it would make it smaller, in which case you'd have to turn it into a decimal fraction. ( EG: If volume can be 0-50 where 50 is the highest you'd have to divide the volume by 50 to get the decimal fraction. In which case you'd simplify and end up with CurrentBarheight=OriginalBarheight/MaxVolume*CurrentVolume |
| ||
What would happen if the sound was muted, or set to 0? |
| ||
For my game (http://www.nicholaskingsley.co.uk/FightTune), I use the following code : Which produces 4 bars For waveform, I used : However, this will only work with the latest version of FMOD |
| ||
What would happen if the sound was muted, or set to 0? You'd do what ( I hope ) you always do when dividing by an unknown variable. Put an If..EndIf around it to make sure it isn't zero. |
| ||
Thanks everyone. Slowly getting there. Still looking for the winamp fading effect when the bars are displayed. |
| ||
Is this what you mean Grisu? EDIT:Pasted the wrong source first time :) |
| ||
Thanks a lot Andy! That is what I meant... :o) |
| ||
Best is to run spectrum analysis on the playing sound buffer. It's not dependent from the volume settings, since it is outputted to the mixing buffers which are the ones which are affected by volume settings. So dividing by the volume level becomes useless. |