Sign in to follow this  
Followers 0
corey822

help with beep song compiler program

11 posts in this topic

hi all

most of u might have seen paulies beep script if not u should check it out but i am trying to help people who cant be bothered doing things like that so instead i have a gui that u put the song code into the input box and click run button that then uses paulies code and the song code u just put in there ill show u the gui i have

CODE
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.9.14 (beta)

Author: myName

Script Function:

Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 351, 306, 279, 155)

$insert = GUICtrlCreateEdit("", 16, 64, 185, 225)

GUICtrlSetData(-1, "insert")

$Button1 = GUICtrlCreateButton("run", 232, 144, 89, 41, 0)

$Label1 = GUICtrlCreateLabel("beep me", 136, 8, 100, 33)

GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button1

EndSwitch

WEnd

and once the code is put into the input box it runs that code and the following code at the same time to create the song and walah the songs playing to ur ears.

CODE
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.9.14 (beta)

Author: paulie

Script Function:

beepsong

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

Global $list[100]

$list = StringSplit("4186.01|3951.07|"& _

"3729.31|3520.00|3322.44|"& _

"3135.96|2959.96|2793.83|"& _

"2637.02|2489.02|2349.32|"& _

"2217.46|2093.00|1975.53|"& _

"1864.66|1760.00|1661.22|"& _

"1567.98|1479.98|1396.91|"& _

"1318.51|1244.51|1174.66|"& _

"1108.73|1046.50|987.767|"& _

"932.328|880.000|830.609|"& _

"783.991|739.989|698.456|"& _

"659.255|622.254|587.330|"& _

"554.365|523.251|493.883|"& _

"466.164|440.000|415.305|"& _

"391.995|369.994|349.228|"& _

"329.628|311.127|293.665|"& _

"277.183|261.626|246.942|"& _

"233.082|220.000|207.652|"& _

"195.998|184.997|174.614|"& _

"164.814|155.563|146.832|"& _

"138.591|130.813|123.471|"& _

"116.541|110.000|103.826|"& _

"97.9989|92.4986|87.3071|"& _

"82.4069|77.7817|73.4162|"& _

"69.2957|65.4064|61.7354|"& _

"58.2705|55.0000|51.9130|"& _

"48.9995|46.2493|43.6536|"& _

"41.2035|38.8909|36.7081|"& _

"34.6479|32.7032|30.8677|"& _

"29.1353|27.5000|", "|")

Func _R($dura)

Sleep($dura)

EndFunc

Func _88($dura)

Beep($list[1], $dura)

EndFunc

Func _87($dura)

Beep($list[2],$dura)

EndFunc

Func _86($dura)

Beep($list[3],$dura)

EndFunc

Func _85($dura)

Beep($list[4],$dura)

EndFunc

Func _84($dura)

Beep($list[5],$dura)

EndFunc

Func _83($dura)

Beep($list[6],$dura)

EndFunc

Func _82($dura)

Beep($list[7],$dura)

EndFunc

Func _81($dura)

Beep($list[8],$dura)

EndFunc

Func _80($dura)

Beep($list[9],$dura)

EndFunc

Func _79($dura)

Beep($list[10],$dura)

EndFunc

Func _78($dura)

Beep($list[11],$dura)

EndFunc

Func _77($dura)

Beep($list[12],$dura)

EndFunc

Func _76($dura)

Beep($list[13],$dura)

EndFunc

Func _75($dura)

Beep($list[14],$dura)

EndFunc

Func _74($dura)

Beep($list[15],$dura)

EndFunc

Func _73($dura)

Beep($list[16],$dura)

EndFunc

Func _72($dura)

Beep($list[17],$dura)

EndFunc

Func _71($dura)

Beep($list[18],$dura)

EndFunc

Func _70($dura)

Beep($list[19],$dura)

EndFunc

Func _69($dura)

Beep($list[20],$dura)

EndFunc

Func _68($dura)

Beep($list[21],$dura)

EndFunc

Func _67($dura)

Beep($list[22],$dura)

EndFunc

Func _66($dura)

Beep($list[23],$dura)

EndFunc

Func _65($dura)

Beep($list[24],$dura)

EndFunc

Func _64($dura)

Beep($list[25],$dura)

EndFunc

Func _63($dura)

Beep($list[26],$dura)

EndFunc

Func _62($dura)

Beep($list[27],$dura)

EndFunc

Func _61($dura)

Beep($list[28],$dura)

EndFunc

Func _60($dura)

