Sign in to follow this  
Followers 0
7121

Need helping making or finding a vu meter

6 posts in this topic

Hi guys, I need help with making a vu meter for the audio-out. I checked the forum threads, i even looked on google, and it either requires higher level of programming or not enough information was given.

I even looked into C++ ( I am NOT good at C++ at all) and it looks like it could get me somewhere but I really want to be able to get it on autoit.

Program Idea:

Go to a video website, play the video, DETECT IF ANY SOUND IS COMING OUT, if not, click on next video, else, activate full screen.

I saw something involving the mci from microsoft msdn, but it only involved audio-in.

I really just need the output, even a small little boolean would work. Just as long as I know there's either sound coming out or not.

Steer me in the right direction perhaps? I'm up for learning... just not so much though... =/

Share this post


Link to post
Share on other sites



You mean something like that?:

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I dont know what a vu meter is.

Look

this is sort of what i'm looking for, except even though when i change my volume, it still says 100 (?)

A VU Meter is a volume unit meter. Technically, i should of phrased it as a volume monitor.

For example, on windows 7, every time you click on that speaker icon to see the volume, that green bar that keeps rising and lowering.

I want that output, but in numbers. So basically what i want is a sound monitor. Detect any sounds that are coming out, not in.

And UEZ, not the analog meters. I saw your other example though, it was able to open a audio file and play it with the visuals. I know you can do it. Is there any way to output the sound as numbers? WITHOUT opening a sound file and detecting it from the computer instead.

PS: I read around and it appears that i have to interact with the sound card? Couldn't the winmm.dll fetch the results?

Edited by 7121

Share this post


Link to post
Share on other sites

Look at Visualizer_Analog Meter - Special.au3. It uses the microphone as input device but I discontinued the development long time ago.

It should be in the AiO package but I'm not sure.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

This might help - a simple code to get the numeric volume from MCI...

