0
0

hi,
first sorry for my poor english ;P

i don’t know if anyone is really intrested in this, but here is a snap of my player beta 0.00001E-23

[img:2d8lb61e]http://speciesm.piranho.com/webpics/Proc.JPG[/img:2d8lb61e]
hehe well, the cpu usage was about 6-7% but it was in the ide…

by having a background-picture like [img:2d8lb61e]http://speciesm.piranho.com/webpics/VU.JPG[/img:2d8lb61e] and only painting the back part, you can get a fast an nice looking gradient.

here is the code, called on picVU_MouseUp / menu:

</span><pre class=P><span class=”Pb”>Private</span> <span class=”Pb”>Sub</span> RunVU()<br> <span class=”Pg”>’If the Hz-Count is to low or when mixing the values, an error could happen</span><br> <span class=”Pb”>On</span> <span class=”Pb”>Error</span> Resume <span class=”Pb”>Next</span><br> <br> <span class=”Pg”>’If the VU is running, stop it</span><br> <span class=”Pb”>If</span> VURunning <span class=”Pb”>Then</span> VURunning = <span class=”Pb”>False</span>: <span class=”Pb”>Exit</span> <span class=”Pb”>Sub</span><br> <br> Static FFTUnit <span class=”Pb”>As</span> <span class=”Pb”>Long</span> <span class=”Pg”>’The ID of the FFTUnit we use</span><br> <span class=”Pb”>Dim</span> Spec() <span class=”Pb”>As</span> <span class=”Pb”>Single</span> <span class=”Pg”>’The spectrum</span><br> <span class=”Pb”>Dim</span> VUVal <span class=”Pb”>As</span> <span class=”Pb”>Single</span> <span class=”Pg”>’Only a buffer for the VU</span><br> <br> <span class=”Pg”>’If the FFTUnit is not loaded, load it</span><br> <span class=”Pb”>If</span> FSOUND_DSP_GetActive(FFTUnit) = 0 <span class=”Pb”>Then</span><br> FFTUnit = FSOUND_DSP_GetFFTUnit<br> FSOUND_DSP_<span class=”Pb”>Set</span>Active FFTUnit, 1<br> <span class=”Pb”>End</span> <span class=”Pb”>If</span><br> VURunning = <span class=”Pb”>True</span><br> picVU.ForeColor = 0<br> <span class=”Pb”>ReDim</span> Spec(511) <span class=”Pb”>As</span> <span class=”Pb”>Single</span> <span class=”Pg”>’Redim our spectrum to 512 elements</span><br> <br> <span class=”Pb”>Do</span><br> picVU.Cls<br> <span class=”Pg”>’Get the spectrum</span><br> GetSpectrum Spec()<br> <span class=”Pg”>’Paint it</span><br> <span class=”Pg”>’To get a nice ‘gradient’ i don’t draw the spectrum itself, instead the ‘black’ part on a gradient background…</span><br> <span class=”Pg”>’Here i copy the backgrond to the picture</span><br> <span class=”Pb”>For</span> I = 0 <span class=”Pb”>To</span> picVU.ScaleWidth<br> <span class=”Pg”>’The Sqr() function takes CPU usage, true. But it amplifys the lower ‘high-frequency’-waves.</span><br> <span class=”Pg”>’And this adding of values is done for a nice, smooth VU, +1 so that the ‘-1’ index won’t happen. Confused? ;)</span><br> VUVal = picVU.ScaleHeight – Sqr(Spec(I) + Spec(I + 1) + Spec(I + 2)) / 3 * picVU.ScaleHeight * VUScale<br> picVU.<span class=”Pb”>Line</span> (I, 0)-(I, VUVal)<br> <span class=”Pb”>Next</span><br> <span class=”Pg”>’Sleep a while, this reduce the CPU usage A LOT (can be ~80%)</span><br> Sleep VUSleep<br> DoEvents<br> <span class=”Pb”>Loop</span> <span class=”Pb”>Until</span> VURunning = <span class=”Pb”>False</span><br> <span class=”Pg”>’Unload the FFTUnit</span><br> FSOUND_DSP_<span class=”Pb”>Set</span>Active FFTUnit, 0<br> <span class=”Pg”>’Clear the VU</span><br> picVU.<span class=”Pb”>Line</span> (0, 0)-(picVU.ScaleWidth, picVU.ScaleHeight), 0, <span class=”Pb”>BF</span><br><span class=”Pb”>End</span> <span class=”Pb”>Sub</span><br></pre><span class=”Norm”>

