Jump to content

Maybe the 1st musical keyboard in Autoit?


Valuater
 Share

Recommended Posts

here it is

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>

$Logo_icon = @HomeDrive & "\Temp\XPClean-Icon.ico"
    FileInstall("C:\XPClean-web\Settings\XPClean-pics\XPClean-Main-Pic-Icon.ico", $Logo_icon)

$Ver= "Thank you - Test Example"
Dim $QT_web = "www.XPCleanMenu.HostRocket.com"

;~;--------------above is in *XPClean Menu* -----------------
Dim $Rad="", $P_T="Short", $P_T_1="200"

#region --- GuiBuilder code Start --->>>>>>>>>>>>>>>>>>>>>>>>>>>   THANK YOU  GUI-BUILDER

$Organ=GuiCreate("       *XPClean Menu* + ORGANized                                                           Version " & $Ver, 897, 325,(@DesktopWidth-897)/2, (@DesktopHeight-325)/2 );, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
GUISetBkColor ("")
GUISetFont(9, 400, -1, "MS Sans Serif")

GUICtrlSetColor(-1,0xff0000)

; left radio buttons
GUIStartGroup()
$Radio_L1 = GuiCtrlCreateRadio("Music", 10, 70, 15, 20)
GUICtrlSetState(-1, $GUI_CHECKED); will set Music as default
$Label_L1 = GuiCtrlCreateLabel("Music", 30, 75, 60, 20)
GUICtrlSetFont(-1, 12, 10)
GUICtrlSetColor(-1,0xff0000)
$Radio_L2 = GuiCtrlCreateRadio("Clean*", 10, 110, 15, 20)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label_L2 = GuiCtrlCreateLabel("Clean", 30, 115, 60, 20)
GUICtrlSetFont(-1, 12, 10)
GUICtrlSetColor(-1,0xff0000)

