59FIFTY Posted December 11, 2008 Share Posted December 11, 2008 Hi there I've got a question to ask. I need a little Program that visualizes the current sound output in bars (like a synthesizer). That means even if I play an mp3 in wmplayer it should display it with AutoIt. Is that even possible? And I mean very simple, like volume output or frequencies. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted December 11, 2008 Share Posted December 11, 2008 Did you look at Bass.au3? Giggity Link to comment Share on other sites More sharing options...
59FIFTY Posted December 11, 2008 Author Share Posted December 11, 2008 This works fine for a soundfile, but I want to read out the current system sound ("stereo mix") Link to comment Share on other sites More sharing options...
monoceres Posted December 11, 2008 Share Posted December 11, 2008 This works fine for a soundfile, but I want to read out the current system sound ("stereo mix")It's possible to open a recording device in Bass as well.If you want to see how you can visualize the data from Bass you can check the Audio Viz in my sig. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
59FIFTY Posted December 11, 2008 Author Share Posted December 11, 2008 (edited) I've downloaded your zip-file but it's a bit difficult to read/understand. Can you post an example of how to open stereo mix and get _BASS_ChannelGetLevel for the input? caus' I'm really struggeling here even to get just the value of the peak's I tried this but only returns 0 on both channels #include <Bass.au3> #include <BassConstants.au3> $bass_dll = DllOpen("BASS.dll") _BASS_Init ($bass_dll, 0, -1, 44100, 0, "") $HRECORD = _BASS_RecordStart($bass_dll, 44100, 2, $BASS_SAMPLE_FLOAT) $levels = _BASS_ChannelGetLevel ($bass_dll, $HRECORD) $right = _LoWord ($levels) $left = _HiWord ($levels) While 1 ConsoleWrite("R ["&$right&"] L ["&$left&"]"&@CRLF) Sleep(500) Wend Edited December 11, 2008 by 59FIFTY Link to comment Share on other sites More sharing options...
59FIFTY Posted December 11, 2008 Author Share Posted December 11, 2008 I've got to solve this fast :\ Link to comment Share on other sites More sharing options...
59FIFTY Posted December 11, 2008 Author Share Posted December 11, 2008 No suggestions? I'm trying the whole day now and it won't work Link to comment Share on other sites More sharing options...
monoceres Posted December 11, 2008 Share Posted December 11, 2008 I haven't got time to write code for you, but are you sure you're actually recording the stereomix and not the microphone? Also check that the levels for the device are high enough. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
59FIFTY Posted December 11, 2008 Author Share Posted December 11, 2008 (edited) ok it works now, the only problem is that if I play a sound the level get's to 32768 even if i reduce the stereo mix volume, that's why? This is my current Scriptexpandcollapse popup#include <GUIConstants.au3> #include <Bass.au3> #include <BassConstants.au3> AutoItSetOption("TrayIconHide", TRUE) AutoItSetOption("GUIOnEventMode", 1) ; BASS.DLL Init $bass_dll = DllOpen("BASS.dll") _BASS_Init ($bass_dll, 0, -1, 44100, 0, "") ; Create GUI $StereoMixer = GUICreate("RecordPeakVol", 457, 123, 199, 116) $prg_left = GUICtrlCreateProgress(8, 80, 438, 32) $prg_right = GUICtrlCreateProgress(8, 40, 438, 32) $btn_start = GUICtrlCreateButton("start", 8, 8, 75, 25, 0) $btn_stop = GUICtrlCreateButton("stop", 88, 8, 75, 25, 0) GUISetOnEvent($GUI_EVENT_CLOSE, "GUIClose") GUICtrlSetOnEvent($btn_stop, "btn_stopClick") GUICtrlSetOnEvent($btn_start, "btn_startClick") GUISetState(@SW_SHOW) ; Variables Dim $File, $mhnd, $play = FALSE, $device = 0 While 1 If $play Then $peaks = _BASS_ChannelGetLevel($bass_dll, $mhnd) ;get volume peaks $right = Round((_LoWord($peaks)/32768)*100, 0) ;round to percent $left = Round((_HiWord($peaks)*-1/32768)*100, 0) GUICtrlSetData($prg_left, $left) GUICtrlSetData($prg_right, $right) ConsoleWrite('L ['&_HiWord($peaks)*-1&'] - R ['&_LoWord($peaks)&']' & @CRLF) Sleep(50) EndIf WEnd Func btn_startClick() ;start recording sound from stereo mixer _BASS_RecordInit($bass_dll, $device) ;init record to stereo mixer $RecDevice = _BASS_RecordGetInputName($bass_dll, $device) ;check if input is Stereo Mixer ConsoleWrite('Start recording from: ' & $RecDevice & @CRLF) _BASS_RecordSetInput($bass_dll, $device, $BASS_INPUT_ON, 1) $mhnd = _BASS_RecordStart($bass_dll, 44100, 5, 0) ;start record stereo _BASS_ChannelPlay($bass_dll, $mhnd, FALSE) ;play channel $play = TRUE EndFunc Func btn_stopClick() ;stop recording sound from stereo mixer _BASS_ChannelStop($bass_dll, $mhnd) $play = FALSE EndFunc Func GUIClose() ;quit app Exit EndFunc Edited December 11, 2008 by 59FIFTY Link to comment Share on other sites More sharing options...
59FIFTY Posted December 11, 2008 Author Share Posted December 11, 2008 ok I had to change _BASS_RecordSetInput($bass_dll, $device, $BASS_INPUT_ON, -1) because I set the volume to 1, now I leave it. Full working script (reading from device 0) expandcollapse popup#include <GUIConstants.au3> #include <Bass.au3> #include <BassConstants.au3> AutoItSetOption("TrayIconHide", TRUE) AutoItSetOption("GUIOnEventMode", 1) ; BASS.DLL Init $bass_dll = DllOpen("BASS.dll") _BASS_Init ($bass_dll, 0, -1, 44100, 0, "") ; Create GUI $StereoMixer = GUICreate("RecordPeakVol", 457, 123, 199, 116) $prg_left = GUICtrlCreateProgress(8, 80, 438, 32) $prg_right = GUICtrlCreateProgress(8, 40, 438, 32) $btn_start = GUICtrlCreateButton("start", 8, 8, 75, 25, 0) $btn_stop = GUICtrlCreateButton("stop", 88, 8, 75, 25, 0) GUISetOnEvent($GUI_EVENT_CLOSE, "GUIClose") GUICtrlSetOnEvent($btn_stop, "btn_stopClick") GUICtrlSetOnEvent($btn_start, "btn_startClick") GUISetState(@SW_SHOW) ; Variables Dim $File, $mhnd, $play = FALSE, $device = 0 While 1 If $play Then $peaks = _BASS_ChannelGetLevel($bass_dll, $mhnd) ;get volume peaks $right = Round((_LoWord($peaks)/32768)*100, 0) ;round to percent $left = Round((_HiWord($peaks)/32768)*100, 0) GUICtrlSetData($prg_left, $left) GUICtrlSetData($prg_right, $right) ConsoleWrite('L ['&_HiWord($peaks)&'] - R ['&_LoWord($peaks)&']' & @CRLF) Sleep(50) EndIf WEnd Func btn_startClick() ;start recording sound from stereo mixer _BASS_RecordInit($bass_dll, $device) ;init record to stereo mixer $RecDevice = _BASS_RecordGetInputName($bass_dll, $device) ;check if input is Stereo Mixer ConsoleWrite('Start recording from: ' & $RecDevice & @CRLF) _BASS_RecordSetInput($bass_dll, $device, $BASS_INPUT_ON, -1) $mhnd = _BASS_RecordStart($bass_dll, 44100, 5, 0) ;start record stereo _BASS_ChannelPlay($bass_dll, $mhnd, FALSE) ;play channel $play = TRUE EndFunc Func btn_stopClick() ;stop recording sound from stereo mixer _BASS_ChannelStop($bass_dll, $mhnd) $play = FALSE EndFunc Func GUIClose() ;quit app Exit EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now