Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Volume Leveler?

$
0
0

I managed to dig up some old movies from my old hard drive, Turns out that the background music isn't really background music at all.

What happens is that the voices of people are very soft and the "background" music is so loud that I have to turn my speakers down.

I came up with the idea to level the master volume and here it is:

AutoIt         
  1. HotKeySet("{ESC}", "_Exit")
  2.  
  3. Global $iLimit = 60 ; Limit in Db
  4.  
  5.     $iCurVol = _Function_To_Get_Current_Playback_Volume() ; Gets the current playback volume in Db (loudness)
  6.     If $iCurVol > $iLimit Then
  7.         Do
  8.             $iVol = _Function_To_Get_Master_Volume() ; Returns the master vol in %
  9.             _Function_To_Set_Master_Volume($iVol - 1) ; Sets the master vol in %
  10.         Until _Function_To_Get_Current_Playback_Volume() = $iLimit
  11.     ElseIf $iCurVol < $iLimit Then
  12.         Do
  13.             $iVol = _Function_To_Get_Master_Volume() ; Returns the master vol in %
  14.             _Function_To_Set_Master_Volume($iVol - 1) ; Sets the master vol in %
  15.         Until _Function_To_Get_Current_Playback_Volume() = $iLimit
  16.     EndIf
  17.     Sleep(100) ; Check every 100 ms to reduce CPU load
  18.  
  19. Func _Exit()
  20.     Exit
  21. EndFunc   ;==>_Exit

As you can see I need 3 functions:

  1. One to get the current DB of the playback volume
  2. A second one to get the master volume
  3. And a third one to set the master volume

Viewing all articles
Browse latest Browse all 12506

Trending Articles