of course this is not the fastes method, but still it is fast enought.

hope this could help anyone,
greetz
Mad

  • You must to post comments
0
0

FSOUND_GetCurrentVu was replaced by FSOUND_GetCurrentLevels :

http://52.88.2.202/docs/HTML/FSOUND_Ge … evels.html

  • You must to post comments
0
0

I search for a stereo VU meter not a spectrum analyser

  • You must to post comments
0
0

I’m not quite sure I understood the formula you gave brett.. I’m also interested in a stereo L/R VU. Right now I just use GetCurrentVU with scale 0-255 for integer values, and copy for L and R so they at least show up.

But whats this you say how to get 2 values? I dont have any panning control in my player (I just assume center) – keeps things less complicated for my already crowded GUI hehe. Mind spelling out the two formulas for turning the GetCurrentVU result to L and R values. Please? :smile:

I’m just lost, my brain isnt working too well tonight, finally got my app to behave with all the new API-driven code. Next stop is using the Winsock API instead of M$ .ocx :sad:

  • You must to post comments
0
0

Brett I gave your suggestion a go and it seems to work prefectly for….mods and whatnot however for streams its a different story…

Since streams have FOUND_STEROPAN, ie is -1 thus l is aleays 0 or -1. Heres my snip perhaps i’am doing something wrong

<pre>
Public Sub GetSteroVU(ByRef l As Long, ByRef r As Long)
Dim x As Long
Dim s As Single

s = GetPeekVolume(chan)

x = FSOUND_GetPan(chan)
l = x * s
r = s * (255 - x)

End Sub
</pre>

++Cire.

  • You must to post comments
0
0

It’s seems to be just a volume VUMeter…

  • You must to post comments
0
0

Yeah, I’m more interested in doing the stereo VU for streams. My current development isnt anything to do with modules.

Anon: thats what a VU meter is essentially. The technical definition is Voltage Units, which measure the strength of the electrical current into the meter. For the casual listener, this is equivalent to the “volume” or amplitude of the input signal, which determines how “loud” something sounds at a given volume. For us sound gurus and techy geeks, accurate VUs and sound levels are important 😉

  • You must to post comments
0
0

I’m intrested in

  • You must to post comments
0
0

I would be interested in it too.
The things I don’t really know for doing it are :
1) How should the current playing position be calculated? I assume you have to buffer some VU values, and the buffered values will play at Now + StreamBufferLength or at Now + StreamBufferLength + FMod_BufferLength?
2)How to calculate the VU dB based. I think it has something to do with change in amplitude instead of just max amplitude?

  • You must to post comments
0
0

Do you know some examples draw vumeter in vb using fmod ? Tell me the link to download it.Thanks.

  • You must to post comments
0
0

Guys. I guess that getting the current VU and multiplying it with the current panorama settings, as suggested by Brett, would yield in wrong result.

As I see, a VU meter should show the strength of a signal of a channel you play. Now, take a stereo song. Usually there are different signal strengths on the left and right side of the music at a given time, as mixed by the sound engineer. If I get only one volume and calculate “pseudo-levels” based on pan, I’m not right, ‘cuse why would it be equal to the factual signal strength of a channel?

What if I make a stereo record in which my silent voice can be heard on the left channel and a loud drum on the right? If I can get only the aggregated volume of the two channels and calculate left and right volume levels by the panorama, it just won’t be real, ‘cuse on the left, there will be always a low volume level (my silent voice), however the method Brett suggested would give me the volume level of the drum (originally recorded to the right channel) if the pan is currently set to the left.

What is your opinion?

  • You must to post comments
0
0

FSOUND_GetCurrentVU doesn’t exist! even in my documentation… (i use delphi)

  • You must to post comments
Showing 11 results
Your Answer

Please first to submit.