Jump to content

Audio Spectrascope


ConsultingJoe
 Share

Recommended Posts

Posted Image Posted Image

#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

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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
FootbaG
Link to comment
Share on other sites

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:

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

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

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

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".

Link to comment
Share on other sites

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

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

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

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.

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

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__________________________________________________________________________________________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

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

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

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

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.

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...