Jump to content

Musical Melodies


Mast3rpyr0
 Share

Recommended Posts

Midi FTW?

Mary Had A Little Lamb

Beep(500, 400)
Beep(450, 400)
Beep(400, 400)
Beep(450, 400)
Beep(500, 400)
Beep(500, 400)
Beep(500, 800)
Beep(450, 400)
Beep(450, 400)
Beep(450, 800)
Beep(500, 400)
Beep(600, 400)
Beep(600, 800)
Beep(500, 400)
Beep(450, 400)
Beep(400, 400)
Beep(450, 400)
Beep(500, 400)
Beep(500, 400)
Beep(500, 400)
Beep(500, 400)
Beep(450, 400)
Beep(450, 400)
Beep(500, 400)
Beep(450, 400)
Beep(400, 400)

More Soon!

Link to comment
Share on other sites

Midi FTW?

Mary Had A Little Lamb

Beep(500, 400)
Beep(450, 400)
Beep(400, 400)
Beep(450, 400)
Beep(500, 400)
Beep(500, 400)
Beep(500, 800)
Beep(450, 400)
Beep(450, 400)
Beep(450, 800)
Beep(500, 400)
Beep(600, 400)
Beep(600, 800)
Beep(500, 400)
Beep(450, 400)
Beep(400, 400)
Beep(450, 400)
Beep(500, 400)
Beep(500, 400)
Beep(500, 400)
Beep(500, 400)
Beep(450, 400)
Beep(450, 400)
Beep(500, 400)
Beep(450, 400)
Beep(400, 400)

More Soon!

:) thats great !!!

Link to comment
Share on other sites

  • 4 months later...

I use my own formats for Beeps so that I can have a readable format and smaller File format

Readable "PCSA layout" Hz:Ms,Hz:Ms (eg:300:1000,400:500)

The file format actually uses the GIF-Dimension method of saving values, making each note 4 bytes long (tone 2 bytes, time 2 bytes)

Dont worry about the extra unused variables, they are partly from an old player script I had, which has been remodeled

(I have a PCSA Player and PCSA Keyboard that I will post in a separate thread soon)

Func _PCSNotesToRaw($notes,$isstring=1)
;Converts PCSA layouts to File format
    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 _PCSPlayRaw($raw=-1,$speed=1)
;Plays File-Form PCSA data
    
    ;  37 through 32,767 
    ; (0x25 through 0x7FFF). 
    Global $_PCSLoad
    ;Global $_PCSTLenL, $PCSTPosS, $_PCSTPosL
    Global $_PCSPosition
    Global $_PCSPlaying
    If $raw=-1 Then $raw=$_PCSLoad
    $_PCSLoad=$raw
    Dim $speed
    $e=StringLen($raw)
    $len=_PCSGetLen($raw,1,$speed)
    ;GUICtrlSetData($_PCSTLenL,"Track Length: "&$len&"ms")
    ;_GUICtrlSlider_SetRange($PCSTPosS,0,$e)

    $_PCSPlaying=1
    ;ConsoleWrite(@CRLF&"PCS Playing Raw..."&@CRLF)
    $_PCSPosition=0
    For $i=1 To $e Step 4
        If $_PCSPlaying=0 Then ExitLoop
        $note=_GIFDimToDim(Asc(StringMid($raw,$i  ,1)),Asc(StringMid($raw,$i+1,1)))
        $leng=_GIFDimToDim(Asc(StringMid($raw,$i+2,1)),Asc(StringMid($raw,$i+3,1)))
    ;   ConsoleWrite($note&',')
        If $note<37 Or $note>32767 Then
            Sleep($leng*$speed)
        Else
            ;Sleep($speed)
            Beep($note,$leng*$speed)
        EndIf
        ;If $_PCSPosition>0 Then
        ;   $i=$_PCSPosition
        ;   $_PCSPosition=0
        ;EndIf
        ;GUICtrlSetData($_PCSTPosL,Floor(($i/2)*$speed)&"ms")
        ;_GUICtrlSlider_SetPos($PCSTPosS, $i)
    Next
EndFunc
Func _CountSets($i,$ii)
    ;counts the sets of $ii in $i and the remainder
    ;$ii should be smaller than $i
    Local $r[2]
    $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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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