Jump to content



Photo

Audio Spectrascope


  • Please log in to reply
36 replies to this topic

#1 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 17 October 2006 - 12:52 AM

Posted Image Posted Image
AutoIt         
#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 by zerocool60544, 17 October 2006 - 09:28 PM.






#2 spyrorocks

spyrorocks

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 728 posts

Posted 17 October 2006 - 01:36 AM

wow havent tested this yet but it looks pretty cool :lmao:

#3 this-is-me

this-is-me

    Pursuer of obscure functionality

  • Active Members
  • PipPipPipPipPipPip
  • 2,372 posts

Posted 17 October 2006 - 01:48 AM

Can this be modded to accept audio output instead of line in?
Who else would I be?

#4 layer

layer

    i love skateboarding

  • Active Members
  • PipPipPipPipPipPip
  • 2,470 posts

Posted 17 October 2006 - 01:54 AM

havent tested it but ive always wanted to make something like this, awesome :lmao: 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 :ph34r: 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 by layer, 17 October 2006 - 01:57 AM.

FootbaG

#5 the DtTvB

the DtTvB

    Adventurer

  • Active Members
  • PipPip
  • 113 posts

Posted 17 October 2006 - 02:30 AM

Looks strange, but it looks cool!

#6 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 17 October 2006 - 03:19 AM

but like this-is-me said it would be neater if you could get the audio from the speakers :lmao: 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


what do you guys mean about the audio, Record or something like play music through it?
and explain the glich with the refresh.

Thanks :ph34r:

#7 this-is-me

this-is-me

    Pursuer of obscure functionality

  • Active Members
  • PipPipPipPipPipPip
  • 2,372 posts

Posted 17 October 2006 - 03:40 AM

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?

#8 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 17 October 2006 - 01:22 PM

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

#9 CoderDunn

CoderDunn

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 345 posts

Posted 17 October 2006 - 03:26 PM

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


this-is-me wants to get make a spectrascope of music playing on your computer (For example, in i-tunes)
or "Audio Output".

#10 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 17 October 2006 - 03:31 PM

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

#11 this-is-me

this-is-me

    Pursuer of obscure functionality

  • Active Members
  • PipPipPipPipPipPip
  • 2,372 posts

Posted 17 October 2006 - 03:39 PM

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?

#12 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 17 October 2006 - 03:46 PM

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.

#13 Manadar

Manadar

    Taking a REST.

  • MVPs
  • 10,714 posts

Posted 17 October 2006 - 03:51 PM

I love it. How far are you on creating a sound-triggered event? :ph34r:

Edit: Beats per minute monitoring.. :lmao:

Edited by Manadar, 17 October 2006 - 04:01 PM.


#14 layer

layer

    i love skateboarding

  • Active Members
  • PipPipPipPipPipPip
  • 2,470 posts

Posted 17 October 2006 - 07:21 PM

what do you guys mean about the audio, Record or something like play music through it?
and explain the glich with the refresh.

Thanks :lmao:

i'll try and search the web for the audio output when i get the time

and 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

#15 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 17 October 2006 - 09:26 PM

i'll try and search the web for the audio output when i get the time

and 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

#16 layer

layer

    i love skateboarding

  • Active Members
  • PipPipPipPipPipPip
  • 2,470 posts

Posted 18 October 2006 - 01:24 AM

wow, nice job :lmao:

i'll try to do the mod tomorrow, thanks
FootbaG

#17 eynstyne

eynstyne

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 251 posts

Posted 18 October 2006 - 03:02 PM

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

:lmao:
F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________Posted Imageite 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

Posted ImagePosted Image


#18 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 19 October 2006 - 02:07 AM

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

:lmao:

Thanks Guys

#19 gamerman2360

gamerman2360

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 505 posts

Posted 19 October 2006 - 06:12 AM

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.

#20 ConsultingJoe

ConsultingJoe

    ConsultingJoe.com

  • Active Members
  • PipPipPipPipPipPip
  • 1,667 posts

Posted 19 October 2006 - 05:13 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users