; right radio buttons
GUIStartGroup()
$Radio_R1 = GuiCtrlCreateRadio("Level  1",810, 70, 20, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
$Label_R1 = GuiCtrlCreateLabel("Level  1", 830, 75, 60, 20)
GUICtrlSetFont(-1, 12, 10)
GUICtrlSetColor(-1,0x8080ff )
$Radio_R2 = GuiCtrlCreateRadio("Level  2", 810, 110, 20, 20)
$Label_R2 = GuiCtrlCreateLabel("Level  2", 830, 115, 60, 20)
GUICtrlSetFont(-1, 12, 10)
GUICtrlSetColor(-1,0x8080ff )

; play list
$Playlist = GUICtrlcreatecombo( "Play List", 5, 190, 90)
GUICtrlSetData(-1,"Joy to the World")
GUICtrlSetData(-2,"Your song here")
GUICtrlSetData(-3,"Your song here")
GUICtrlSetData(-4,"Play List")
GUICtrlSetData(-5,"Play List")
$Button_P = GuiCtrlCreateButton("Play Song", 10, 230, 70, 20)

; sound duration
$NotePlay = GUICtrlcreatecombo( "Note Play", 5, 270, 90)
GUICtrlSetData(-1,"Short")
GUICtrlSetData(-2,"Medium")
GUICtrlSetData(-3,"Long")
$Label_S1 = GuiCtrlCreateLabel("Duration", 20, 300, 80, 20)
GUICtrlSetFont(-1, 10, 10)
GUICtrlSetColor(-1, 0x8080ff )

;Upper buttons
$Button_1 = GUICtrlCreateLabel("Button26", 130, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER , $WS_EX_TOPMOST )
$Button_2 = GUICtrlCreateLabel("Button27", 180, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER , $WS_EX_TOPMOST )
$Button_3 = GUICtrlCreateLabel("Button28", 230, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER , $WS_EX_TOPMOST )
$Button_4 = GUICtrlCreateLabel("Button29", 330, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER , $WS_EX_TOPMOST )
$Button_5 = GUICtrlCreateLabel("Button30", 380, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER , $WS_EX_TOPMOST )
$Button_6 = GUICtrlCreateLabel("Button31", 480, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER , $WS_EX_TOPMOST )
$Button_7 = GUICtrlCreateLabel("Button32", 530, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER , $WS_EX_TOPMOST )
$Button_8 = GUICtrlCreateLabel("Button33", 580, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER , $WS_EX_TOPMOST )
$Button_9 = GUICtrlCreateLabel("Button34", 680, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER , $WS_EX_TOPMOST )
$Button_10 = GUICtrlCreateLabel("Button35", 730, 50, 40, 170, $SS_BLACKRECT + $SS_SUNKEN + $SS_CENTER , $WS_EX_TOPMOST )

; Lower buttons
$Button_11 = GUICtrlCreateLabel("Button11", 100, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_12 = GUICtrlCreateLabel("Button12", 150, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_13 = GUICtrlCreateLabel("Button13", 200, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_14 = GUICtrlCreateLabel("Button14", 250, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_15 = GUICtrlCreateLabel("Button15", 300, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_16 = GUICtrlCreateLabel("Button16", 350, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_17 = GUICtrlCreateLabel("Button17", 400, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_18 = GUICtrlCreateLabel("Button18", 450, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_19 = GUICtrlCreateLabel("Button19", 500, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_20 = GUICtrlCreateLabel("Button20", 550, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_21 = GUICtrlCreateLabel("Button21", 600, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_22 = GUICtrlCreateLabel("Button22", 650, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_23 = GUICtrlCreateLabel("Button23", 700, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)
$Button_24 = GUICtrlCreateLabel("Button24", 750, 50, 50, 270, $SS_WHITERECT + $SS_SUNKEN + $BS_BOTTOM)

;Upper buttons
$utton_1 = GUICtrlCreateLabel("Button26", 130, 50, 40, 170, $SS_SUNKEN  + $SS_CENTER , $WS_EX_TOPMOST )
GUICtrlSetbkColor(-1,"")
$utton_2 = GUICtrlCreateLabel("Button27", 180, 50, 40, 170, $SS_SUNKEN  + $SS_CENTER , $WS_EX_TOPMOST )
GUICtrlSetbkColor(-1,"")
$utton_3 = GUICtrlCreateLabel("Button28", 230, 50, 40, 170, $SS_SUNKEN  + $SS_CENTER , $WS_EX_TOPMOST )
GUICtrlSetbkColor(-1,"")
$utton_4 = GUICtrlCreateLabel("Button29", 330, 50, 40, 170, $SS_SUNKEN  + $SS_CENTER , $WS_EX_TOPMOST )
GUICtrlSetbkColor(-1,"")
$utton_5 = GUICtrlCreateLabel("Button30", 380, 50, 40, 170, $SS_SUNKEN  + $SS_CENTER , $WS_EX_TOPMOST )
GUICtrlSetbkColor(-1,"")
$utton_6 = GUICtrlCreateLabel("Button31", 480, 50, 40, 170, $SS_SUNKEN  + $SS_CENTER , $WS_EX_TOPMOST )
GUICtrlSetbkColor(-1,"")
$utton_7 = GUICtrlCreateLabel("Button32", 530, 50, 40, 170, $SS_SUNKEN  + $SS_CENTER , $WS_EX_TOPMOST )
GUICtrlSetbkColor(-1,"")
$utton_8 = GUICtrlCreateLabel("Button33", 580, 50, 40, 170, $SS_SUNKEN  + $SS_CENTER , $WS_EX_TOPMOST )
GUICtrlSetbkColor(-1,"")
$utton_9 = GUICtrlCreateLabel("Button34", 680, 50, 40, 170, $SS_SUNKEN  + $SS_CENTER , $WS_EX_TOPMOST )
GUICtrlSetbkColor(-1,"")
$utton_10 = GUICtrlCreateLabel("Button35", 730, 50, 40, 170, $SS_SUNKEN  + $SS_CENTER , $WS_EX_TOPMOST )
GUICtrlSetbkColor(-1,"")

$Button_L3 = GuiCtrlCreateButton("Main Menu", 10, 150, 70, 20)
$Button_A3 = GuiCtrlCreateButton("Close Menu", 810, 150, 70, 20)
$Button_A4 = GuiCtrlCreateButton("Share Menu", 810, 190, 70, 20)
$Button_A5 = GuiCtrlCreateButton("QT Appraisal", 810, 230, 70, 20)
$Button_QT = GUICtrlCreateButton("", 825, 265, 35, 35, $BS_ICON)
GUICtrlSetImage(-1, $Logo_icon)
GUICtrlSetTip(-1, "Check New Releases")

GuiSetState()
GUISetBkColor ("")

While 1
    $msg = GuiGetMsg()
    $P_timer= GUICtrlRead($NotePlay)
    If $P_timer <> $P_T Then
        $P_T=$P_timer
        If $P_T="Short" Then $P_T_1 = "200"
        If $P_T="Medium" Then $P_T_1 = "400"
        If $P_T="Long" Then $P_T_1 = "600"          
    EndIf
    If $msg = $GUI_EVENT_CLOSE Or $msg= $Button_A3 Then ExitLoop
    If BitAND(GUICtrlRead($Radio_L1), $GUI_CHECKED) = $GUI_CHECKED Then
        Call("Set_music")
    EndIf
    If $msg = $Button_L3 Then
        Call("Set_Menu")
    EndIf
    If $msg = $Button_A4 Then
        Call("Set_Menu")
    EndIf
    If $msg = $Button_A5 Then
        Call("Set_QT")
    EndIf
    If $msg = $Button_QT Then
        Call("Set_Update")
    EndIf   
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

;------------------------Functions -------------------
Func Set_Music()
    
    While 2
    $P_timer= GUICtrlRead($NotePlay)
    If $P_timer <> $P_T Then
        $P_T=$P_timer
        If $P_T="Short" Then $P_T_1 = "200"
        If $P_T="Medium" Then $P_T_1 = "400"
        If $P_T="Long" Then $P_T_1 = "600"          
    EndIf
        $M_ans = GuiGetMsg()
        Select
            Case $M_ans = $GUI_EVENT_CLOSE Or $M_ans= $Button_A3
           ;GUICtrlSetState($radio_L1, $GUI_UNCHECKED)
           ;GUICtrlSetState($radio_L2, $GUI_CHECKED)
                Exit
            Case $M_ans = $Button_A5
                Call("Set_QT")
            Case $M_ans = $Button_QT
                Call("Set_Update")
            Case $M_ans = $Button_L3 or $M_ans = $Button_A4
                Call("Set_Menu")
            Case $M_ans = $Button_P
                Call("Play_Joy")
            Case $M_ans = $Button_11
                Beep(100, $P_T_1)
            Case $M_ans = $Button_12
                Beep(200, $P_T_1)
            Case $M_ans = $Button_13
                Beep(300, $P_T_1)
            Case $M_ans = $Button_14
                Beep(400, $P_T_1)
            Case $M_ans = $Button_15
                Beep(500, $P_T_1)
            Case $M_ans = $Button_16
                Beep(600, $P_T_1)
            Case $M_ans = $Button_17
                Beep(700, $P_T_1)
            Case $M_ans = $Button_18
                Beep(800, $P_T_1)
            Case $M_ans = $Button_19
                Beep(900, $P_T_1)
            Case $M_ans = $Button_20
                Beep(1000, $P_T_1)
            Case $M_ans = $Button_21
                Beep(1100, $P_T_1)
            Case $M_ans = $Button_22
                Beep(1200, $P_T_1)
            Case $M_ans = $Button_23
                Beep(1300, $P_T_1)
            Case $M_ans = $Button_24
                Beep(1400, $P_T_1)
            Case $M_ans = $Button_1
                Beep(150, $P_T_1)
            Case $M_ans = $Button_2
                Beep(250, $P_T_1)
            Case $M_ans = $Button_3
                Beep(350, $P_T_1)
            Case $M_ans = $Button_4
                Beep(550, $P_T_1)
            Case $M_ans = $Button_5
                Beep(650, $P_T_1)
            Case $M_ans = $Button_6
                Beep(850, $P_T_1)
            Case $M_ans = $Button_7
                Beep(950, $P_T_1)
            Case $M_ans = $Button_8
                Beep(1050, $P_T_1)
            Case $M_ans = $Button_9
                Beep(1250, $P_T_1)
            Case $M_ans = $Button_10
                Beep(1350, $P_T_1)
        EndSelect
    WEnd
EndFunc
    
Func Set_Menu()
    MsgBox(0,"Sorry","This is a Test Only Program ")
    Sleep(500)
EndFunc

Func Play_Joy()
; PLease use this format inside a Func for your Music to be included (or improve-it) , Thanks
    Beep(1200, 700)
    Beep(1100, 400) 
    Beep(1000, 300) 
    Beep(900, 700)
    Sleep(50)
    Beep(800, 400)  
    Beep(700, 700)  
    Beep(600, 600)  
    Beep(500, 700)
    Sleep(100)
    Beep(600, 600)  
    Beep(700, 600)
    Sleep(80)
    Beep(800, 400)  
    Beep(900, 700)
    Sleep(80)
    Beep(1000, 400) 
    Beep(1130, 800)
EndFunc

; ----------------- Below included in *XPClean Menu* -------------------------------

Func Set_QT()
    MsgBox(32, "Thanks" ,  " ...Valuater   8)       " & "" & @CRLF & "" & @CRLF & "", 60)
EndFunc

Func Set_Update()
    Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe " & $QT_web)
    Sleep(2000)
EndFunc

Update May 2008 Autoit Ver 3.2.12.0

ok.... there is a song i wrote thats not the greatest.... but maybe you can do it better

...Enjoy!

Valuater

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

  • 1 year later...

Relly great.

Only the differences between the frequencies are wrong (compared to a real piano). But that would be only a small change, everthing else: good job :P

"It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output

Link to comment
Share on other sites

Relly great.

Only the differences between the frequencies are wrong (compared to a real piano). But that would be only a small change, everthing else: good job :P

Look at the piano keyboard frequencies in my beep songs thread for right frequencies
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...