Beep($list[29],$dura)

EndFunc

Func _59($dura)

Beep($list[30],$dura)

EndFunc

Func _58($dura)

Beep($list[31],$dura)

EndFunc

Func _57($dura)

Beep($list[32],$dura)

EndFunc

Func _56($dura)

Beep($list[33],$dura)

EndFunc

Func _55($dura)

Beep($list[34],$dura)

EndFunc

Func _54($dura)

Beep($list[35],$dura)

EndFunc

Func _53($dura)

Beep($list[36],$dura)

EndFunc

Func _52($dura)

Beep($list[37],$dura)

EndFunc

Func _51($dura)

Beep($list[38],$dura)

EndFunc

Func _50($dura)

Beep($list[39],$dura)

EndFunc

Func _49($dura)

Beep($list[40],$dura)

EndFunc

Func _48($dura)

Beep($list[41],$dura)

EndFunc

Func _47($dura)

Beep($list[42],$dura)

EndFunc

Func _46($dura)

Beep($list[43],$dura)

EndFunc

Func _45($dura)

Beep($list[44],$dura)

EndFunc

Func _44($dura)

Beep($list[45],$dura)

EndFunc

Func _43($dura)

Beep($list[46],$dura)

EndFunc

Func _42($dura)

Beep($list[47],$dura)

EndFunc

Func _41($dura)

Beep($list[48],$dura)

EndFunc

Func _40($dura)

Beep($list[49],$dura)

EndFunc

Func _39($dura)

Beep($list[50],$dura)

EndFunc

Func _38($dura)

Beep($list[51],$dura)

EndFunc

Func _37($dura)

Beep($list[52],$dura)

EndFunc

Func _36($dura)

Beep($list[53],$dura)

EndFunc

Func _35($dura)

Beep($list[54],$dura)

EndFunc

Func _34($dura)

Beep($list[55],$dura)

EndFunc

Func _33($dura)

Beep($list[56],$dura)

EndFunc

Func _32($dura)

Beep($list[57],$dura)

EndFunc

Func _31($dura)

Beep($list[58],$dura)

EndFunc

Func _30($dura)

Beep($list[59],$dura)

EndFunc

Func _29($dura)

Beep($list[60],$dura)

EndFunc

Func _28($dura)

Beep($list[61],$dura)

EndFunc

Func _27($dura)

Beep($list[62],$dura)

EndFunc

Func _26($dura)

Beep($list[63],$dura)

EndFunc

Func _25($dura)

Beep($list[64],$dura)

EndFunc

Func _24($dura)

Beep($list[65],$dura)

EndFunc

Func _23($dura)

Beep($list[66],$dura)

EndFunc

Func _22($dura)

Beep($list[67],$dura)

EndFunc

Func _21($dura)

Beep($list[68],$dura)

EndFunc

Func _20($dura)

Beep($list[69],$dura)

EndFunc

Func _19($dura)

Beep($list[70],$dura)

EndFunc

Func _18($dura)

Beep($list[71],$dura)

EndFunc

Func _17($dura)

Beep($list[72],$dura)

EndFunc

Func _16($dura)

Beep($list[73],$dura)

EndFunc

Func _15($dura)

Beep($list[74],$dura)

EndFunc

Func _14($dura)

Beep($list[75],$dura)

EndFunc

Func _13($dura)

Beep($list[76],$dura)

EndFunc

Func _12($dura)

Beep($list[77],$dura)

EndFunc

Func _11($dura)

Beep($list[78],$dura)

EndFunc

Func _10($dura)

Beep($list[79],$dura)

EndFunc

Func _9($dura)

Beep($list[80],$dura)

EndFunc

Func _8($dura)

Beep($list[81],$dura)

EndFunc

Func _7($dura)

Beep($list[82],$dura)

EndFunc

Func _6($dura)

Beep($list[83],$dura)

EndFunc

Func _5($dura)

Beep($list[84],$dura)

EndFunc

Func _4($dura)

Beep($list[85],$dura)

EndFunc

Func _3($dura)

Beep($list[86],$dura)

EndFunc

Func _2($dura)

Beep($list[87],$dura)

EndFunc

Func _1($dura)

Beep($list[88],$dura)

EndFunc

EndSwitch

WEnd

cheers C.W


C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake

Share this post


Link to post
Share on other sites



:)

Share this post


Link to post
Share on other sites

:)

got me buggerd too

is it possible at all?

cheers C.W


C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake

Share this post


Link to post
Share on other sites

bumpety bump


