ConsultingJoe Posted October 17, 2006 Share Posted October 17, 2006 (edited) expandcollapse popup#Include <string.au3> #Include <GUIConstants.au3> #include <misc.au3> $dot = False $bg = 0x222222 $graph = 0xFFFFFF Opt( "GUIOnEventMode", 1 ) Dim $lpszDevice Dim $lpszDeviceID Dim $lpszOpenFlags Dim $lpszRequest Dim $lpszFlags Dim $lpszCommand Dim $lpszReturnString Dim $cchReturn Dim $mciError $lpszDevice = "new type waveaudio" $lpszOpenFlags = "alias mywave" $lpszFlags = "" $lpszCommand = StringFormat( "open %s %s %s", $lpszDevice, $lpszOpenFlags, $lpszFlags) $lpszReturnString = _StringRepeat( " ", 100) $cchReturn = StringLen($lpszReturnString) $mciError = _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, 0); If $mciError[0] <> 0 Then _mciShowError($mciError[0]) $lpszDeviceID = "mywave" $lpszRequest = "level" $lpszFlags = "" $lpszCommand = StringFormat( "status %s %s %s", $lpszDeviceID, $lpszRequest, $lpszFlags); $Form1 = GUICreate("GRAPHICAL WAVE BY ZEROCOOL", 281, 197, 193, 115) $box = GuiCtrlCreateGraphic(0, 8, 281, 107) GUICtrlSetBkColor(-1,$bg) GUICtrlSetColor(-1,0) GUICtrlSetGraphic( -1, $GUI_GR_MOVE, 0, 107/2) GUICtrlSetGraphic( -1, $GUI_GR_LINE, 281, 107/2) $marker = GuiCtrlCreateGraphic(0, 8, 1, 107) GUICtrlSetBkColor(-1,0xFFFFFF) $Button1 = GUICtrlCreateButton("Start", 0, 120, 89, 33, 0) $Button2 = GUICtrlCreateButton("Stop", 96, 120, 89, 33, 0) $Button3 = GUICtrlCreateButton("Clear", 192, 120, 89, 33, 0) $Button4 = GUICtrlCreateButton("BG Color", 0, 160, 89, 33, 0) $Button5 = GUICtrlCreateButton("Graph Color", 192, 160, 89, 33, 0) $Button6 = GUICtrlCreateButton("Lines/Dots", 96, 160, 89, 33, 0) GUISetState(@SW_SHOW) GUICtrlSetOnEvent ( $Button1, "start" ) GUICtrlSetOnEvent ( $Button2, "stop" ) GUICtrlSetOnEvent ( $Button3, "clear" ) GUICtrlSetOnEvent ( $Button4, "graph_color" ) GUICtrlSetOnEvent ( $Button5, "bg_color" ) GUICtrlSetOnEvent ( $Button6, "toggle" ) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") $point = 0 $run = False While 1 If $run = True Then $mciError = _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, 0); If $mciError[0] <> 0 Then _mciShowError($mciError[0]) If $dot = True Then GUICtrlSetGraphic( $box, $GUI_GR_COLOR, $graph) GUICtrlSetGraphic( $box, $GUI_GR_DOT, $point, (107/2)+$mciError[2]/2 ) GUICtrlSetGraphic( $box, $GUI_GR_DOT, $point, (107/2)-$mciError[2]/2 ) Else GUICtrlSetGraphic( $box, $GUI_GR_MOVE, $point, 107/2) GUICtrlSetGraphic( $box, $GUI_GR_COLOR, $graph) GUICtrlSetGraphic( $box, $GUI_GR_LINE, $point, (107/2)+$mciError[2]/2 ) GUICtrlSetGraphic( $box, $GUI_GR_LINE, $point, (107/2)-$mciError[2]/2 ) EndIf $point = $point + 1 If $point > 280 Then GUICtrlDelete( $box ) GUICtrlDelete( $marker ) $box = GuiCtrlCreateGraphic(0, 8, 281, 107) GUICtrlSetGraphic( -1, $GUI_GR_MOVE, 0, 107/2) GUICtrlSetGraphic( -1, $GUI_GR_COLOR, $graph) GUICtrlSetGraphic( -1, $GUI_GR_LINE, 281, 107/2) GUICtrlSetBkColor(-1,$bg) GUICtrlSetColor(-1,0) GUICtrlSetGraphic( -1, $GUI_GR_MOVE, 0, 107/2) GUICtrlSetGraphic( -1, $GUI_GR_COLOR, $graph) GUICtrlSetGraphic( -1, $GUI_GR_LINE, 281, 107/2) $marker = GuiCtrlCreateGraphic(0, 8, 3, 107) GUICtrlSetBkColor(-1,0xFFFFFF) $point = 0 Sleep(10) EndIf GUICtrlSetPos ( $marker, $point, 8 ) EndIf Sleep(10) WEnd Func bg_color() Global $bg = _ChooseColor(2, $bg, 2) GUICtrlSetBkColor($box,$bg) EndFunc Func graph_color() Global $graph = _ChooseColor(2, $graph, 2) GUICtrlSetBkColor($marker,$graph) EndFunc Func toggle() If $dot = False Then $dot = True Else $dot = False EndIf EndFunc Func start() $run = True EndFunc Func stop() $run = False EndFunc Func clear() GUICtrlDelete( $box ) GUICtrlDelete( $marker ) $box = GuiCtrlCreateGraphic(0, 8, 281, 107) GUICtrlSetBkColor(-1,$bg) GUICtrlSetColor(-1,0) GUICtrlSetGraphic( -1, $GUI_GR_MOVE, 0, 107/2) GUICtrlSetGraphic( -1, $GUI_GR_COLOR, $graph) GUICtrlSetGraphic( -1, $GUI_GR_LINE, 281, 107/2) $marker = GuiCtrlCreateGraphic(0, 8, 3, 107) GUICtrlSetBkColor(-1,$graph) $point = 0 EndFunc Func SpecialEvents() Exit EndFunc Func _mciSendString($lpszCommand, $lpszReturnString, $cchReturn, $hwndCallback) Return DllCall("winmm.dll", "long", "mciSendStringA", "str", $lpszCommand, "str", $lpszReturnString, "long", $cchReturn, "long", 0) EndFunc ;==>_mciSendString Func _mciShowError($mciError) Dim $errStr; Error message $errStr = _StringRepeat( " ", 100) ; Reserve some space for the error message $Result = DllCall("winmm.dll", "long", "mciGetErrorStringA", "long", $mciError, "string", $errStr, "long", StringLen($errStr)) MsgBox(0, "MCI test", "MCI Error Number " & $mciError & ":" & $Result[2]) EndFunc ;==>_mciShowError Edited October 17, 2006 by zerocool60544 Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
spyrorocks Posted October 17, 2006 Share Posted October 17, 2006 wow havent tested this yet but it looks pretty cool [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
this-is-me Posted October 17, 2006 Share Posted October 17, 2006 Can this be modded to accept audio output instead of line in? Who else would I be? Link to comment Share on other sites More sharing options...
layer Posted October 17, 2006 Share Posted October 17, 2006 (edited) havent tested it but ive always wanted to make something like this, awesome i never knew what it was called so i couldnt start one edit: aw this is neat, but like this-is-me said it would be neater if you could get the audio from the speakers and theres just something about the way it refreshes the graphic ? i'm not sure.. sorry if im nitpicking, but its just annoying, maybe make it so it stays still instead of moving, i dont know, up to you Edited October 17, 2006 by layer FootbaG Link to comment Share on other sites More sharing options...
the DtTvB Posted October 17, 2006 Share Posted October 17, 2006 Looks strange, but it looks cool! [right]Please visit: My biggest project, the DtTvB's AutoIt Web ServerOlder Stuff: A Smoother MouseMove :: AutoIt Syntax Highlighter[/right] Link to comment Share on other sites More sharing options...
ConsultingJoe Posted October 17, 2006 Author Share Posted October 17, 2006 but like this-is-me said it would be neater if you could get the audio from the speakers and theres just something about the way it refreshes the graphic ? i'm not sure.. sorry if im nitpicking, but its just annoying, maybe make it so it stays still instead of moving, i dont know, up to youwhat do you guys mean about the audio, Record or something like play music through it?and explain the glich with the refresh.Thanks Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
this-is-me Posted October 17, 2006 Share Posted October 17, 2006 When I have music playing from my computer, I would like the script to recognise that instead of only graphing the line or mic input. Who else would I be? Link to comment Share on other sites More sharing options...
ConsultingJoe Posted October 17, 2006 Author Share Posted October 17, 2006 When I have music playing from my computer, I would like the script to recognise that instead of only graphing the line or mic input.what do you mean by recognize it, Like a voice tag so it it hears the same sound again it will do a command?all this does it use the volume levels it doesn't measure khz Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
CoderDunn Posted October 17, 2006 Share Posted October 17, 2006 what do you mean by recognize it, Like a voice tag so it it hears the same sound again it will do a command?all this does it use the volume levels it doesn't measure khzthis-is-me wants to get make a spectrascope of music playing on your computer (For example, in i-tunes)or "Audio Output". Link to comment Share on other sites More sharing options...
ConsultingJoe Posted October 17, 2006 Author Share Posted October 17, 2006 this-is-me wants to get make a spectrascope of music playing on your computer (For example, in i-tunes)or "Audio Output".All you would have to do is set your recording device to Wave instead of Mic Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
this-is-me Posted October 17, 2006 Share Posted October 17, 2006 We don't want the spectroscope to monitor recording at all. We would like to see if it is possible for it to monitor output instead of input. In my case, I cannot set the recording device to wave instead of mic because I have applications that accept voice input. Who else would I be? Link to comment Share on other sites More sharing options...
ConsultingJoe Posted October 17, 2006 Author Share Posted October 17, 2006 We don't want the spectroscope to monitor recording at all. We would like to see if it is possible for it to monitor output instead of input. In my case, I cannot set the recording device to wave instead of mic because I have applications that accept voice input.ok, well I dont know how to do that without changing the settings, but it does listen to output when you do set that. Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
jvanegmond Posted October 17, 2006 Share Posted October 17, 2006 (edited) I love it. How far are you on creating a sound-triggered event? Edit: Beats per minute monitoring.. Edited October 17, 2006 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
layer Posted October 17, 2006 Share Posted October 17, 2006 what do you guys mean about the audio, Record or something like play music through it?and explain the glich with the refresh.Thanks i'll try and search the web for the audio output when i get the timeand about the refresh, like, you know how when the end of the lines reaches the end of the GUI? and the GUI is "refreshed and cleared" from the old input sound, well i was suggesting adding a way to have it stay in one spot, so there is no need to refresh like is, sort of like Windows Sound Recorder, when you record stuff, look at the waves it makes, how they stay in one spot..sorry if i'm not explaining this well :"> FootbaG Link to comment Share on other sites More sharing options...
ConsultingJoe Posted October 17, 2006 Author Share Posted October 17, 2006 i'll try and search the web for the audio output when i get the timeand about the refresh, like, you know how when the end of the lines reaches the end of the GUI? and the GUI is "refreshed and cleared" from the old input sound, well i was suggesting adding a way to have it stay in one spot, so there is no need to refresh like is, sort of like Windows Sound Recorder, when you record stuff, look at the waves it makes, how they stay in one spot..sorry if i'm not explaining this well :">Well the waves in the windows recorder actually do move where mine stays still but refreshes at the end. but there are all different kinds. You could mod mine to do it if you want.Update to the script on first post Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
layer Posted October 18, 2006 Share Posted October 18, 2006 wow, nice job i'll try to do the mod tomorrow, thanks FootbaG Link to comment Share on other sites More sharing options...
eynstyne Posted October 18, 2006 Share Posted October 18, 2006 I'm working on an audio lab for school and this is totally awesome! I'll definately input this in. Don't worry, I'll give you credit. Along with anyone who created UDF's which I used. Amazing Job zerocool60544 F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent] Link to comment Share on other sites More sharing options...
ConsultingJoe Posted October 19, 2006 Author Share Posted October 19, 2006 I'm working on an audio lab for school and this is totally awesome! I'll definately input this in. Don't worry, I'll give you credit.Along with anyone who created UDF's which I used.Amazing Job zerocool60544 Thanks Guys Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
gamerman2360 Posted October 19, 2006 Share Posted October 19, 2006 Cool! I was planning on doing the same thing... Only with an oscilloscope(dang thing gets harder to spell every time I do it). Mind if I use some of your code(if I ever get to it and if you don't want to)? This is also the first time I've seen _ChooseColor used.. I should look at the include files more often. Link to comment Share on other sites More sharing options...
ConsultingJoe Posted October 19, 2006 Author Share Posted October 19, 2006 Cool! I was planning on doing the same thing... Only with an oscilloscope(dang thing gets harder to spell every time I do it). Mind if I use some of your code(if I ever get to it and if you don't want to)?This is also the first time I've seen _ChooseColor used.. I should look at the include files more often.Sure go for it,_chooseColor is great.and see if there is a way to measure low sounds and high sounds. Check out ConsultingJoe.com 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