The Real Wine Posted March 22, 2005 Share Posted March 22, 2005 3 octaves from DO to SI (normally lol) classical GUI byebye expandcollapse popup; Script generated by AutoBuilder 0.5 Prototype #include <GuiConstants.au3> If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 GuiCreate("Piano 3 gammes v1.0", 840, 200,(@DesktopWidth-800)/2, (@DesktopHeight-200)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) ;Mode "Coordonnés Absolus" AutoItSetOption("GUICoordMode",1) ;Mode "Evenements" activé AutoItSetOption("GuiOnEventMode",1) ;Affichage de la GUI GUISetState() Global $duration = 250 $Button_1 = GuiCtrlCreateButton("DO", 0, 50, 40, 150) $Button_2 = GuiCtrlCreateButton("RE", 40, 50, 40, 150) $Button_3 = GuiCtrlCreateButton("MI", 80, 50, 40, 150) $Button_4 = GuiCtrlCreateButton("FA", 120, 50, 40, 150) $Button_5 = GuiCtrlCreateButton("SOL", 160, 50, 40, 150) $Button_6 = GuiCtrlCreateButton("LA", 200, 50, 40, 150) $Button_7 = GuiCtrlCreateButton("SI", 240, 50, 40, 150) $Button_8 = GuiCtrlCreateButton("DO", 280, 50, 40, 150) $Button_9 = GuiCtrlCreateButton("RE", 320, 50, 40, 150) $Button_10 = GuiCtrlCreateButton("MI", 360, 50, 40, 150) $Button_11 = GuiCtrlCreateButton("FA", 400, 50, 40, 150) $Button_12 = GuiCtrlCreateButton("SOL", 440, 50, 40, 150) $Button_13 = GuiCtrlCreateButton("LA", 480, 50, 40, 150) $Button_14 = GuiCtrlCreateButton("SI", 520, 50, 40, 150) $Button_15 = GuiCtrlCreateButton("DO", 560, 50, 40, 150) $Button_16 = GuiCtrlCreateButton("RE", 600, 50, 40, 150) $Button_17 = GuiCtrlCreateButton("MI", 640, 50, 40, 150) $Button_18 = GuiCtrlCreateButton("FA", 680, 50, 40, 150) $Button_19 = GuiCtrlCreateButton("SOL", 720, 50, 40, 150) $Button_20 = GuiCtrlCreateButton("LA", 760, 50, 40, 150) $Button_21 = GuiCtrlCreateButton("SI", 800, 50, 40, 150) GUISetOnEvent($GUI_EVENT_CLOSE,"fonction_exit") GUICtrlSetOnEvent($Button_1,"note_do") GUICtrlSetOnEvent($Button_2,"note_re") GUICtrlSetOnEvent($Button_3,"note_mi") GUICtrlSetOnEvent($Button_4,"note_fa") GUICtrlSetOnEvent($Button_5,"note_sol") GUICtrlSetOnEvent($Button_6,"note_la") GUICtrlSetOnEvent($Button_7,"note_si") GUICtrlSetOnEvent($Button_8,"note_do2") GUICtrlSetOnEvent($Button_9,"note_re2") GUICtrlSetOnEvent($Button_10,"note_mi2") GUICtrlSetOnEvent($Button_11,"note_fa2") GUICtrlSetOnEvent($Button_12,"note_sol2") GUICtrlSetOnEvent($Button_13,"note_la2") GUICtrlSetOnEvent($Button_14,"note_si2") GUICtrlSetOnEvent($Button_15,"note_do3") GUICtrlSetOnEvent($Button_16,"note_re3") GUICtrlSetOnEvent($Button_17,"note_mi3") GUICtrlSetOnEvent($Button_18,"note_fa3") GUICtrlSetOnEvent($Button_19,"note_sol3") GUICtrlSetOnEvent($Button_20,"note_la3") GUICtrlSetOnEvent($Button_21,"note_si3") GuiSetState() While 1 sleep(20) WEnd Exit Func note_do() DllCall ("kernel32.dll", "long", "Beep", "long", 130.81, "long", $duration) EndFunc Func note_re() DllCall ("kernel32.dll", "long", "Beep", "long", 146.83, "long", $duration) EndFunc Func note_mi() DllCall ("kernel32.dll", "long", "Beep", "long", 164.81, "long", $duration) EndFunc Func note_fa() DllCall ("kernel32.dll", "long", "Beep", "long", 174.61, "long", $duration) EndFunc Func note_sol() DllCall ("kernel32.dll", "long", "Beep", "long", 196, "long", $duration) EndFunc Func note_la() DllCall ("kernel32.dll", "long", "Beep", "long", 220, "long", $duration) EndFunc Func note_si() DllCall ("kernel32.dll", "long", "Beep", "long", 246.94, "long", $duration) EndFunc Func note_do2() DllCall ("kernel32.dll", "long", "Beep", "long", 261.63, "long", $duration) EndFunc Func note_re2() DllCall ("kernel32.dll", "long", "Beep", "long", 293.66, "long", $duration) EndFunc Func note_mi2() DllCall ("kernel32.dll", "long", "Beep", "long", 329.63, "long", $duration) EndFunc Func note_fa2() DllCall ("kernel32.dll", "long", "Beep", "long", 349.22, "long", $duration) EndFunc Func note_sol2() DllCall ("kernel32.dll", "long", "Beep", "long", 392, "long", $duration) EndFunc Func note_la2() DllCall ("kernel32.dll", "long", "Beep", "long", 440, "long", $duration) EndFunc Func note_si2() DllCall ("kernel32.dll", "long", "Beep", "long", 493.98, "long", $duration) EndFunc Func note_do3() DllCall ("kernel32.dll", "long", "Beep", "long", 523.25, "long", $duration) EndFunc Func note_re3() DllCall ("kernel32.dll", "long", "Beep", "long", 587.33, "long", $duration) EndFunc Func note_mi3() DllCall ("kernel32.dll", "long", "Beep", "long", 659.26, "long", $duration) EndFunc Func note_fa3() DllCall ("kernel32.dll", "long", "Beep", "long", 698.46, "long", $duration) EndFunc Func note_sol3() DllCall ("kernel32.dll", "long", "Beep", "long", 783.99, "long", $duration) EndFunc Func note_la3() DllCall ("kernel32.dll", "long", "Beep", "long", 880, "long", $duration) EndFunc Func note_si3() DllCall ("kernel32.dll", "long", "Beep", "long", 987.77, "long", $duration) EndFunc Func fonction_exit() Exit EndFunc Link to comment Share on other sites More sharing options...
steveR Posted March 22, 2005 Share Posted March 22, 2005 LOL You could just made one DllCall() function and passed the frequency and duration as arguements. Would of made your code a little shorter. AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. Link to comment Share on other sites More sharing options...
The Real Wine Posted March 22, 2005 Author Share Posted March 22, 2005 I didn't find how to do with an argument, if you can explain me, it's welcome Link to comment Share on other sites More sharing options...
steveR Posted March 22, 2005 Share Posted March 22, 2005 (edited) Here is one way: #include <guiconstants.au3> guiCreate( "Piano", 840, 200 ) dim $btnKey[22] $note = "DO,RE,MI,FA,SOL,LA,TI" $note = $note & "," & $note $note = $note & "," & $note $note = stringSplit( $note, "," ) $pitch = "48,50,52,53,55,57,59,60,62,64,65,67,69,71,72,74,76,77,79,81,83" $pitch = stringSplit($pitch, ",") $xPos = 0 for $i = 1 to 21 $btnKey[$i]= GuiCtrlCreateButton( $note[$i], $xPos, 50, 40, 150) $xPos = $xPos + 40 next guiSetState() do $msg = guiGetMsg() for $i = 1 to 21 select case $msg = $btnKey[$i] _playNote($pitch[$i]) endSelect next until $msg = $GUI_EVENT_CLOSE func _playNote($p) $freq = 6.875 * (2 ^ (($p + 3) / 12)) DllCall ("kernel32.dll", "long", "Beep", "long", $freq, "long", 250) endFunc Edited March 22, 2005 by steveR AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. Link to comment Share on other sites More sharing options...
CyberSlug Posted March 22, 2005 Share Posted March 22, 2005 Might be relevant:http://www.autoitscript.com/forum/index.php?showtopic=8187 Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
buzz44 Posted March 23, 2005 Share Posted March 23, 2005 very nice, i made the mistake of running the script while i was in class and got in trouble lol, but i explained that it was relevant to my Software Design and Development and got off qq 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