C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake

Share this post


Link to post
Share on other sites

A bump is usually 24 hours after the last post.

Share this post


Link to post
Share on other sites

A bump is usually 24 hours after the last post.

ohhh sorry its jsut i have a habbit of needing wat i want now XD sorry and no one told me this earlier

cheers C.W


C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hey, I just figured I would take this idea and expand upon it a bit.

I put this together today, My good friend Bert got me through the crazy _GuiListView_*** Functions

Fully Functional!

Enjoy:

#include <GUIConstants.au3>
#include <Array.au3>
#Include <GuiListView.au3>
Opt('GuiOnEventMode',1)
Dim $KeySigSharps[8][2] = _
[["C","A"],["G","E"],["D","B"],["A","F#"],["E","C#"],["B","G#"],["F#","D#"],["C#","A#"]]
Dim $KeySigFlats[8][2] = _
[["C","A"],["F","D"],["B","G"],["Eb","C"],["Ab","F"],["Db","Bb"],["Gb","Eb"],["Cb","Ab"]]

Dim $Pitches = StringSplit( _
"4186.01|3951.07|"& _
"3729.31|3520.00|3322.44|"& _
"3135.96|2959.96|2793.83|"& _
"2637.02|2489.02|2349.32|"& _
"2217.46|2093.00|1975.53|"& _
"1864.66|1760.00|1661.22|"& _
"1567.98|1479.98|1396.91|"& _
"1318.51|1244.51|1174.66|"& _
"1108.73|1046.50|987.767|"& _
"932.328|880.000|830.609|"& _
"783.991|739.989|698.456|"& _
"659.255|622.254|587.330|"& _
"554.365|523.251|493.883|"& _
"466.164|440.000|415.305|"& _
"391.995|369.994|349.228|"& _
"329.628|311.127|293.665|"& _
"277.183|261.626|246.942|"& _
"233.082|220.000|207.652|"& _
"195.998|184.997|174.614|"& _
"164.814|155.563|146.832|"& _
"138.591|130.813|123.471|"& _
"116.541|110.000|103.826|"& _
"97.9989|92.4986|87.3071|"& _
"82.4069|77.7817|73.4162|"& _
"69.2957|65.4064|61.7354|"& _
"58.2705|55.0000|51.9130|"& _
"48.9995|46.2493|43.6536|"& _
"41.2035|38.8909|36.7081|"& _
"34.6479|32.7032|30.8677|"& _
"29.1353|27.5000|", "|")

Dim $NoteOctavePitch[89][3]
For $i = 1 to 88
    For $x = 0 to 2
        Switch $x
            Case 0;Note Name
                For $y = 0 to 8
                    If $i = 1+(12*$y) then $NoteOctavePitch[$i][$x] = "A"
                    If $i = 2+(12*$y) then $NoteOctavePitch[$i][$x] = "A#"
                    If $i = 3+(12*$y) then $NoteOctavePitch[$i][$x] = "B"
                    If $i = 4+(12*$y) then $NoteOctavePitch[$i][$x] = "C"
                    If $i = 5+(12*$y) then $NoteOctavePitch[$i][$x] = "C#"
                    If $i = 6+(12*$y) then $NoteOctavePitch[$i][$x] = "D"
                    If $i = 7+(12*$y) then $NoteOctavePitch[$i][$x] = "D#"
                    If $i = 8+(12*$y) then $NoteOctavePitch[$i][$x] = "E"
                    If $i = 9+(12*$y) then $NoteOctavePitch[$i][$x] = "F"
                    If $i = 10+(12*$y) then $NoteOctavePitch[$i][$x] = "F#"
                    If $i = 11+(12*$y) then $NoteOctavePitch[$i][$x] = "G"
                    If $i = 12+(12*$y) then $NoteOctavePitch[$i][$x] = "G#"
                Next
            Case 1;Octave
                If $i <=12 then $NoteOctavePitch[$i][$x]= 1
                If $i >12 And $i<=24 then $NoteOctavePitch[$i][$x]= 2
                If $i >24 And $i<=36 then $NoteOctavePitch[$i][$x]= 3
                If $i >36 And $i<=48 then $NoteOctavePitch[$i][$x]= 4
                If $i >48 And $i<=60 then $NoteOctavePitch[$i][$x]= 5
                If $i >60 And $i<=72 then $NoteOctavePitch[$i][$x]= 6
                If $i >72 And $i<=84 then $NoteOctavePitch[$i][$x]= 7
                If $i >84 And $i<=88 then $NoteOctavePitch[$i][$x]= 8
            Case 2;Frequency
                $NoteOctavePitch[$i][$x] = $Pitches[89-$i]
        EndSwitch
    Next
