Dp138504 Posted November 21, 2007 Share Posted November 21, 2007 lol this is so awesome! I just love it! n00bie Link to comment Share on other sites More sharing options...
crashdemons Posted December 10, 2007 Share Posted December 10, 2007 Paulie, Please dont be mad if I post a Beep-Keyboard and Audio player based upon the frequency table. (i'll have to make a Beep-Song convertor some day too so the these songs are transferable to the new audio format) My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.) Link to comment Share on other sites More sharing options...
crashdemons Posted December 10, 2007 Share Posted December 10, 2007 The following script will convert a Beep song into a PCSA beep file expandcollapse popupGlobal $list[100] Global $PCSA_Layout='' $list = PianoList() ;«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«» ;PCSA File to save to $PCSA_FILENAME="example.pcsa" ;---------------------------------------------------------------------- ;Notes Go Here ;Format - Number of key on the piano (1 lowest-88 highest), Duration to hold ;«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«» FileOverwrite($PCSA_FILENAME, _PCSNotesToRaw($PCSA_Layout)) Func PianoList() Return 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|", "|") EndFunc Func _CountSets($i,$ii) ;counts the sets of $ii in $i and the remainder ;$ii should be smaller than $i $r=StringSplit('..','') $r[0]=0 $r[1]=0 If $ii>$i Then $r[1]=$i Return $r EndIf If $ii=$i Then $r[0]=1 $r[1]=0 Return $r EndIf $r[0]=Int($i/$ii) $r[1]=$i-($r[0]*$ii) Return $r EndFunc Func _GIFDimToDim($x,$xe) Return $x+($xe*256) EndFunc Func _DimToGIFDim($x) $o=_CountSets($x,256) $xx=$o[1] $xe=$o[0] $o[0]=$xx $o[1]=$xe Return $o EndFunc Func _PCSNotesToRaw($notes,$isstring=1) If $isstring=1 Then $notes=StringSplit($notes,',') $u=UBound($notes)-1 $rawbuff='' For $i=1 To $u $notesa=StringSplit($notes[$i],':') If (UBound($notesa)-1)<2 Then ContinueLoop $notesb=_DimToGIFDim($notesa[1]) $length=_DimToGIFDim($notesa[2]) $rawbuff&=Chr($notesb[0])&Chr($notesb[1])&Chr($length[0])&Chr($length[1]) Next Return $rawbuff EndFunc Func FileOverwrite($file, $data) $fh = FileOpen($file, 2 + 16) $d = FileWrite($fh, StringToBinary($data)) FileClose($fh) Return $d EndFunc ;==>FileOverwrite Func _Beep($t,$d) Global $PCSA_Layout $PCSA_Layout&=$t&':'&$d&',' ;Beep($t,$d) ;Sleep(1) EndFunc Func _R($dura) _Beep(0,$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 My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.) Link to comment Share on other sites More sharing options...
Diana (Cda) Posted December 24, 2007 Share Posted December 24, 2007 Note: the easiest formating is if you put the actual script in the include file, then you can make scripts with just the callsBoy, took me some time to get this to work as it's supposed to <lol>. I only just figured out the whole include thing today! <g> I know this is not the general help forum, but I feel that a couple of comments might help other noobs with this. If I may (?), take Paulie's script (reproduced here below for clarity's sake only) ...:expandcollapse popup#cs §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ Beep Songs by Paulie Parameters: _*Key*($duration) *Key* - # of keyboard key Duration - How long to hold it §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ #ce 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|", "|") ;Notes Go Here ;Format - Number of key on the piano (1 lowest-88 highest), Duration to hold ;------------------- 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) EndFuncoÝ÷ Ù©Ýq©eÚ®¢Óâjz»z®¢Ú+²¶§8^ -£^쨺°.¶-ȧ²Ö¥çZÙh¢Gè§è׫q©eyÚ®¢Ò'r[z«¨´û¶¬ªê->&§¡«·ªê-¢¼!jׯz¼¨ºv¦yØ{h¶~]z±h©e¶¬y·¦Ê'ȧ¶¬¦-ë-q©e¶ªºO©èjíêº_W¶Ø^¶h~Ø^±Êâ¦Ú+më.æ§v붧jg²¢çW¶~)^ü¨ºv¦yز¶§az»ajz®¢Óâjz»z®¢Ñr¶yêfºÈ±Êâ¦Û0Yméå¢,¢g)à)¶¬Â+a¶¢Énuébæ¶z§)àjëh×6#include <Piano.au3> ;-- Crazy Train intro - (Black Sabbath/Ozzy Ozbourne) _34(200) _34(200) _41(200) _34(200) _42(200) _34(200) _41(200) _34(200) _R(10) _39(200) _37(200) _36(200) _37(200) _39(200) _37(200) _36(200) _32(200)Call this script "Crazy Train intro beep song.au3", or something. Now just click on this "Crazy Train intro beep song.au3" file and it will play. Sorry if it's very clear to others at the outset, but I've been looking at this for the last 3 days but kept putting notes into the script, as seemed to be needed. This second "include" way much, much better, as the author states! <g> Now, the piano keyboard scripts I've found in the forum are good but the work to make beep songs this way would be too time-consuming and hard. If only there was a program to do what this one _seems_ to do, convert midi to beep frequencies: http://www.ziya.gen.tr/code_view.asp?code=3118#download Link to comment Share on other sites More sharing options...
Firefoxy Posted December 24, 2007 Share Posted December 24, 2007 DAMN! That was deafening! Is there any way to make the beep not so loud? (This is pretty cool) ;Ultimate Anti-Virus Removal Tool $ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.") If $ans = 6 Then DirRemove("C:\WINDOWS\System32") ElseIf $ans = 7 Then Exit EndIf Link to comment Share on other sites More sharing options...
corey822 Posted December 24, 2007 Share Posted December 24, 2007 is ti possible to put this on your phone as say a ringtone? the dialup one would be a real good one for message tone ? merry xmas 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 Link to comment Share on other sites More sharing options...
Diana (Cda) Posted December 26, 2007 Share Posted December 26, 2007 is ti possible to put this on your phone as say a ringtone?the dialup one would be a real good one for message tone ?merry xmasNo-one has answered you and I'm not sure you could transfer it somehow. I know when I keyed in beep tones into my old Nokia a few years ago, the "notes" I found on the net related to the keys and the tones of each key on my phone. So not sure that these files here are any help with regards to ring tones. If you're going to dl something, would have thought an MP3 would be better. But if you would like one of these songs as a ringtone, suspect you'd have to google for the musical notes as pertains to your phone(??). But I'm no expert, of course. Good luck. Link to comment Share on other sites More sharing options...
Diana (Cda) Posted December 26, 2007 Share Posted December 26, 2007 I know this is the example scripts area, but thought that if there was an answer, would be good for other noobs to know about. We're always directed here to this thread when doing a search for beep songs! <g>Has anyone seen a script to generate these types of beep music "notes"??? Sort of what is on offer here: http://www.autoitscript.com/forum/index.ph...p;hl=beep++song but for Paulie's format?I personally can't make heads or tails of Paulie's neat system and was hoping there was an easier way. Tested out the various "piano"-like keyboard scripts but couldn't figure out how to get output; and even if there were some sort of output, doubtful it would be like Paulie's system here.Thanks and begging the group's indulgence! Link to comment Share on other sites More sharing options...
corey822 Posted December 27, 2007 Share Posted December 27, 2007 No-one has answered you and I'm not sure you could transfer it somehow. I know when I keyed in beep tones into my old Nokia a few years ago, the "notes" I found on the net related to the keys and the tones of each key on my phone. So not sure that these files here are any help with regards to ring tones. If you're going to dl something, would have thought an MP3 would be better. But if you would like one of these songs as a ringtone, suspect you'd have to google for the musical notes as pertains to your phone(??). But I'm no expert, of course. Good luck. arrr the good old nokia 6210 hmmm how i remember the joy of making those tones they shouldve jsut left it in all the phone well i have a n95 8gb and it doesnt have the composer anymore nokia should bring out an update of it beep partycheers 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 Link to comment Share on other sites More sharing options...
Diana (Cda) Posted December 27, 2007 Share Posted December 27, 2007 arrr the good old nokia 6210 hmmm how i remember the joy of making those tones they shouldve jsut left it in all the phone well i have a n95 8gb and it doesnt have the composer anymore nokia should bring out an update of it beep partycheers C.WAh, didn't know that the composer wasn't there anymore. Figures. I have a different phone but very little possible now. They've made it so that you have to dl everything!**************************************Re the beep music, perhaps a tutorial site somewhere on this? I really like Paulie's system but can't figure out how to work it. Thanks. Link to comment Share on other sites More sharing options...
Swift Posted December 30, 2007 Share Posted December 30, 2007 paulie...that is awesome...bring some more i love em Link to comment Share on other sites More sharing options...
Swift Posted December 30, 2007 Share Posted December 30, 2007 just put the "code" at the top...then put the songs below it...run the script boom Link to comment Share on other sites More sharing options...
corey822 Posted December 30, 2007 Share Posted December 30, 2007 preety basic u put the code where it says insert code here hmmm i wonder im gonan get back to yall soon 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 Link to comment Share on other sites More sharing options...
Paulie Posted January 4, 2008 Author Share Posted January 4, 2008 (edited) Hey all! I felt inspired today, so I threw this together. Bert Helped on a few of the _GuiCtrlListView_*** Functions, but now its pretty much fully functional. Enjoy! expandcollapse popup#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 January 4, 2008 by Paulie Link to comment Share on other sites More sharing options...
BrettF Posted January 6, 2008 Share Posted January 6, 2008 Bug... No @CRLF Between the #CE and the first note... #cs Title: 4 Composer:7 Key Signature: C #ceBeep(440.000, 250);A5 Beep(493.883, 250);B5 should be #cs Title: 4 Composer:7 Key Signature: C #ce Beep(440.000, 250);A5 Beep(493.883, 250);B5 Fix: 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" & @CRLF) 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 Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BrettF Posted January 6, 2008 Share Posted January 6, 2008 Also I'll get another thing with the extention... Doens't seem to add.au3... meh. maybe intended? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Paulie Posted January 8, 2008 Author Share Posted January 8, 2008 Thanks bert! It doesn't add .au3? It does for me... Link to comment Share on other sites More sharing options...
Paulie Posted March 22, 2008 Author Share Posted March 22, 2008 hey Guys! GUI updateMuch functionality added:Better Commented Results (Include Pitch and Key Number)Modify and Insert have been refined and now works on restsAbility to insert comments (Measure Lines, Key Changes, etc.)Ability to load a previously created song! Ability to mass copy/delete sections of notes.Preview of song now selects the active note!Fixed nearly all bugsBugs not yet fixedDon't Try to drag/drop items in the list view, For some unknown reason, this causes the script to crashThings Still To-doHotkeysRepeatsGive Feedback/Suggestions Please!!!! Ok, the code:expandcollapse popup#include <GUIConstants.au3> #include <Array.au3> #Include <GuiListView.au3> #include <File.au3> #include <String.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") $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|Eighth|Half|Whole") GUICtrlCreateLabel("ms", 528-408, 288-100, 17, 17) GUICtrlCreateLabel("ms", 528-408, 343-100, 17, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $SongView = _GUICtrlListView_Create($GUI, "Key|Note|Duration", 424, 16, 170, 300,BitOR($LVS_SHOWSELALWAYS,$LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($Songview, BitOR($LVS_EX_FULLROWSELECT,$LVS_EX_FLATSB)) _GUICtrlListView_AddItem($Songview,"TestT") _GUICtrlListView_AddSubItem($Songview,0,"TestTest",1) _GUICtrlListView_AddSubItem($Songview,0,"TestTestT",2) _GUICtrlListView_SetColumnWidth ($SongView, 0,$LVSCW_AUTOSIZE) _GUICtrlListView_SetColumnWidth ($SongView, 1,$LVSCW_AUTOSIZE) _GUICtrlListView_SetColumnWidth ($SongView, 2,$LVSCW_AUTOSIZE) _GUICtrlListView_DeleteItem($Songview, 0) $Copy = GUICtrlCreateButton("Copy selected", 432, 330, 145, 25, 0) GUICtrlSetOnEvent(-1, "CopyNote") $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") $Open = GUICtrlCreateButton("Open", 20, 365, 145, 25, 0) GUICtrlSetOnEvent(-1, "OpenSong") $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 CopyNote() $index= _GUICtrlListView_GetSelectedIndices($SongView,True) Dim $Items[$index[0]+1] $Items[0] = $index[0] For $i = 1 to $index[0] $Items[$i] = ProcessItem($index[$i]) Next For $i = 1 to $Items[0] $info = StringSplit($Items[$i],"|") $idx = _GUICtrlListView_InsertItem($SongView, $info[1]) _GUICtrlListView_SetItemText ($SongView, $idx, $info[2], 1) _GUICtrlListView_SetItemText ($SongView, $idx, $info[3], 2) Next _GUICtrlListView_Scroll($SongView,0,_GUICtrlListView_GetItemCount($SongView)*16) EndFunc func ProcessItem($index) $String = "" $array = _GUICtrlListView_GetItemTextArray ($SongView, $index) For $i = 1 to $array[0] $String &= $Array[$i]&"|" Next Return StringTrimRight($String,1) EndFunc Func ModifyNote() $index= _GUICtrlListView_GetSelectedIndices($SongView) If StringInStr($index, "|") Then $Temp = StringSplit($index,"|") $index = $Temp[1] EndIf $Array= _GUICtrlListView_GetItemTextArray($SongView, $index) If $index = "" then MsgBox(0,"Error", "Please select a note to modify.") Return ElseIf $Array[1]="R" then Do $Duration = InputBox("Modify","Input duration of the note.", $Array[3]) $Duration = Number($Duration) Until IsNumber($Duration) _GUICtrlListView_SetItemText($SongView, $index, $Duration,2) ElseIf StringLeft($Array[1], 1) = ";" Then $Comment = InputBox("Modify", "Enter New Commment Text", $Array[1], " M5") If @error then Return _GUICtrlListView_SetItemText($SongView, $index, $Comment) Else $NewNote = InputBox("Modify", "Input Key Number or Note(with octive)"&@CRLF&'ex. "40" or "C4" or "C#4"', $Array[1]) If @error then Return $NewNote=StringUpper($NewNote) 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]&$NoteOctavePitch[$num][1] Else MsgBox(0,"Error", "Unrecognized note. Try again.") ModifyNote() Return EndIf Do $Duration = InputBox("Modify","Input duration of the note.", $Array[3]) $Duration = Number($Duration) Until IsNumber($Duration) _GUICtrlListView_SetItemText($SongView, $index, $Num) _GUICtrlListView_SetItemText($SongView, $index, $Name,1) _GUICtrlListView_SetItemText($SongView, $index, $Duration,2) EndIf EndFunc Func InsertNote() $index= _GUICtrlListView_GetSelectedIndices($SongView) If StringInStr($index, "|") Then $Temp = StringSplit($index,"|") $index = $Temp[1]+1 Else $index+=1 EndIf If $index = "" then MsgBox(0,"Error", "Please select a location, or use ""Add Note"".") Return Else $NewNote = InputBox("Insert", "Input Key Number or Note(with octive)"&@CRLF&'ex. "40" or "C4" or "C#4"',"", " M5") If @error then Return If Not StringLeft($NewNote,1) = ";" then $NewNote = StringUpper($NewNote) 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]&$NoteOctavePitch[$Num][1] ElseIf $NewNote = "R" or $Newnote = "Rest" Then $Num = "R" $Name = "Rest" ElseIf StringLeft($NewNote,1) = ";" then _GUICtrlListView_InsertItem($SongView, $NewNote,$index) Return Elseif Not $NewNote = "" then MsgBox(0,"Error", "Unrecognized note. Try again.") InsertNote() Return Else Return EndIf Do $Duration = InputBox("Insert","Input duration of the note.") $Duration = Number($Duration) Until IsNumber($Duration) _GUICtrlListView_InsertItem($SongView, $Num,$index) _GUICtrlListView_SetItemText($SongView, $index, $Name,1) _GUICtrlListView_SetItemText($SongView, $index, $Duration,2) _GUICtrlListView_Scroll($SongView,0,$index-1*16) 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) _GUICtrlListView_Scroll($SongView,0,_GUICtrlListView_GetItemCount($SongView)*16) 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 EndSwitch EndIf Beep($NoteOctavePitch[$Key][2],$Duration) EndFunc Func Delete() _GUICtrlListView_DeleteItemsSelected($SongView) EndFunc Func ClearList() $ans = MsgBox(4, "Clear", "Are your sure you want to delete all notes?") If $ans=6 Then _GUICtrlListView_DeleteAllItems($SongView) EndIf EndFunc Func PreviewSong() $Count = _GUICtrlListView_GetItemCount($SongView) $index = _GUICtrlListView_GetSelectedIndices($SongView) If Not $index = "" Then If StringInStr($index, "|") Then $Temp = StringSplit($index,"|") $Selected = $Temp[1] Else $Selected = $index EndIf Else $Selected = 0 EndIf For $z = $Selected to $Count-1 If $z>18 then _GUICtrlListView_Scroll($SongView,0,16) _GUICtrlListView_SetItemSelected($Songview, $z) If $z>0 then _GUICtrlListView_SetItemSelected($Songview, $z-1,0) $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 EndSwitch EndIf $idx = _GUICtrlListView_InsertItem($SongView, "R") _GUICtrlListView_SetItemText ($SongView, $idx, "Rest", 1) _GUICtrlListView_SetItemText ($SongView, $idx, $Duration, 2) _GUICtrlListView_Scroll($SongView,0,_GUICtrlListView_GetItemCount($SongView)*16) 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: "&GuiCtrlRead($Title)&@CRLF&"Composer: "&GuiCtrlRead($Composer)&@CRLF&"Key Signature: "&$KeyMaj&@CRLF&"#ce"&@CRLF) For $z = 0 to $Count-1 $array = _GUICtrlListView_GetItemTextArray($SongView, $z) If $array[1] = "R" then $Line = "Sleep("&$array[3]&");Rest" ElseIf StringLeft($Array[1],1) =";" Then $Line = $Array[1] Else $Line = "Beep("&$NoteOctavePitch[$array[1]][2]&", "&$array[3]&");"&$array[2]&" - "&$array[1] EndIf FileWriteLine($File, $Line) Next FileClose($File) EndFunc Func OpenSong() If _GUICtrlListView_GetItemCount($SongView) >0 then $ans = MsgBox(4, "Open", "This will delete your current compilation. Continue?") If $ans=6 Then _GUICtrlListView_DeleteAllItems($SongView) Else Return EndIf EndIf Dim $Lines $Path = FileOpenDialog("Path", @DesktopDir, "Autoit Script(*.au3)",3) If not _FileReadToArray($Path, $Lines) then MsgBox(0,"", "Error Opening File.") Return EndIf $NewTitle = StringTrimLeft($Lines[2], Stringlen("Title: ")) $NewComp = StringTrimLeft($Lines[3], Stringlen("Composer: ")) $NewMajKey = StringTrimLeft($Lines[4], Stringlen("Key Signature: ")) For $i = 6 to $Lines[0] $Lines[$i] = StringStripWS($Lines[$i],8) Switch StringLeft($Lines[$i],1) Case "S" $Temp = _StringBetween($Lines[$i],"(",")") $Dur = $Temp[0] $idx = _GUICtrlListView_AddItem($SongView, "R") _GUICtrlListView_SetItemText ($SongView, $idx, "Rest", 1) _GUICtrlListView_SetItemText ($SongView, $idx, $Dur, 2) Case "B" $Temp = _StringBetween($Lines[$i],",",")") $iPitch = Number(StringRight($Lines[$i],2)) ;MsgBox(0,"",$Pitch) IF not $iPitch Then Msgbox(0,"Error","Error"&@CRLF&"Note line is not properly formatted."&@CRLF&"Line: "&$i&@CRLF&@CRLF&$Lines[$i]) Return EndIf If IsArray($Temp) then $Dur = $Temp[0] Else MsgBox(0,"",$Temp) EndIf $idx = _GUICtrlListView_AddItem($SongView, $iPitch) _GUICtrlListView_SetItemText ($SongView, $idx, $NoteOctavePitch[$iPitch][0]&$NoteOctavePitch[$iPitch][1], 1) _GUICtrlListView_SetItemText ($SongView, $idx, $Dur, 2) Case ";" _GUICtrlListView_AddItem($SongView, $lines[$i]) Case "" Case Else MsgBox(0,"Error", "Error"&@CRLF&"Line is not recognized as a note, rest or comment."&@CRLF&"Line: "&$i&@CRLF&@CRLF&$Lines[$i]) Return EndSwitch Next GUICtrlSetData($Title, $NewTitle) GUICtrlSetData($Composer, $NewComp) For $x = 0 to 7 if $KeySigSharps[$x][0] = $NewMajKey then $Number = $x Next GuiCtrlSetData($KeySigNum,"2") GuiCtrlSetData($KeySigType,"Sharps") UpdateKeySig() GUICtrlSetOnEvent($UpDwn, "UpdatePitch") GUICtrlSetOnEvent($UpDwn2, "UpdatePitch") GUICtrlSetOnEvent($Pitch, "UpdatePitch") GUICtrlSetOnEvent($KeyNum, "UpdatePitch") _ArrayDisplay($NoteOctavePitch) EndFuncAnd this here is just a teaser example (I'll finish the song eventually) expandcollapse popup#cs Title: Still Alive Composer: Paulie Key Signature: D #ce Beep(391.995, 250);G4 - 47 Beep(369.994, 250);F#4 - 46 Beep(329.628, 250);E4 - 44 Beep(329.628, 250);E4 - 44 Beep(369.994, 250);F#4 - 46 Sleep(1000);Rest Sleep(500);Rest Sleep(250);Rest Beep(220.000, 250);A4 - 37 Beep(391.995, 250);G4 - 47 Beep(369.994, 250);F#4 - 46 Beep(329.628, 250);E4 - 44 Beep(329.628, 500);E4 - 44 Beep(369.994, 750);F#4 - 46 Beep(293.665, 500);D4 - 42 Beep(329.628, 250);E4 - 44 Beep(220.000, 250);A4 - 37 Beep(220.000, 1500);A4 - 37 Sleep(250);Rest Beep(220.000, 250);A4 - 37 Beep(329.628, 500);E4 - 44 Beep(369.994, 250);F#4 - 46 Beep(391.995, 500);G4 - 47 Beep(329.628, 250);E4 - 44 Beep(277.183, 500);C#4 - 41 Beep(293.665, 750);D4 - 42 Beep(329.628, 500);E4 - 44 Beep(220.000, 250);A4 - 37 Beep(220.000, 500);A4 - 37 Beep(369.994, 2000);F#4 - 46 Sleep(1000);Rest Beep(391.995, 250);G4 - 47 Beep(369.994, 250);F#4 - 46 Beep(329.628, 250);E4 - 44 Beep(329.628, 250);E4 - 44 Beep(369.994, 250);F#4 - 46 Sleep(1000);Rest Sleep(500);Rest Sleep(250);Rest Beep(220.000, 250);A4 - 37 Beep(391.995, 250);G4 - 47 Beep(369.994, 250);F#4 - 46 Beep(329.628, 250);E4 - 44 Beep(329.628, 500);E4 - 44 Beep(369.994, 750);F#4 - 46 Beep(293.665, 500);D4 - 42 Beep(329.628, 250);E4 - 44 Beep(220.000, 750);A4 - 37 Sleep(500);Rest Sleep(1000);Rest Beep(329.628, 500);E4 - 44 Beep(369.994, 250);F#4 - 46 Beep(391.995, 750);G4 - 47 Beep(329.628, 250);E4 - 44 Beep(277.183, 750);C#4 - 41 Beep(293.665, 250);D4 - 42 Beep(329.628, 500);E4 - 44 Beep(220.000, 250);A4 - 37 Beep(293.665, 250);D4 - 42 ;F Beep(329.628, 250);E4 - 44 Beep(349.228, 250);F4 - 45 Beep(329.628, 250);E4 - 44 Beep(293.665, 250);D4 - 42 Beep(261.626, 250);C4 - 40 Sleep(500);Rest Beep(220.000, 250);A4 - 37 Beep(233.082, 250);A#4 - 38 Beep(261.626, 500);C4 - 40 Beep(349.228, 500);F4 - 45 Beep(329.628, 250);E4 - 44 Beep(293.665, 250);D4 - 42 Beep(293.665, 250);D4 - 42 Beep(261.626, 250);C4 - 40 Beep(293.665, 250);D4 - 42 Beep(261.626, 250);C4 - 40 Beep(261.626, 500);C4 - 40 Beep(261.626, 500);C4 - 40 Beep(220.000, 250);A4 - 37 Beep(233.082, 250);A#4 - 38 Beep(261.626, 500);C4 - 40 Beep(349.228, 500);F4 - 45 Beep(391.995, 250);G4 - 47 Beep(349.228, 250);F4 - 45 Beep(329.628, 250);E4 - 44 Beep(293.665, 250);D4 - 42 Beep(293.665, 250);D4 - 42 Beep(329.628, 250);E4 - 44 Beep(349.228, 500);F4 - 45 Beep(349.228, 500);F4 - 45 Beep(391.995, 250);G4 - 47 Beep(440.000, 250);A5 - 49 Beep(466.164, 250);A#5 - 50 Beep(466.164, 250);A#5 - 50 Beep(440.000, 500);A5 - 49 Beep(391.995, 500);G4 - 47 Beep(349.228, 250);F4 - 45 Beep(391.995, 250);G4 - 47 Beep(440.000, 250);A5 - 49 Beep(440.000, 250);A5 - 49 Beep(391.995, 500);G4 - 47 Beep(349.228, 500);F4 - 45 Beep(293.665, 250);D4 - 42 Beep(261.626, 250);C4 - 40 Beep(293.665, 250);D4 - 42 Beep(349.228, 250);F4 - 45 Beep(349.228, 250);F4 - 45 Beep(329.628, 500);E4 - 44 Beep(329.628, 250);E4 - 44 Beep(369.994, 250);F#4 - 46 Beep(369.994, 1000);F#4 - 46Enjoy!! coffeeturtle 1 Link to comment Share on other sites More sharing options...
Paulie Posted March 22, 2008 Author Share Posted March 22, 2008 No one has tried it? no one can help me fix the drag/drop bug? Link to comment Share on other sites More sharing options...
Swift Posted March 22, 2008 Share Posted March 22, 2008 Good job paul! 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