and, some more complicated on this page...


Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • timmy2
      By timmy2
      I've been studying the AudioMeter2 script by eukalyptus. It's an incredible piece of work, but way over my head. I would like to use only the FFT portion of the meter as a visualizer. I've removed quite a bit and am now at a point where my lack of understanding GDI+ makes me feel like a carpenter trying to perform heart surgery.
      Can anyone point out additional unneeded code and BASS calls in the script below?
      Please note that I'll be playing a single mp3 file in my script, so I'll ultimately remove the FileOpenDialog and Debug code, too.
      ;thx to Authenticity for GDIp.au3 #AutoIt3Wrapper_UseX64=n #include "Bass.au3" #include "BassExt.au3" #include <GDIPlus.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Global $sFile = FileOpenDialog("Open...", "", "playable formats (*.MP3;*.MP2;*.MP1;*.OGG;*.WAV;*.AIFF;*.AIF)") If @error Or Not FileExists($sFile) Then Exit Global $iWidth = 410 Global $iHeight = 170 Global $hGui, $hGraphics, $hGfxBuffer, $hBmpBuffer, $hBmpBk, $hBmpMeter, $hBmpLed, $hBmpPhase, $hBmpPhaseMeter, $hBmpWave, $hBrushFFT, $hPenPhase, $hPenWaveL, $hPenWaveR Global $aFFT, $aPeak, $aPhaseCorr, $aPhase, $aWave Global $iTimer Global $hStream $hGui = GUICreate("BASS_EXT AudioMeter", $iWidth, $iHeight) GUISetOnEvent(-3, "_EXIT") GUISetBkColor(0x000000) _GDIPlus_Startup() $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer) _GDIPlus_GraphicsSetSmoothingMode($hGfxBuffer, 2) $hBrushFFT = _BrushCreateFFT(0, 0, 410, 170, $iWidth, $iHeight, $hGraphics) $aFFT = _BASS_EXT_CreateFFT(82, 0, 0, 410, 170, 1, 70, True) $hBmpBk = _BMPCreateBackGround($iWidth, $iHeight, $hGraphics) _BASS_Startup(@ScriptDir & "\bass.dll") ___Debug(@error, "load bass.dll") _BASS_EXT_Startup(@ScriptDir & "\bassExt.dll") ___Debug(@error, "load bassext.dll") _BASS_Init(0, -1, 44100, 0, "") ___Debug(@error, "initialize bass") _BASS_SetConfig($BASS_CONFIG_UPDATEPERIOD, 100) ___Debug(@error, "set update period") _BASS_SetConfig($BASS_CONFIG_BUFFER, 250) ___Debug(@error, "set buffer size") GUIRegisterMsg(0x000F, "WM_PAINT") GUISetState() $hStream = _BASS_StreamCreateFile(False, $sFile, 0, 0, 0) ___Debug(@error, "create stream from file: " & $sFile) $aPeak = _BASS_EXT_ChannelSetMaxPeakDsp($hStream) ___Debug(@error, "set dsp callback to check for the highest peak") _BASS_ChannelPlay($hStream, True) ___Debug(@error, "start stream") $iTimer = TimerInit() While _BASS_ChannelIsActive($hStream) If TimerDiff($iTimer) > 25 Then $iTimer = TimerInit() _GDIPlus_GraphicsDrawImage($hGfxBuffer, $hBmpBk, 0, 0) _DrawFFT() _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) ;ConsoleWrite(TimerDiff($iTimer) & @CRLF) EndIf WEnd _Exit() Func _DrawFFT() Local $iTimer = TimerInit() _BASS_EXT_ChannelGetFFT($hStream, $aFFT, 6) If Not @error Then DllCall($ghGDIPDll, "int", "GdipFillPolygonI", "handle", $hGfxBuffer, "handle", $hBrushFFT, "ptr", $aFFT[0], "int", $aFFT[1], "int", "FillModeAlternate") EndFunc ;==>_DrawFFT Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0) Return 'GUI_RUNDEFMSG' EndFunc ;==>WM_PAINT Func _BMPCreateBackGround($iW, $iH, $hGraphics) Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hContext, 2) _GDIPlus_GraphicsClear($hContext, 0xFF000000) Local $hBrushBK = _GDIPlus_BrushCreateSolid(0xEE000000) Local $hBrushTXT = _GDIPlus_BrushCreateSolid(0xFF99AAFF) Local $hPen = _GDIPlus_PenCreate(0xFF222222, 1) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrushBK) _GDIPlus_BrushDispose($hBrushTXT) _GDIPlus_GraphicsDispose($hContext) Return $hBitmap EndFunc ;==>_BMPCreateBackGround Func _BrushCreateFFT($iX, $iY, $iW, $iH, $iWidth, $iHeight, $hGraphics) Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsClear($hContext, 0xFF000000) Local $hBrush[5] $hBrush[0] = _GDIPlus_BrushCreateSolid(0xFFFF0000) $hBrush[1] = _GDIPlus_LineBrushCreate(0, 0, 0, 20, 0xFFFF0000, 0xFFFFAA00, 1) $hBrush[2] = _GDIPlus_LineBrushCreate(0, 20, 0, 40, 0xFFFFAA00, 0xFF00AAFF, 1) $hBrush[3] = _GDIPlus_BrushCreateSolid(0xFF00AAFF) $hBrush[4] = _GDIPlus_LineBrushCreate(0, 0, 0, 4, 0x00000000, 0xAA000000, 0) _GDIPlus_GraphicsFillRect($hContext, $iX, $iY, $iW, 20, $hBrush[0]) _GDIPlus_GraphicsFillRect($hContext, $iX, $iY + 20, $iW, 20, $hBrush[1]) _GDIPlus_GraphicsFillRect($hContext, $iX, $iY + 40, $iW, 20, $hBrush[2]) _GDIPlus_GraphicsFillRect($hContext, $iX, $iY + 60, $iW, $iH - 60, $hBrush[3]) _GDIPlus_GraphicsFillRect($hContext, $iX, $iY, $iW, $iH, $hBrush[4]) For $i = 0 To 4 _GDIPlus_BrushDispose($hBrush[$i]) Next _GDIPlus_GraphicsDispose($hContext) Local $aRet = DllCall($ghGDIPDll, "uint", "GdipCreateTexture", "hwnd", $hBitmap, "int", 0, "int*", 0) _GDIPlus_BitmapDispose($hBitmap) Return $aRet[3] EndFunc ;==>_BrushCreateFFT Func _Exit() _BASS_EXT_ChannelRemoveMaxPeakDsp($aPeak) ___Debug(@error, "remove peak dsp") _BASS_ChannelStop($hStream) ___Debug(@error, "stop stream") _BASS_StreamFree($hStream) ___Debug(@error, "free stream") _BASS_Free() ___Debug(@error, "free bass") ;~ _GDIPlus_BitmapDispose($hBmpMeter) ;~ _GDIPlus_BitmapDispose($hBmpLed) ;~ _GDIPlus_BitmapDispose($hBmpPhaseMeter) ;~ _GDIPlus_BitmapDispose($hBmpPhase) ;~ _GDIPlus_PenDispose($hPenPhase) ;~ _GDIPlus_BitmapDispose($hBmpWave) ;~ _GDIPlus_PenDispose($hPenWaveL) ;~ _GDIPlus_PenDispose($hPenWaveR) _GDIPlus_BrushDispose($hBrushFFT) _GDIPlus_BitmapDispose($hBmpBk) _GDIPlus_GraphicsDispose($hGfxBuffer) _GDIPlus_BitmapDispose($hBmpBuffer) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit Func ___DeBug($iError, $sAction) Switch $iError Case -1 ConsoleWrite(@CRLF & "-" & $sAction & @CRLF) Case -2 ConsoleWrite(@CRLF & ">" & $sAction & @CRLF) Case 0 ConsoleWrite(@CRLF & "+" & $sAction & " - OK" & @CRLF) Case Else ConsoleWrite(@CRLF & "!" & $sAction & " - FAILED, @error: " & $iError & @CRLF) _Exit() EndSwitch EndFunc ;==>___DeBug Func _GDIPlus_LineBrushCreate($nX1, $nY1, $nX2, $nY2, $iARGBClr1, $iARGBClr2, $iWrapMode = 0) Local $tPointF1, $pPointF1 Local $tPointF2, $pPointF2 Local $aResult $tPointF1 = DllStructCreate("float;float") $pPointF1 = DllStructGetPtr($tPointF1) $tPointF2 = DllStructCreate("float;float") $pPointF2 = DllStructGetPtr($tPointF2) DllStructSetData($tPointF1, 1, $nX1) DllStructSetData($tPointF1, 2, $nY1) DllStructSetData($tPointF2, 1, $nX2) DllStructSetData($tPointF2, 2, $nY2) $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "ptr", $pPointF1, "ptr", $pPointF2, "uint", $iARGBClr1, "uint", $iARGBClr2, "int", $iWrapMode, "int*", 0) If @error Then Return SetError(@error, @extended, 0) ;$GDIP_STATUS = $aResult[0] Return $aResult[6] EndFunc ;==>_GDIPlus_LineBrushCreate