Next

$GUI = GUICreate("Beep Song Creator", 608, 447, 218, 115)
GUISetOnEvent($GUI_EVENT_CLOSE,"Quit",$GUI) 
$Group1 = GUICtrlCreateGroup("General Information", 192, 8, 217, 81)
    $Title = GUICtrlCreateInput("", 256, 24, 113, 21)
    GUICtrlCreateLabel("Title:", 200, 24, 27, 17)
    GUICtrlCreateLabel("Composer:", 200, 56, 54, 17)
    $Composer = GUICtrlCreateInput("", 256, 56, 113, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Pitch Properties", 192, 104, 217, 125)
    $Pitch = GUICtrlCreateCombo("", 232, 124, 89, 25)
    GUICtrlSetData(-1, "A|A#|B|C|C#|D|D#|E|F|F#|G|G#", "A")
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    GUICtrlSetOnEvent(-1, "UpdatePitch")
    $Octave = GUICtrlCreateInput("1", 368, 123, 35, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY,$ES_NUMBER))
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    $UpDwn=GUICtrlCreateUpdown($Octave)
    GUICtrlSetOnEvent(-1, "UpdatePitch")
    GUICtrlSetLimit(-1,8,1)
    $KeyNum = GUICtrlCreateInput("1", 272, 184, 89, 21,$ES_NUMBER)
    GUICtrlSetOnEvent(-1, "UpdatePitch")
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    $UpDwn2=GUICtrlCreateUpdown($KeyNum)
    GUICtrlSetOnEvent(-1, "UpdatePitch")
    GUICtrlSetLimit(-1,88,1)
    GUICtrlCreateLabel("Octave:", 324, 126, 42, 17)
    GUICtrlCreateLabel("Pitch:", 200, 126, 31, 17)
    GUICtrlCreateLabel("Key Number:", 201, 186, 65, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group5 = GUICtrlCreateGroup("Duration Properties", 192, 235, 217, 200)
    $CNoteRadio = GUICtrlCreateRadio("Custom Duration", 200, 254, 121, 25)
        GUICtrlSetOnEvent(-1, "DurationDepends")
        GUICtrlSetState(-1,$GUI_CHECKED)
        $CNoteDur = GUICtrlCreateInput("250", 248, 280, 73, 21, $ES_NUMBER)
    $BNoteRadio = GUICtrlCreateRadio("Base Duration", 200, 304, 121, 25)
        GUICtrlSetOnEvent(-1, "DurationDepends")
        $BNoteDur = GUICtrlCreateInput("250", 248, 334, 81, 21, $ES_NUMBER)
        $NoteType = GUICtrlCreateCombo("Quarter", 248, 366, 129, 25)
        GUICtrlSetData(-1, "Sixteenth|Dotted Sixteenth|Eighth|Dotted Eighth|Dotted Quarter|Half|Dotted Half|Whole|Dotted Whole")
    $AddNote = GUICtrlCreateButton("Add Note", 208, 396, 65, 25, 0)
    GUICtrlSetOnEvent(-1, "AddNote")
    $PrevNote = GUICtrlCreateButton("Preview", 288, 396, 65, 25, 0)
    GUICtrlSetOnEvent(-1, "PreviewNote")
    GUICtrlCreateLabel("ms", 328, 282, 17, 17)
    GUICtrlCreateLabel("ms", 338, 335, 17, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Key Signature", 16, 8, 161, 121)
    $KeySigNum = GUICtrlCreateInput("0", 32, 280-248, 49, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    $UpDwn3=GUICtrlCreateUpdown($KeySigNum)
    GUICtrlSetOnEvent(-1, "UpdateKeySig")
    GUICtrlSetLimit(-1,7,0)
    $KeySigType = GUICtrlCreateCombo("Sharps", 88, 280-248, 65, 25)
    GUICtrlSetData(-1, "Flats")
    GUICtrlSetOnEvent(-1, "UpdateKeySig")
    $MajorDisp = GUICtrlCreateInput("", 48, 312-248, 97, 21,$ES_READONLY)
    $MinorDisp = GUICtrlCreateInput("", 48, 344-248, 97, 21,$ES_READONLY)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("Rest Properties", 16, 240-100, 161, 193)
    $AddRest = GUICtrlCreateButton("Add Rest", 472-408, 400-100, 57, 25, 0)
    GUICtrlSetOnEvent(-1, "AddRest")
    $CRestRadio = GUICtrlCreateRadio("Custom Duration", 434-408, 261-100, 121, 25)
        GUICtrlSetOnEvent(-1, "RestDepends")
        GUICtrlSetState(-1,$GUI_CHECKED)
        $CRestDur = GUICtrlCreateInput("250", 447-408, 287-100, 73, 21, $ES_NUMBER)
    $BRestRadio = GUICtrlCreateRadio("Base Duration", 435-408, 316-100, 121, 17)
        GUICtrlSetOnEvent(-1, "RestDepends")    
        $BRestDur = GUICtrlCreateInput("250", 442-408, 340-100, 81, 21, $ES_NUMBER)
        $RestType = GUICtrlCreateCombo("Quarter", 442-408, 374-100, 129, 25)
        GUICtrlSetData(-1, "Sixteenth|Dotted Sixteenth|Eighth|Dotted Eighth |Dotted Quarter|Half|Dotted Half|Whole|Dotted Whole")
    GUICtrlCreateLabel("ms", 528-408, 288-100, 17, 17)
    GUICtrlCreateLabel("ms", 528-408, 343-100, 17, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $SongView = GUICtrlCreateListView("Key|Note|Duration", 424, 16, 161, 300)
$Insert = GUICtrlCreateButton("Insert", 432, 365, 65, 25, 0)
GUICtrlSetOnEvent(-1, "InsertNote")
$Modify = GUICtrlCreateButton("Modify", 512, 365, 65, 25, 0)
GUICtrlSetOnEvent(-1, "ModifyNote")
$Clear = GUICtrlCreateButton("Clear", 432, 400, 65, 25, 0)
GUICtrlSetOnEvent(-1, "ClearList")
$Delete = GUICtrlCreateButton("Delete", 512, 400, 65, 25, 0)
GUICtrlSetOnEvent(-1, "Delete")
$Preview = GUICtrlCreateButton("Preview", 20, 400, 65, 25, 0)
GUICtrlSetOnEvent(-1, "PreviewSong")
$Create = GUICtrlCreateButton("Create", 100, 400, 65, 25, 0)
GUICtrlSetOnEvent(-1, "CreateSong")
GUISetState(@SW_SHOW)
RestDepends()
DurationDepends()
UpdateKeySig()
While 1
    Sleep(100)
WEnd

Func ModifyNote()
    $hwnd = GUICtrlGetHandle ($SongView)
    $index= _GUICtrlListView_GetSelectedIndices($hwnd)
    $Array= _GUICtrlListView_GetItemTextArray($hwnd, $index)
    If $index = ""  Or $Array[1]="R" then 
        MsgBox(0,"Error", "Please select a note to modify.")
        Return
    Else
        $NewNote = StringUpper(InputBox("Edit", "Input Key Number or Note(with octive)"&@CRLF&'ex. "40" or "C4" or "C#4"', $Array[1]))
        If StringRegExp($NewNote, "[ABCDEFG](#)?(\d){1}") Then
            $Name = $NewNote
            For $a = 1 to 88
                If $Name=$NoteOctavePitch[$a][0]&$NoteOctavePitch[$a][1]  Then $Num=$a
            Next
        ElseIf StringRegExp($NewNote, "(\d){1,2}") And $NewNote<88 Then
            $Num = $NewNote
            $Name = $NoteOctavePitch[$num][0]
        Else
            MsgBox(0,"Error", "Unrecognized note. Try again.")
            ModifyNote()
        EndIf
        Do
            $Duration = InputBox("Edit","Input duration of the note.", $Array[3])
            $Duration = Number($Duration)
        Until IsNumber($Duration)
        _GUICtrlListView_SetItemText($hwnd, $index, $Num)
        _GUICtrlListView_SetItemText($hwnd, $index, $Name,1)
        _GUICtrlListView_SetItemText($hwnd, $index, $Duration,2)
    EndIf
EndFunc

Func InsertNote()
        $hwnd = GUICtrlGetHandle ($SongView)
    $index= _GUICtrlListView_GetSelectedIndices($hwnd) +1
    If $index = "" then 
        MsgBox(0,"Error", "Please select a note to modify.")
        Return
    Else
        $NewNote = StringUpper(InputBox("Edit", "Input Key Number or Note(with octive)"&@CRLF&'ex. "40" or "C4" or "C#4"'))
        If StringRegExp($NewNote, "[ABCDEFG](#)?(\d){1}") Then
            $Name = $NewNote
            For $a = 1 to 88
                If $Name=$NoteOctavePitch[$a][0]&$NoteOctavePitch[$a][1]  Then $Num=$a
            Next
        ElseIf StringRegExp($NewNote, "(\d){1,2}") And $NewNote<88 Then
            $Num = $NewNote
            $Name = $NoteOctavePitch[$num][0]
        Else
            MsgBox(0,"Error", "Unrecognized note. Try again.")
            InsertNote()
        EndIf
        Do
            $Duration = InputBox("Edit","Input duration of the note.")
            $Duration = Number($Duration)
        Until IsNumber($Duration)
        _GUICtrlListView_InsertItem($hWnd, $Num,$index)
        _GUICtrlListView_SetItemText($hwnd, $index, $Name,1)
        _GUICtrlListView_SetItemText($hwnd, $index, $Duration,2)
    EndIf
EndFunc

Func Quit()
    Exit
EndFunc

Func RestDepends()
    If GUICtrlRead($CRestRadio) = $GUI_UNCHECKED Then
        GUICtrlSetState($CRestDur, $GUI_DISABLE)
        GUICtrlSetState($BRestDur, $GUI_ENABLE)
        GUICtrlSetState($RestType, $GUI_ENABLE)
    Else
        GUICtrlSetState($CRestDur, $GUI_ENABLE)
        GUICtrlSetState($BRestDur, $GUI_DISABLE)
        GUICtrlSetState($RestType, $GUI_DISABLE)
    EndIf
EndFunc

Func DurationDepends()
    If GUICtrlRead($CNoteRadio) = $GUI_UNCHECKED Then
        GUICtrlSetState($CNoteDur, $GUI_DISABLE)
        GUICtrlSetState($BNoteDur, $GUI_ENABLE)
        GUICtrlSetState($NoteType, $GUI_ENABLE)
    Else
        GUICtrlSetState($CNoteDur, $GUI_ENABLE)
        GUICtrlSetState($BNoteDur, $GUI_DISABLE)
        GUICtrlSetState($NoteType, $GUI_DISABLE)
    EndIf
EndFunc

Func UpdateKeySig()
        If GUICtrlRead($KeySigType) = "Sharps" Then
        $Num = GUICtrlRead($KeySigNum)
        $KeyMaj = $KeySigSharps[$Num][0]
        $KeyMin = $KeySigSharps[$Num][1]
        GUICtrlSetData($MajorDisp, "Major:   "&$KeyMaj)
        GUICtrlSetData($MinorDisp, "Minor:   "&$KeyMin)
    ElseIf GUICtrlRead($KeySigType) = "Flats" Then
        $Num = GUICtrlRead($KeySigNum)
        $KeyMaj = $KeySigFlats[$Num][0]
        $KeyMin = $KeySigFlats[$Num][1]
        GUICtrlSetData($MajorDisp, "Major:   "&$KeyMaj)
        GUICtrlSetData($MinorDisp, "Minor:   "&$KeyMin)
    Else
        GUICtrlSetData($MajorDisp, "Major:   Error")
        GUICtrlSetData($MinorDisp, "Minor:   Error")
    EndIf
EndFunc

Func UpdatePitch()
    Switch @GUI_CtrlID
        Case $UpDwn2,$KeyNum
            ControlCommand($GUI, "","ComboBox1","SelectString",$NoteOctavePitch[GUICtrlRead($KeyNum)][0])
            GUICtrlSetData($Octave, $NoteOctavePitch[GUICtrlRead($KeyNum)][1])
            If GuiCtrlRead($Octave) = 8 Then
                GUICtrlSetData($Pitch, "|A|A#|B|C",$NoteOctavePitch[GUICtrlRead($KeyNum)][0])
            Else
                GUICtrlSetData($Pitch, "|A|A#|B|C|C#|D|D#|E|F|F#|G|G#",$NoteOctavePitch[GUICtrlRead($KeyNum)][0])
            EndIf
        Case $Pitch
            For $x = 1 to 88
                If $NoteOctavePitch[$x][0] = GUICtrlRead($Pitch) AND $NoteOctavePitch[$x][1] = GUICtrlRead($Octave) Then
                    GUICtrlSetData($KeyNum, $x)  
                EndIf
            Next
            If GuiCtrlRead($Octave) = 8 And (Not GuiCtrlRead($Pitch) = "A" Or Not GuiCtrlRead($Pitch) = "B" Or Not GuiCtrlRead($Pitch) = "B#" Or Not GuiCtrlRead($Pitch) = "C") Then GUICtrlSetData($Pitch, "|A|A#|B|C","C")
        Case $UpDwn
            For $x = 1 to 88
                If $NoteOctavePitch[$x][0] = GUICtrlRead($Pitch) AND $NoteOctavePitch[$x][1] = GUICtrlRead($Octave) Then
                    GUICtrlSetData($KeyNum, $x)  
                EndIf
            Next
            If GuiCtrlRead($Octave) = 8 Then
                GUICtrlSetData($Pitch, "|A|A#|B|C",$NoteOctavePitch[GUICtrlRead($KeyNum)][0])
            Else
                GUICtrlSetData($Pitch, "|A|A#|B|C|C#|D|D#|E|F|F#|G|G#",$NoteOctavePitch[GUICtrlRead($KeyNum)][0])
            EndIf
    EndSwitch
    If GuiCtrlRead($Pitch) = "" then GUICtrlSetData($KeyNum,0)
EndFunc

Func AddNote()
    If GuiCtrlRead($KeyNum)= 0 Then 
        MsgBox(0,"Error", "Pitch Settings Invalid.")
        Return
    EndIf
    $Key = GUICtrlRead($KeyNum)
    $Note = GUICtrlRead($Pitch)
    $Octave1 = GUICtrlRead($Octave)
    If GuiCtrlRead($CNoteRadio)= $GUI_CHECKED Then
        $Duration = GuiCtrlRead($CNoteDur)
    ElseIf GuiCtrlRead($BNoteRadio)= $GUI_CHECKED Then
        Switch GUICtrlRead($NoteType)
            Case "Quarter"
                $Duration = GuiCtrlRead($BNoteDur)
            Case "Sixteenth"
                $Duration = GuiCtrlRead($BNoteDur)/4
            Case "Eighth"
                $Duration = GuiCtrlRead($BNoteDur)/2
            Case "Half"
                $Duration = GuiCtrlRead($BNoteDur)*2
            Case "Whole"
                $Duration = GuiCtrlRead($BNoteDur)*4
            Case "Dotted Quarter"
                $Duration = GuiCtrlRead($BNoteDur)*1.5
            Case "Dotted Sixteenth"
                $Duration = (GuiCtrlRead($BNoteDur)/4)*1.5
            Case "Dotted Eighth"
                $Duration = (GuiCtrlRead($BNoteDur)/2)*1.5
            Case "Dotted Half"
                $Duration = (GuiCtrlRead($BNoteDur)*2)*1.5
            Case "Dotted Whole"
                $Duration = (GuiCtrlRead($BNoteDur)*4)*1.5
        EndSwitch
    EndIf
    $idx = _GUICtrlListView_InsertItem($SongView, $Key)
    _GUICtrlListView_SetItemText ($SongView, $idx, $Note&$Octave1, 1)
    _GUICtrlListView_SetItemText ($SongView, $idx, $Duration, 2)
    ;GUICtrlCreateListviewItem($Key&"|"&$Note&$Octave1&"|"&$Duration,$SongView)
EndFunc

Func PreviewNote()
    $Key = GUICtrlRead($KeyNum)
    If GuiCtrlRead($CNoteRadio)= $GUI_CHECKED Then
        $Duration = GuiCtrlRead($CNoteDur)
    ElseIf GuiCtrlRead($BNoteRadio)= $GUI_CHECKED Then
        Switch GUICtrlRead($NoteType)
            Case "Quarter"
                $Duration = GuiCtrlRead($BNoteDur)
            Case "Sixteenth"
                $Duration = GuiCtrlRead($BNoteDur)/4
            Case "Eighth"
                $Duration = GuiCtrlRead($BNoteDur)/2
            Case "Half"
                $Duration = GuiCtrlRead($BNoteDur)*2
            Case "Whole"
                $Duration = GuiCtrlRead($BNoteDur)*4
            Case "Dotted Quarter"
                $Duration = GuiCtrlRead($BNoteDur)*1.5
            Case "Dotted Sixteenth"
                $Duration = (GuiCtrlRead($BNoteDur)/4)*1.5
            Case "Dotted Eighth"
                $Duration = (GuiCtrlRead($BNoteDur)/2)*1.5
            Case "Dotted Half"
                $Duration = (GuiCtrlRead($BNoteDur)*2)*1.5
            Case "Dotted Whole"
                $Duration = (GuiCtrlRead($BNoteDur)*4)*1.5
        EndSwitch
    EndIf
    Beep($NoteOctavePitch[$Key][2],$Duration)
EndFunc
    
Func Delete()
    $hwnd = GUICtrlGetHandle ($SongView)
    _GUICtrlListView_DeleteItemsSelected($hwnd)
EndFunc

Func ClearList()
    $ans = MsgBox(4, "Clear", "Are your sure you want to delete all notes?") 
    If $ans=6 Then 
        $hwnd = GUICtrlGetHandle ($SongView)
        _GUICtrlListView_DeleteAllItems($hwnd)
    EndIf
EndFunc
    
Func PreviewSong()
    $Count = _GUICtrlListView_GetItemCount($SongView)
    For $z = 0 to $Count-1
        $Item = _GUICtrlListView_GetItemTextArray($SongView, $z)
        If $Item[1] = "R" then 
            Sleep($Item[3])
        Else
            Beep($NoteOctavePitch[$Item[1]][2], $Item[3])
        EndIf
    Next
EndFunc

Func AddRest()
        If GuiCtrlRead($CRestRadio)= $GUI_CHECKED Then
        $Duration = GuiCtrlRead($CRestDur)
    ElseIf GuiCtrlRead($BRestRadio)= $GUI_CHECKED Then
        Switch GUICtrlRead($RestType)
            Case "Quarter"
                $Duration = GuiCtrlRead($BRestDur)
            Case "Sixteenth"
                $Duration = GuiCtrlRead($BRestDur)/4
            Case "Eighth"
                $Duration = GuiCtrlRead($BRestDur)/2
            Case "Half"
                $Duration = GuiCtrlRead($BRestDur)*2
            Case "Whole"
                $Duration = GuiCtrlRead($BRestDur)*4
            Case "Dotted Quarter"
                $Duration = GuiCtrlRead($BRestDur)*1.5
            Case "Dotted Sixteenth"
                $Duration = (GuiCtrlRead($BRestDur)/4)*1.5
            Case "Dotted Eighth"
                $Duration = (GuiCtrlRead($BRestDur)/2)*1.5
            Case "Dotted Half"
                $Duration = (GuiCtrlRead($BRestDur)*2)*1.5
            Case "Dotted Whole"
                $Duration = (GuiCtrlRead($BRestDur)*4)*1.5
        EndSwitch
    EndIf
    $idx = _GUICtrlListView_InsertItem($SongView, "R")
    _GUICtrlListView_SetItemText ($SongView, $idx, "Rest", 1)
    _GUICtrlListView_SetItemText ($SongView, $idx, $Duration, 2)
EndFunc

Func CreateSong()
    If GUICtrlRead($KeySigType) = "Sharps" Then
        $Num = GUICtrlRead($KeySigNum)
        $KeyMaj = $KeySigSharps[$Num][0]
    ElseIf GUICtrlRead($KeySigType) = "Flats" Then
        $Num = GUICtrlRead($KeySigNum)
        $KeyMaj = $KeySigFlats[$Num][0]
    EndIf
    $Path = FileSaveDialog("Path", @DesktopDir, "Autoit Script(*.au3)",16, GuiCtrlRead($Title)&" - "&GuiCtrlRead($Composer)&".au3")
    $Count = _GUICtrlListView_GetItemCount($SongView)
    $File = FileOpen($Path, 2)
    FileWrite($File,"#cs"&@CRLF&"Title: "&$Title&@CRLF&"Composer:"&$Composer&@CRLF&"Key Signature: "&$KeyMaj&@CRLF&"#ce")
    For $z = 0 to $Count-1
        $array = _GUICtrlListView_GetItemTextArray($SongView, $z)
        If $array[1] = "R" then 
            $Line = "Sleep("&$array[3]&");Rest"
        Else
            $Line = "Beep("&$NoteOctavePitch[$array[1]][2]&", "&$array[3]&");"&$array[2]
        EndIf
    FileWriteLine($File, $Line)
    Next
    FileClose($File)
EndFunc
Edited by Paulie

Share this post


Link to post
Share on other sites

Oh Paullieeeee!!!!!11!!!!!! This is too cool!

Lol why thank you! Couldn't have done it without you! :)

Share this post


Link to post
Share on other sites

wow nice paulie

yeah a few bugs

can anyone help me wiht mine?

cheers C.W


C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake

Share this post


Link to post
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
Sign in to follow this  
Followers 0