Sign in to follow this  
Followers 0
AZJIO

_Beep

37 posts in this topic

#1 ·  Posted (edited)

Example

Global $nTempo=0.8
Global $iTone=-1

_Beep(8,4,100)
_Beep(7,4,100)
_Beep(8,4,100)
_Beep(9,4,100)
_Beep(8,4,100,100)
_Beep(1,5,100,100)

Func _Beep($iNote,$iOctave=4,$iDuration=200,$iPause=0)
    $iFrequency=440*2^(($iNote+$iTone)/12+$iOctave+1/6-4)
    Beep($iFrequency, $iDuration/$nTempo)
    If $iPause<>0 Then Sleep($iPause/$nTempo)
EndFunc

$nTempo={0.1 , 0.2 , 1 , 1.1 , 1.7 ...} default=1

$iTone={-12,-11,...,-1,0,1,...,11,12} default=0

440 - 440Hz, note A

Downloads_NEW - (550kb, exe+sources) 25.7.2010

screenshot

melodies.7z =

{!!!_The_generator_of_melodies.au3

Europe.au3

Heavy_Asia.au3

Johann_Sebastian_Bach - Prelude_C-Major.au3

Johann_Sebastian_Bach.au3

Nikkolo_Paganini.au3

Polonaise_Oginsky.au3

Z.Abreu_Tico-Tico.au3}

melodies.7z

Edited by AZJIO

Share this post


Link to post
Share on other sites



really cool. must have taken a long time to write.


[Not using this account any more. Using "iShafayet" instead]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Nice tunes, but the script is slightly confusing. When I increase Tempo the music gets slower :mellow:

It would also be cool if you were to create function parameters that use the actual names of notes, rather than their frequencies. Something like:

_Beep($notename = "C", $octave = 4, $duration = 1, $pause = 0)

Note names could be as follows:

C, C# [or Db], D, E etc...

Alternatively you could use values 1 to 12.

Duration values could be as follows:

whole note = 4, half note = 2, quarter note = 1 etc...

triplet = $Duration/3, quintuplet = $Duration/5 etc...

Although it might seem to be adding complications, I imagine it will make the creation of new tunes easier in the long run. Pretty cool though. :P

Edited by czardas

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

;  @AZJIO 19.06.2010
#include <GUIConstants.au3>
#NoTrayIcon

; En
$LngTitle='Generator'
$LngTempo='Tempo'
$LngStd='Standard'
$LngOctave='Octave'
$LngDuration='Duration'
$LngTone='Tone'
$LngSec='sec'
$LngHz='Hz'
$LngPlay='Play'
$LngCancel='Cancel'
$LngClear='Clear'
$LngSave='Save'

; Ru
If RegRead("HKCU\Keyboard Layout\Preload", "1") = 00000419 Then
    $LngTitle='Генератор мелодий'
    $LngTempo='Темп'
    $LngStd='Эталон'
    $LngOctave='Октава'
    $LngDuration='Длительность'
    $LngTone='Тон'
    $LngSec='сек'
    $LngHz='Гц'
    $LngPlay='Воспроизв.'
    $LngCancel='Отмена'
    $LngClear='Очистить'
    $LngSave='Сохранить'
EndIf


Global $text='', $Octave

GUICreate($LngTitle,270,420, -1, -1, 0x00040000)
GUISetIcon("wmploc.dll",-32)
GUICtrlCreateLabel ($LngStd, 5,8,60,20)
GUICtrlSetResizing(-1, 802)
$kamerton=GUICtrlCreateCombo ("", 80,5,60,20)
GUICtrlSetResizing(-1, 802)
GUICtrlSetData(-1,'330|349|370|392|415|440|466|494|523|554|587|622', '440')
$FrequencyOut=GUICtrlCreateLabel ('', 150,8,60,20)
GUICtrlSetResizing(-1, 802)


GUICtrlCreateLabel ($LngTone, 5,38,60,20)
GUICtrlSetResizing(-1, 802)
$Tone=GUICtrlCreateCombo ("", 80,35,60,20)
GUICtrlSetResizing(-1, 802)
GUICtrlSetData(-1,'-12|-9|-7|-5|-3|0|+3|+5|+7|+9|+12', '0')


GUICtrlCreateLabel ($LngTempo, 160,38,74,20)
GUICtrlSetResizing(-1, 802)
$tempo=GUICtrlCreateCombo ("", 200,35,50,20)
GUICtrlSetResizing(-1, 802)
GUICtrlSetData(-1,'0.5|0.7|1|1.3|1.5|1.7|2', '1')

GUICtrlCreateLabel ($LngDuration, 5,68,74,20)
GUICtrlSetResizing(-1, 802)
$Duration=GUICtrlCreateCombo ("", 90,65,50,20)
GUICtrlSetResizing(-1, 802)
GUICtrlSetData(-1,'1|2|3|4|5|6|7|8', '4')
GUICtrlCreateLabel ('/10 '&$LngSec, 150,68,60,20)
GUICtrlSetResizing(-1, 802)

GUICtrlCreateLabel ($LngOctave, 5,108,60,20)
GUICtrlSetResizing(-1, 802)
$Octave=4
$octaveL=GUICtrlCreateLabel ($Octave, 50,108,10,20)
GUICtrlSetResizing(-1, 802)
For $i = 1 To 8
    Assign('octave' & $i, GUICtrlCreateButton ($i, $i*20+50,106,20,20))
        GUICtrlSetBkColor (-1, 0xffffff )
        GUICtrlSetColor (-1, 0)
        GUICtrlSetResizing(-1, 802)
Next
GUICtrlSetBkColor ($Octave4, 0x99ff99 )

$pause=GUICtrlCreateButton ("p", 245,163,20,20)
GUICtrlSetResizing(-1, 802)


For $i = 1 To 12
    Assign('nota' & $i, GUICtrlCreateButton ($i, $i*20-15,140,20,20))
    GUICtrlSetResizing(-1, 802)
    If StringInStr(',2,4,7,9,11,', ','&$i&',') Then
        GUICtrlSetBkColor (-1, 0 )
        GUICtrlSetColor (-1, 0xffffff)
    Else
        GUICtrlSetBkColor (-1, 0xffffff )
        GUICtrlSetColor (-1, 0)
    EndIf
    Assign('addnota' & $i, GUICtrlCreateButton ($i, $i*20-15,163,20,20))
    GUICtrlSetResizing(-1, 802)
    If StringInStr(',2,4,7,9,11,', ','&$i&',') Then
        GUICtrlSetBkColor (-1, 0 )
        GUICtrlSetColor (-1, 0xffffff)
    Else
        GUICtrlSetBkColor (-1, 0xffffff )
        GUICtrlSetColor (-1, 0)
    EndIf
Next

$Edit1 = GUICtrlCreateEdit('', 5, 190, 260, 170)
GUICtrlSetResizing(-1, 102+256)
$play=GUICtrlCreateButton ($LngPlay, 5,363,65,22)
GUICtrlSetResizing(-1, 512+256+64+2)
$Cancel=GUICtrlCreateButton ($LngCancel, 75,363,60,22)
GUICtrlSetResizing(-1, 512+256+64+2)
$Clear=GUICtrlCreateButton ($LngClear, 140,363,60,22)
GUICtrlSetResizing(-1, 512+256+64+2)
$save=GUICtrlCreateButton ($LngSave, 205,363,60,22)
GUICtrlSetResizing(-1, 512+256+64+2)

GUISetState ()

While 1
    $msg = GUIGetMsg()
    For $i = 1 To 12
        If $msg = Eval('nota' & $i) Then _nota($i)
        If $msg = Eval('addnota' & $i) Then
            _addnota($i)
            ControlFocus ( $LngTitle, '', $Edit1)
            Send('^{END}')
        EndIf
    Next
    For $i = 1 To 8
        If $msg = Eval('octave' & $i) Then
            GUICtrlSetBkColor (Eval('octave' & $Octave) , 0xffffff )
            $Octave=$i
            GUICtrlSetData($octaveL, $i)
            GUICtrlSetBkColor (Eval('octave' & $Octave) , 0x99ff99)
        EndIf
    Next
    Select
        Case $msg = $Cancel
            $text=GUICtrlRead ($Edit1)
            $text=StringRegExpReplace($text, '(?s)(^.*)\r\n(.*_Beep.*)[\r\n]*$', '\1')&@CRLF
            If @Extended=0 Then $text=''
            GUICtrlSetData($Edit1, $text)
            ControlFocus ( $LngTitle, '', $Edit1)
            Send('^{END}')
        Case $msg = $Clear
            $text=''
            GUICtrlSetData($Edit1, '')
        Case $msg = $play
            $text=GUICtrlRead ($Edit1)
            If $text<>'' Then
                _save(@TempDir&'\Beepfile.au3')
                $sAutoIt_Path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir")
                If @error Then ContinueLoop
                Run('"'&$sAutoIt_Path&'\AutoIt3.exe" "'&@TempDir&'\Beepfile.au3"', '', @SW_HIDE)
            EndIf
        Case $msg = $save
            $text=GUICtrlRead ($Edit1)
            If $text<>'' Then
                $file_save = FileSaveDialog( "save", @ScriptDir & "", "Beepfile (*.au3)", 24, "Beepfile.au3")
                _save($file_save)
            EndIf
        Case $msg = $pause
            $Duration0=GUICtrlRead ($Duration)*100
            $text&='Sleep('&$Duration0&')'&@CRLF
            GUICtrlSetData($Edit1, $text)
        Case $msg = -3
            ExitLoop
    EndSelect
WEnd


Func _nota($i)
$Duration0=GUICtrlRead ($Duration)*100
$kamerton0=GUICtrlRead ($kamerton)*2^(1/6)/16
$Frequency=Ceiling ($kamerton0*2^$Octave*2^($i/12))
GUICtrlSetData($FrequencyOut, 'f: '&$Frequency&' '&$LngHz)
Beep($Frequency, $Duration0)
EndFunc


Func _addnota($i)
$Duration0=GUICtrlRead ($Duration)*100
$kamerton0=GUICtrlRead ($kamerton)*2^(1/6)/16
$Frequency=Ceiling ($kamerton0*2^$Octave*2^($i/12))
GUICtrlSetData($FrequencyOut, 'f: '&$Frequency&' '&$LngHz)
Beep($Frequency, $Duration0)

$text=GUICtrlRead ($Edit1)
If StringRight($text, 2)<>@CRLF Then $text&=@CRLF
$text&='_Beep('&$i&','&$Octave&','&$Duration0&')'&@CRLF
GUICtrlSetData($Edit1, $text)
EndFunc


Func _save($file_save)
$file = FileOpen($file_save,2)
FileWrite($file, 'Global $tempo='&GUICtrlRead ($tempo) & @CRLF & _
    'Global $Tone='&GUICtrlRead ($Tone) & @CRLF & _
    'HotKeySet("{ESC}", "_Quit")' & @CRLF & @CRLF & _
    $text & @CRLF & @CRLF & _
    'Func _Beep($nota,$octave=4,$Duration=200,$pause=0)' & @CRLF & _
    '   $Frequency='&GUICtrlRead ($kamerton)&'*2^(($nota+$Tone)/12+$octave+1/6-4)' & @CRLF & _
    '   Beep($Frequency, $Duration/$tempo)' & @CRLF & _
    '   If $pause<>0 Then Sleep($pause/$tempo)' & @CRLF & _
    'EndFunc' & @CRLF & @CRLF & _
    'Func _Quit()' & @CRLF & _
    '    Exit' & @CRLF & _
    'EndFunc')
FileClose($file)
EndFunc

Edited by AZJIO

Share this post


Link to post
Share on other sites

Thanks for responding to my suggestions. You made this version really quickly. I think you've done a great job. Awesome! :mellow:

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Nikkolo Paganini

; Nikkolo Paganini
Global $tempo=1
Global $Tone=-12
HotKeySet("{ESC}", "_Quit")


;=========================1
_Beep(10,4,200,100)
_Beep(10,4,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(5,5,300)
_Beep(5,4,100)
_Beep(5,4,100)
_Beep(9,4,100)
_Beep(7,4,100)
_Beep(5,4,100)
_Beep(10,4,200,100)
_Beep(10,4,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(5,5,300,100)
_Beep(5,4,300,100)

_Beep(10,4,200,100)
_Beep(10,4,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(5,5,300)
_Beep(5,4,100)
_Beep(5,4,100)
_Beep(9,4,100)
_Beep(7,4,100)
_Beep(5,4,100)
_Beep(10,4,200,100)
_Beep(10,4,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(5,5,300,100)
_Beep(5,4,300,100)

_Beep(10,5,200,100)
_Beep(10,5,100)
_Beep(10,5,100)
_Beep(11,5,100)
_Beep(10,5,100)
_Beep(8,5,100)
_Beep(6,5,200,100)
_Beep(3,5,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(8,5,200,100)
_Beep(8,5,100)
_Beep(8,5,100)
_Beep(10,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(5,5,200,100)
_Beep(1,5,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(6,5,200,100)
_Beep(12,4,100)
_Beep(12,4,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(5,5,200,100)
_Beep(10,4,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(4,4,200)
_Beep(4,5,200)
_Beep(5,4,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(12,4,100)
_Beep(10,4,200,200)
_Beep(10,3,200,200)

;=========================2

_Beep(10,5,200,100)
_Beep(10,5,100)
_Beep(10,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(5,6,300)
_Beep(5,5,100)
_Beep(5,5,100)
_Beep(9,5,100)
_Beep(7,5,100)
_Beep(5,5,100)
_Beep(10,5,200,100)
_Beep(10,5,100)
_Beep(10,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(5,6,300,100)
_Beep(5,5,300,100)

_Beep(10,5,200,100)
_Beep(10,5,100)
_Beep(10,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(5,6,300)
_Beep(5,5,100)
_Beep(5,5,100)
_Beep(9,5,100)
_Beep(7,5,100)
_Beep(5,5,100)
_Beep(10,5,200,100)
_Beep(10,5,100)
_Beep(10,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(5,6,300,100)
_Beep(5,5,300,100)

_Beep(10,6,200,100)
_Beep(10,6,100)
_Beep(10,6,100)
_Beep(11,6,100)
_Beep(10,6,100)
_Beep(8,6,100)
_Beep(6,6,200,100)
_Beep(3,6,100)
_Beep(3,6,100)
_Beep(6,6,100)
_Beep(5,6,100)
_Beep(3,6,100)
_Beep(8,6,200,100)
_Beep(8,6,100)
_Beep(8,6,100)
_Beep(10,6,100)
_Beep(8,6,100)
_Beep(6,6,100)
_Beep(5,6,200,100)
_Beep(1,6,100)
_Beep(1,6,100)
_Beep(5,6,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(6,6,200,100)
_Beep(12,5,100)
_Beep(12,5,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(5,6,200,100)
_Beep(10,5,100)
_Beep(10,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(4,5,200)
_Beep(4,6,200)
_Beep(5,5,100)
_Beep(5,6,100)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(10,5,200,528)
;_Beep(10,4,200,200)


;=========================3


_Beep(5,5,36)
_Beep(1,6,36)
_Beep(5,6,133)
_Beep(1,6,133)
_Beep(10,5,133)
_Beep(5,5,133)
_Beep(1,5,133)
_Beep(10,4,60)
_Beep(5,5,36)
_Beep(9,5,36)
_Beep(12,5,133)
_Beep(9,5,133)
_Beep(5,5,133)
_Beep(12,4,133)
_Beep(9,4,133)
_Beep(5,4,60)
_Beep(5,5,36)
_Beep(9,5,36)
_Beep(5,6,133)
_Beep(1,6,133)
_Beep(10,5,133)
_Beep(5,5,133)
_Beep(1,5,133)
_Beep(10,4,133)
_Beep(5,6,266,134)
_Beep(5,5,250,60)

_Beep(5,5,36)
_Beep(1,6,36)
_Beep(5,6,133)
_Beep(1,6,133)
_Beep(10,5,133)
_Beep(5,5,133)
_Beep(1,5,133)
_Beep(10,4,60)
_Beep(5,5,36)
_Beep(9,5,36)
_Beep(12,5,133)
_Beep(9,5,133)
_Beep(5,5,133)
_Beep(12,4,133)
_Beep(9,4,133)
_Beep(5,4,60)
_Beep(5,5,36)
_Beep(9,5,36)
_Beep(5,6,133)
_Beep(1,6,133)
_Beep(10,5,133)
_Beep(5,5,133)
_Beep(1,5,133)
_Beep(10,4,133)
_Beep(5,6,266,134)
_Beep(5,5,250,60)

_Beep(2,6,36)
_Beep(5,6,36)
_Beep(10,6,100)
_Beep(5,6,100)
_Beep(2,6,100)
_Beep(10,5,100)
_Beep(5,5,100)
_Beep(2,5,100)
_Beep(10,4,100)
_Beep(3,4,100)
_Beep(6,4,100)
_Beep(10,4,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(10,5,133)
_Beep(3,6,133)
_Beep(6,6,133)
_Beep(8,6,100)
_Beep(6,6,100)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(3,5,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(8,5,133)
_Beep(1,6,133)
_Beep(5,6,133)
_Beep(6,6,100)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(9,5,100)
_Beep(6,5,133)
_Beep(3,5,133)
_Beep(12,4,133)
_Beep(5,6,100)
_Beep(1,6,100)
_Beep(10,5,100)
_Beep(5,5,100)
_Beep(1,5,133)
_Beep(10,4,133)
_Beep(5,4,133)
_Beep(6,4,100)
_Beep(10,4,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(5,4,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(9,4,100)
_Beep(10,4,300,500)

;=========================4


_Beep(10,5,100)
_Beep(9,5,100)
_Beep(10,5,50)
_Beep(9,5,50)
_Beep(11,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(5,6,100)
_Beep(4,6,100)
_Beep(5,6,50)
_Beep(4,6,50)
_Beep(6,6,100)
_Beep(5,6,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(10,5,50)
_Beep(9,5,50)
_Beep(11,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(5,6,100)
_Beep(4,6,100)
_Beep(5,6,50)
_Beep(4,6,50)
_Beep(6,6,100)
_Beep(5,6,200)
_Beep(5,5,200)

_Beep(10,5,100)
_Beep(9,5,100)
_Beep(10,5,50)
_Beep(9,5,50)
_Beep(11,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(5,6,100)
_Beep(4,6,100)
_Beep(5,6,50)
_Beep(4,6,50)
_Beep(6,6,100)
_Beep(5,6,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(10,5,50)
_Beep(9,5,50)
_Beep(11,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(5,6,100)
_Beep(4,6,100)
_Beep(5,6,50)
_Beep(4,6,50)
_Beep(6,6,100)
_Beep(5,6,200,200)
;_Beep(5,5,200,200)

_Beep(10,6,100)
_Beep(9,6,100)
_Beep(10,6,50)
_Beep(9,6,50)
_Beep(11,6,100)
_Beep(10,6,100)
_Beep(8,6,100)
_Beep(6,6,100)
_Beep(5,6,100)
_Beep(3,6,100)
_Beep(2,6,100)
_Beep(3,6,50)
_Beep(2,6,50)
_Beep(4,6,100)
_Beep(3,6,100)
_Beep(5,6,100)
_Beep(6,6,100)
_Beep(3,6,100)
_Beep(8,6,100)
_Beep(7,6,100)
_Beep(8,6,50)
_Beep(7,6,50)
_Beep(9,6,100)
_Beep(8,6,100)
_Beep(6,6,100)
_Beep(5,6,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,50)
_Beep(12,5,50)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(5,6,100)
_Beep(1,6,100)
_Beep(6,6,100)
_Beep(5,6,100)
_Beep(6,6,50)
_Beep(5,6,50)
_Beep(8,6,100)
_Beep(6,6,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(5,6,100)
_Beep(4,6,100)
_Beep(5,6,50)
_Beep(4,6,50)
_Beep(6,6,100)
_Beep(5,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(11,5,100)
_Beep(12,5,50)
_Beep(11,5,50)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(6,6,100)
_Beep(5,6,100)
_Beep(9,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(10,5,50)
_Beep(9,5,50)
_Beep(12,5,100)
_Beep(10,5,300,300)

;=========================5


_Beep(6,5,50,150)
_Beep(5,5,200)
_Beep(5,4,200,200)
_Beep(4,6,50,150)
_Beep(5,6,200)
_Beep(5,5,200,200)

_Beep(6,5,50,150)
_Beep(5,5,200)
_Beep(5,4,200,200)
_Beep(4,6,50,150)
_Beep(5,6,200)
_Beep(5,5,200,200)

_Beep(6,5,50,150)
_Beep(5,5,200)
_Beep(5,4,200,200)
_Beep(4,6,50,150)
_Beep(5,6,200)
_Beep(5,5,200,200)

_Beep(6,5,50,150)
_Beep(5,5,200)
_Beep(5,4,200,200)
_Beep(4,6,50,150)
_Beep(5,6,200)
_Beep(5,5,200,200)

_Beep(11,5,50,150)
_Beep(10,5,200)
_Beep(10,4,200,200)
_Beep(5,6,50,150)
_Beep(6,6,200)
_Beep(6,5,200,200)
_Beep(9,5,50,150)
_Beep(8,5,200)
_Beep(8,4,200,200)
_Beep(4,6,50,150)
_Beep(5,6,200)
_Beep(1,5,200,200)
_Beep(1,6,50,150)
_Beep(12,5,200)
_Beep(12,4,200,200)
_Beep(9,5,50,150)
_Beep(10,5,200)
_Beep(10,4,200,200)
_Beep(6,6,50,150)
_Beep(3,6,200)
_Beep(3,5,200,200)
_Beep(5,6,100,100)
_Beep(10,5,100,300)

;=========================6


_Beep(1,6,600)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(9,4,100)
_Beep(10,4,600)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(9,4,100)
_Beep(7,4,100)
_Beep(5,4,400)

_Beep(1,6,600)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(9,4,100)
_Beep(10,4,600)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(9,4,100)
_Beep(7,4,100)
_Beep(5,4,400)

_Beep(2,5,600)
_Beep(3,5,100)
_Beep(5,5,100)
_Beep(6,5,100)
_Beep(8,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(2,6,100)
_Beep(3,6,100)
_Beep(5,6,100)
_Beep(6,6,100)

_Beep(12,4,600)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(5,5,100)
_Beep(6,5,100)
_Beep(8,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(5,6,100)

_Beep(6,6,600)
_Beep(5,6,100)
_Beep(3,6,100)
_Beep(5,6,600)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(6,6,200)
_Beep(5,6,100)
_Beep(3,6,100)
_Beep(1,6,200)
_Beep(12,5,200)
_Beep(10,5,600,200)

;=========================7



_Beep(5,6,36)
_Beep(6,6,36)
_Beep(5,6,128)
_Beep(1,6,400)
_Beep(10,5,36)
_Beep(12,5,36)
_Beep(10,5,128)
_Beep(12,5,36)
_Beep(1,6,36)
_Beep(12,5,128)
_Beep(9,5,36)
_Beep(10,5,36)
_Beep(9,5,128)
_Beep(5,5,36)
_Beep(6,5,36)
_Beep(5,5,128)
_Beep(12,4,200)
_Beep(5,6,36)
_Beep(6,6,36)
_Beep(5,6,128)
_Beep(1,6,400)
_Beep(6,4,36)
_Beep(8,4,36)
_Beep(6,4,128)
_Beep(5,4,36)
_Beep(6,4,36)
_Beep(5,4,128)
_Beep(9,4,36)
_Beep(10,4,36)
_Beep(9,4,128)
_Beep(12,4,36)
_Beep(1,5,36)
_Beep(12,4,128)
_Beep(9,4,36)
_Beep(10,4,36)
_Beep(9,4,128)

_Beep(5,6,36)
_Beep(6,6,36)
_Beep(5,6,128)
_Beep(1,6,400)
_Beep(10,5,36)
_Beep(12,5,36)
_Beep(10,5,128)
_Beep(12,5,36)
_Beep(1,6,36)
_Beep(12,5,128)
_Beep(9,5,36)
_Beep(10,5,36)
_Beep(9,5,128)
_Beep(5,5,36)
_Beep(6,5,36)
_Beep(5,5,128)
_Beep(12,4,200)
_Beep(5,6,36)
_Beep(6,6,36)
_Beep(5,6,128)
_Beep(1,6,400)
_Beep(6,4,36)
_Beep(8,4,36)
_Beep(6,4,128)
_Beep(5,4,36)
_Beep(6,4,36)
_Beep(5,4,128)
_Beep(9,4,36)
_Beep(10,4,36)
_Beep(9,4,128)
_Beep(12,4,36)
_Beep(1,5,36)
_Beep(12,4,128)
_Beep(9,4,36)
_Beep(10,4,36)
_Beep(9,4,128)

_Beep(5,6,36)
_Beep(6,6,36)
_Beep(5,6,128)
_Beep(2,6,400)
_Beep(10,5,36)
_Beep(12,5,36)
_Beep(10,5,128)
_Beep(3,6,100,100)
_Beep(10,4,100,100)
_Beep(6,4,100,100)
_Beep(3,4,100,100)
_Beep(3,6,36)
_Beep(5,6,36)
_Beep(3,6,128)
_Beep(12,5,400)
_Beep(8,5,36)
_Beep(10,5,36)
_Beep(8,5,128)
_Beep(1,6,100,100)
_Beep(8,4,100,100)
_Beep(5,4,100,100)
_Beep(1,4,100,100)
_Beep(3,6,36)
_Beep(5,6,36)
_Beep(3,6,128)
_Beep(6,6,100,100)
_Beep(12,4,100,100)
_Beep(3,5,100,100)
_Beep(1,6,36)
_Beep(3,6,36)
_Beep(1,6,128)
_Beep(5,6,100,100)
_Beep(10,4,100,100)
_Beep(1,5,100,100)
_Beep(3,6,36)
_Beep(5,6,36)
_Beep(3,6,128)
_Beep(6,4,100,100)
_Beep(12,5,36)
_Beep(1,6,36)
_Beep(12,5,128)
_Beep(5,4,100,100)
_Beep(10,4,100,100)
_Beep(10,5,36)
_Beep(12,5,36)
_Beep(10,5,128)
_Beep(10,3,100,300)

;=========================8

_Beep(1,6,100)
_Beep(10,5,100)
_Beep(5,5,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(5,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(12,5,100)
_Beep(9,5,100)
_Beep(5,5,100)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(5,5,100)
_Beep(9,5,100)
_Beep(5,5,100)
_Beep(1,6,100)
_Beep(10,5,100)
_Beep(5,5,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(5,5,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(12,5,100)
_Beep(9,5,100)
_Beep(5,5,100)
_Beep(5,5,100)
_Beep(12,4,100)
_Beep(9,4,100)
_Beep(5,4,100,100)

_Beep(1,6,100)
_Beep(10,5,100)
_Beep(5,5,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(5,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(12,5,100)
_Beep(9,5,100)
_Beep(5,5,100)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(5,5,100)
_Beep(9,5,100)
_Beep(5,5,100)
_Beep(1,6,100)
_Beep(10,5,100)
_Beep(5,5,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(5,5,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(12,5,100)
_Beep(9,5,100)
_Beep(5,5,100)
_Beep(5,5,100)
_Beep(12,4,100)
_Beep(9,4,100)
_Beep(5,4,100,100)

_Beep(5,6,100)
_Beep(2,6,100)
_Beep(10,5,100)
_Beep(5,5,100)
_Beep(2,5,100)
_Beep(10,4,100)
_Beep(8,4,100)
_Beep(5,4,100)
_Beep(3,4,100)
_Beep(6,4,100)
_Beep(3,6,100)
_Beep(10,5,100)
_Beep(6,5,100)
_Beep(3,5,100)
_Beep(10,4,100)
_Beep(6,4,100)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(8,5,100)
_Beep(3,5,100)
_Beep(8,4,100)
_Beep(6,4,100)
_Beep(5,4,100)
_Beep(3,4,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(1,6,100)
_Beep(8,5,100)
_Beep(5,5,100)
_Beep(1,5,100)
_Beep(8,4,100)
_Beep(5,4,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(7,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(8,4,100)
_Beep(6,4,100)
_Beep(5,4,100)
_Beep(3,4,100)
_Beep(1,4,100)
_Beep(12,3,100)
_Beep(10,3,100)
_Beep(12,3,100)
_Beep(3,4,100)
_Beep(10,4,100)
_Beep(6,4,100)
_Beep(12,3,100)
_Beep(5,4,100)
_Beep(12,4,100)
_Beep(9,4,100)
_Beep(10,4,100)
_Beep(5,4,100)
_Beep(1,4,100)
_Beep(12,3,100)
_Beep(10,3,400)

;=========================9

_Beep(10,5,600)
_Beep(5,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(7,5,100)
_Beep(5,5,100)
_Beep(7,5,100)
_Beep(9,5,100)
_Beep(5,5,100)
_Beep(10,5,500)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(4,6,200)
_Beep(5,6,200)
_Beep(5,5,400)

_Beep(10,5,600)
_Beep(5,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(7,5,100)
_Beep(5,5,100)
_Beep(7,5,100)
_Beep(9,5,100)
_Beep(5,5,100)
_Beep(10,5,500)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(4,6,200)
_Beep(5,6,200)
_Beep(5,5,400)

_Beep(10,5,500)
_Beep(5,6,100)
_Beep(2,6,100)
_Beep(10,5,100)
_Beep(8,5,100)
_Beep(5,5,100)
_Beep(2,5,100)
_Beep(10,4,100)
_Beep(8,4,100)
_Beep(5,4,100)
_Beep(2,4,100)
_Beep(10,3,100)
_Beep(8,5,500)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(8,5,100)
_Beep(6,6,100)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(6,6,500)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(5,5,100)
_Beep(10,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,200)
_Beep(5,5,200)
_Beep(10,6,800)

;=========================

Func _Beep($nota,$octave=4,$Duration=200,$pause=0)
    $Frequency=440*2^(($nota+$Tone)/12+$octave+1/6-4)
    Beep($Frequency, $Duration/$tempo)
    If $pause<>0 Then Sleep($pause/$tempo)
EndFunc

Func _Quit()
Exit
EndFunc

Edited by AZJIO

Share this post


Link to post
Share on other sites

I once tried playing this on the guitar with much difficulty. :mellow: I think the last note of the theme (section 1) is in the wrong octave. I changed line 93 from _Beep(10,3,200,200) to _Beep(10,5,200,200).

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Nikkolo Paganini

Posted Image

Jóhann Sebástian Bach - Prelude C-Minor

Global $tempo=1
Global $Tone=-12
HotKeySet("{ESC}", "_Quit")


_Beep(1,6,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(4,5,100)
_Beep(1,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(4,5,100)

_Beep(1,6,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(4,5,100)
_Beep(1,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(4,5,100)

_Beep(9,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(6,5,100)
_Beep(1,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(6,5,100)

_Beep(9,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(6,5,100)
_Beep(1,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(6,5,100)

_Beep(12,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(6,5,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(6,5,100)

_Beep(12,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(6,5,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(6,5,100)

_Beep(1,6,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(8,5,100)
_Beep(4,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(8,5,100)

_Beep(1,6,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(8,5,100)
_Beep(4,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(8,5,100)

_Beep(4,6,100)
_Beep(9,5,100)
_Beep(8,5,100)
_Beep(9,5,100)
_Beep(4,5,100)
_Beep(9,5,100)
_Beep(8,5,100)
_Beep(9,5,100)

_Beep(4,6,100)
_Beep(9,5,100)
_Beep(8,5,100)
_Beep(9,5,100)
_Beep(4,5,100)
_Beep(9,5,100)
_Beep(8,5,100)
_Beep(9,5,100)

_Beep(3,6,100)
_Beep(7,5,100)
_Beep(5,5,100)
_Beep(7,5,100)
_Beep(3,5,100)
_Beep(7,5,100)
_Beep(5,5,100)
_Beep(7,5,100)

_Beep(3,6,100)
_Beep(7,5,100)
_Beep(5,5,100)
_Beep(7,5,100)
_Beep(3,5,100)
_Beep(7,5,100)
_Beep(5,5,100)
_Beep(7,5,100)

_Beep(3,6,100)
_Beep(8,5,100)
_Beep(7,5,100)
_Beep(8,5,100)
_Beep(3,5,100)
_Beep(8,5,100)
_Beep(7,5,100)
_Beep(8,5,100)

_Beep(3,6,100)
_Beep(8,5,100)
_Beep(7,5,100)
_Beep(8,5,100)
_Beep(3,5,100)
_Beep(8,5,100)
_Beep(7,5,100)
_Beep(8,5,100)

_Beep(1,6,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(5,5,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(5,5,100)

_Beep(1,6,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(5,5,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(5,5,100)

_Beep(1,6,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(6,5,100)
_Beep(1,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(6,5,100)

_Beep(1,6,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(6,5,100)
_Beep(1,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(6,5,100)

_Beep(11,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(6,5,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(6,5,100)

_Beep(11,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(6,5,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(6,5,100)

_Beep(11,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(8,5,100)
_Beep(4,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(8,5,100)

_Beep(11,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(8,5,100)
_Beep(4,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(8,5,100)

_Beep(9,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(8,5,100)
_Beep(4,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(8,5,100)

_Beep(9,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(8,5,100)
_Beep(4,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(8,5,100)

_Beep(9,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(11,4,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)

_Beep(9,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(11,4,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)

_Beep(8,5,100)
_Beep(11,4,100)
_Beep(9,4,100)
_Beep(11,4,100)
_Beep(4,5,100)
_Beep(11,4,100)
_Beep(9,4,100)
_Beep(11,4,100)

_Beep(8,5,100)
_Beep(11,4,100)
_Beep(9,4,100)
_Beep(11,4,100)
_Beep(4,5,100)
_Beep(11,4,100)
_Beep(9,4,100)
_Beep(11,4,100)

_Beep(6,5,100)
_Beep(1,5,100)
_Beep(11,4,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(11,4,100)
_Beep(1,5,100)

_Beep(6,5,100)
_Beep(1,5,100)
_Beep(11,4,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(11,4,100)
_Beep(1,5,100)

_Beep(6,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(12,4,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)

_Beep(6,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(12,4,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)

_Beep(6,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(12,4,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)

_Beep(6,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(12,4,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)

_Beep(4,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(4,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(6,4,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(4,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(4,5,100)

_Beep(6,4,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(4,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(4,5,100)

_Beep(7,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(4,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(7,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(4,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(4,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(4,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(7,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(7,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(8,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(8,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(9,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(9,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(8,3,1600)

;=========================

_Beep(8,3,100)
_Beep(12,3,100)
_Beep(3,4,100)
_Beep(6,4,100)
_Beep(9,4,100)
_Beep(6,4,100)
_Beep(5,4,100)
_Beep(6,4,100)
_Beep(12,4,100)
_Beep(6,4,100)
_Beep(3,5,100)
_Beep(12,4,100)
_Beep(9,4,100)
_Beep(6,4,100)
_Beep(5,4,100)
_Beep(6,4,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(4,4,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(8,4,100)
_Beep(7,4,100)
_Beep(8,4,100)
_Beep(4,5,100)
_Beep(1,5,100)
_Beep(8,5,100)
_Beep(4,5,100)
_Beep(1,5,100)
_Beep(9,4,100)
_Beep(8,4,100)
_Beep(9,4,100)
_Beep(8,3,100)
_Beep(10,3,100)
_Beep(7,4,100)
_Beep(1,5,100)
_Beep(4,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(7,5,100)
_Beep(1,5,100)
_Beep(10,5,100)
_Beep(7,5,100)
_Beep(4,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)

_Beep(8,3,1600)
_Beep(8,4,1600,100)

;=========================


_Beep(3,6,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(4,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(10,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)

_Beep(3,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(8,5,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(12,5,100)

_Beep(1,6,100)
_Beep(10,5,100)
_Beep(8,5,100)
_Beep(10,5,100)
_Beep(7,5,100)
_Beep(10,5,100)
_Beep(8,5,100)
_Beep(10,5,100)

_Beep(12,5,100)
_Beep(8,5,100)
_Beep(7,5,100)
_Beep(8,5,100)
_Beep(3,5,100)

_Beep(8,6,100)
_Beep(6,6,100)
_Beep(8,6,100)
_Beep(9,6,100)
_Beep(6,6,100)
_Beep(4,6,100)
_Beep(6,6,100)
_Beep(3,6,100)
_Beep(6,6,100)
_Beep(4,6,100)
_Beep(6,6,100)

_Beep(8,6,100)
_Beep(4,6,100)
_Beep(3,6,100)
_Beep(4,6,100)
_Beep(1,6,100)
_Beep(4,6,100)
_Beep(3,6,100)
_Beep(4,6,100)

_Beep(6,6,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(3,6,100)

_Beep(4,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(8,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)

_Beep(9,5,100)
_Beep(6,6,100)
_Beep(4,6,100)
_Beep(6,6,100)
_Beep(8,5,100)
_Beep(4,6,100)
_Beep(3,6,100)
_Beep(4,6,100)
_Beep(6,5,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(4,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(9,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(6,5,100)
_Beep(8,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(4,5,100)
_Beep(6,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(8,5,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(3,6,100)

_Beep(4,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(10,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)

_Beep(3,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(8,5,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(12,5,100)

_Beep(1,6,100)
_Beep(10,5,100)
_Beep(8,5,100)
_Beep(10,5,100)
_Beep(7,5,100)
_Beep(10,5,100)
_Beep(8,5,100)
_Beep(10,5,100)

_Beep(12,5,100)
_Beep(8,5,100)
_Beep(7,5,100)
_Beep(8,5,100)
_Beep(3,5,100)
_Beep(8,6,100)
_Beep(6,6,100)
_Beep(8,6,100)

_Beep(9,6,100)
_Beep(6,6,100)
_Beep(4,6,100)
_Beep(6,6,100)
_Beep(3,6,100)
_Beep(6,6,100)
_Beep(4,6,100)
_Beep(6,6,100)

_Beep(8,6,100)
_Beep(4,6,100)
_Beep(3,6,100)
_Beep(4,6,100)
_Beep(1,6,100)
_Beep(4,6,100)
_Beep(3,6,100)
_Beep(4,6,100)

_Beep(6,6,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(3,6,100)

_Beep(4,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(8,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)

_Beep(9,5,100)
_Beep(6,6,100)
_Beep(4,6,100)
_Beep(6,6,100)
_Beep(8,5,100)
_Beep(4,6,100)
_Beep(3,6,100)
_Beep(4,6,100)
_Beep(6,5,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(4,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(9,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(6,5,100)
_Beep(8,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(4,5,100)
_Beep(6,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(3,5,100)

;=========================


_Beep(8,6,100)
_Beep(6,6,100)
_Beep(8,6,100)

_Beep(9,6,100)
_Beep(6,6,100)
_Beep(4,6,100)
_Beep(6,6,100)
_Beep(3,6,100)
_Beep(6,6,100)
_Beep(4,6,100)
_Beep(6,6,100)

_Beep(8,6,100)
_Beep(4,6,100)
_Beep(3,6,100)
_Beep(4,6,100)
_Beep(1,6,100)
_Beep(4,6,100)
_Beep(3,6,100)
_Beep(4,6,100)

_Beep(6,6,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(3,6,100)

_Beep(4,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(8,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)

_Beep(9,5,100)
_Beep(6,6,100)
_Beep(4,6,100)
_Beep(6,6,100)
_Beep(8,5,100)
_Beep(4,6,100)
_Beep(3,6,100)
_Beep(4,6,100)
_Beep(6,5,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(4,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(9,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(6,5,100)
_Beep(8,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(4,5,100)
_Beep(6,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)


;=========================

_Beep(1,5,100)
_Beep(1,5,100)
_Beep(1,5,100)
_Beep(8,5,100)
_Beep(8,5,100)
_Beep(8,5,100)
_Beep(11,5,100)
_Beep(11,5,100)
_Beep(11,5,100)
_Beep(1,6,100)
_Beep(1,6,100)
_Beep(1,6,100)
_Beep(5,6,100)
_Beep(5,6,100)
_Beep(5,6,100)


_Beep(5,5,900)

_Beep(1,5,200)
_Beep(3,5,100)
_Beep(5,5,100)
_Beep(6,5,100)
_Beep(8,5,100)
_Beep(9,5,100)
_Beep(11,5,100)
_Beep(1,6,100)

_Beep(9,5,400)
_Beep(8,5,300)
_Beep(6,5,300)
_Beep(8,5,440)

_Beep(5,5,120)
_Beep(1,4,120)
_Beep(6,4,120)
_Beep(9,4,120)
_Beep(1,5,120)
_Beep(6,5,120)
_Beep(8,5,120)

_Beep(6,5,75)
_Beep(5,5,75)
_Beep(6,5,75)
_Beep(8,5,75)
_Beep(9,5,75)
_Beep(8,5,75)
_Beep(6,5,75)
_Beep(4,5,75)
_Beep(3,5,75)
_Beep(4,5,75)
_Beep(6,5,75)
_Beep(3,5,75)
_Beep(4,5,400)

_Beep(6,5,900)
_Beep(12,4,300)
_Beep(5,3,150,50)
_Beep(12,3,300)
_Beep(3,4,300)
_Beep(6,4,300)
_Beep(9,4,300)
_Beep(8,4,300)
_Beep(6,4,300)
_Beep(12,4,300)
_Beep(6,4,300)
_Beep(3,5,300)
_Beep(6,4,300)
_Beep(12,4,300)
_Beep(9,4,300)
_Beep(8,4,300)
_Beep(6,4,300)
_Beep(5,4,300)
_Beep(2,5,300)
_Beep(11,4,300)
_Beep(8,4,300)
_Beep(1,5,300)
_Beep(9,4,300)
_Beep(6,4,300)
_Beep(9,4,300)
_Beep(8,4,300)
_Beep(11,4,300)
_Beep(8,4,300)
_Beep(5,4,300)
_Beep(9,4,300)
_Beep(6,4,300)
_Beep(3,4,300)
_Beep(6,4,300)
_Beep(5,4,300)
_Beep(8,4,300)
_Beep(5,4,300)
_Beep(1,4,300)
_Beep(6,4,300)
_Beep(3,4,300)
_Beep(12,3,300)
_Beep(3,4,300)
_Beep(5,3,150,50)
_Beep(8,3,300)
_Beep(1,4,300)
_Beep(3,4,300)
_Beep(5,4,300)
_Beep(8,4,300)
_Beep(11,4,300)
_Beep(8,4,300)
_Beep(9,4,300)
_Beep(1,5,300)
_Beep(6,5,300)
_Beep(3,5,300)
_Beep(6,5,300)
_Beep(9,5,300)
_Beep(1,6,300)
_Beep(12,5,300)
_Beep(1,6,300)
_Beep(8,5,300)
_Beep(6,5,300)
_Beep(3,5,300)
_Beep(5,5,300)
_Beep(8,4,300)
_Beep(6,4,300)
_Beep(3,4,300)
_Beep(1,4,1200)


Func _Beep($nota,$octave=4,$Duration=200,$pause=0)
    $Frequency=440*2^(($nota+$Tone)/12+$octave+1/6-4)
    Beep($Frequency, $Duration/$tempo)
    If $pause<>0 Then Sleep($pause/$tempo)
EndFunc

Func _Quit()
Exit
EndFunc

Edited by AZJIO

Share this post


Link to post
Share on other sites

This is pretty neat. Great job, AZJIO

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Tico-Tico Z.Abreu

Global $tempo=0.8
Global $Tone=0
HotKeySet("{ESC}", "_Quit")


_Beep(8,4,100)
_Beep(7,4,100)
_Beep(8,4,100)
_Beep(9,4,100)
_Beep(8,4,100,100)
_Beep(1,5,100,100)

_Beep(8,4,100)
_Beep(7,4,100)
_Beep(8,4,100)
_Beep(9,4,100)
_Beep(8,4,100,100)
_Beep(12,4,100,100)

_Beep(8,4,100)
_Beep(7,4,100)
_Beep(8,4,100)
_Beep(9,4,100)
_Beep(8,4,100)

_Beep(6,5,100)
_Beep(3,5,100)
_Beep(12,4,100)
_Beep(8,4,100)
_Beep(6,4,100)
_Beep(5,4,100)
_Beep(4,4,200,300)

_Beep(1,5,100)
_Beep(12,4,100)
_Beep(11,4,100)
_Beep(9,4,100)
_Beep(1,5,100,100)
_Beep(6,5,100,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(8,4,100)
_Beep(1,5,100,100)

_Beep(4,5,100,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(3,4,100)
_Beep(7,4,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,250,250)

;===========================




_Beep(8,4,100)
_Beep(7,4,100)
_Beep(8,4,100)
_Beep(9,4,100)
_Beep(8,4,100,100)
_Beep(1,5,100,100)

_Beep(8,4,100)
_Beep(7,4,100)
_Beep(8,4,100)
_Beep(9,4,100)
_Beep(8,4,100,100)
_Beep(12,4,100,100)

_Beep(8,4,100)
_Beep(7,4,100)
_Beep(8,4,100)
_Beep(9,4,100)
_Beep(8,4,100)

_Beep(6,5,100)
_Beep(3,5,100)
_Beep(12,4,100)
_Beep(8,4,100)
_Beep(6,4,100)
_Beep(5,4,100)
_Beep(4,4,200,300)

_Beep(1,5,100)
_Beep(12,4,100)
_Beep(11,4,100)
_Beep(9,4,100)
_Beep(1,5,100,100)
_Beep(6,5,100,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(8,4,100)
_Beep(1,5,100,100)

_Beep(4,5,100,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)

;=============================

_Beep(8,4,100)
_Beep(12,4,100)
_Beep(3,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,300,200)

_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(11,4,100)
_Beep(4,4,100)
_Beep(8,4,100)
_Beep(11,4,100)
_Beep(4,4,100)
_Beep(8,4,100)
_Beep(11,4,100)
_Beep(12,4,100)
_Beep(1,5,150,150)
_Beep(9,4,200,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(11,4,100)
_Beep(3,4,100)
_Beep(6,4,100)
_Beep(11,4,100)
_Beep(3,4,100)
_Beep(6,4,100)
_Beep(11,4,100)
_Beep(12,4,100)
_Beep(1,5,150,150)
_Beep(8,4,200,100)

_Beep(4,5,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(11,4,100)
_Beep(3,5,150,150)
_Beep(11,4,300,100)

_Beep(3,5,100)
_Beep(1,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(11,4,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(11,4,100)
_Beep(9,4,100)
_Beep(11,4,400,100)

_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(11,4,100)
_Beep(4,4,100)
_Beep(8,4,100)
_Beep(11,4,100)
_Beep(4,4,100)
_Beep(8,4,100)
_Beep(11,4,100)
_Beep(12,4,100)
_Beep(1,5,150,150)
_Beep(9,4,200,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(11,4,100)
_Beep(3,4,100)
_Beep(6,4,100)
_Beep(11,4,100)
_Beep(3,4,100)
_Beep(6,4,100)
_Beep(11,4,100)
_Beep(12,4,100)
_Beep(1,5,150,150)
_Beep(8,4,150,150)

_Beep(4,5,100)
_Beep(3,5,100)
_Beep(2,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(4,5,100)
_Beep(11,4,100)
_Beep(4,5,100)
_Beep(8,5,100)
_Beep(11,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(8,5,100)
_Beep(6,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(11,4,100)
_Beep(9,4,100)
_Beep(8,4,100)
_Beep(6,4,100)
_Beep(4,4,200)

Func _Beep($nota,$octave=4,$Duration=200,$pause=0)
    $Frequency=440*2^(($nota+$Tone)/12+$octave+1/6-4)
    Beep($Frequency, $Duration/$tempo)
    If $pause<>0 Then Sleep($pause/$tempo)
EndFunc

Func _Quit()
Exit
EndFunc

Edited by AZJIO

Share this post


Link to post
Share on other sites

May I suggest a little change?

DSBeep.au3

#include "AutoItObject.au3"
#include <WinAPI.au3>

; Start AutoItObject
_AutoItObject_StartUp()
Global $__DS_oIDirectSound8, $__DS_tDSBUFFERDESC, $__DS_tWAVEFORMATEX

Func _StartDSBeep()
    ; WAVEFORMATEX structure (http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.reference.waveformatex(VS.85).aspx)
    $__DS_tWAVEFORMATEX = DllStructCreate("align 2;word FormatTag;" & _
            "word Channels;" & _
            "dword SamplesPerSec;" & _
            "dword AvgBytesPerSec;" & _
            "word BlockAlign;" & _
            "word BitsPerSample;" & _
            "word Size")
    ; DSBUFFERDESC structure (http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.reference.dsbufferdesc(VS.85).aspx)
    $__DS_tDSBUFFERDESC = DllStructCreate("dword Size;" & _
            "dword Flags;" & _
            "dword BufferBytes;" & _
            "dword Reserved;" & _
            "ptr Format")
    ; Some constants
    Local Const $DSBCAPS_CTRLPOSITIONNOTIFY = 256
    Local Const $DSBCAPS_CTRLFREQUENCY = 32
    Local Const $DSBCAPS_GLOBALFOCUS = 32768
    Local Const $DSSCL_NORMAL = 1
    Local Const $WAVE_FORMAT_PCM = 1
    Local Const $BITS_PER_SAMPLE = 16
    Local Const $NUM_CHANNELS = 2 ; stereo (no particular reason why)
    Local Const $SAMPLING_RATE = 44100
    ; Derived
    Local Const $SCALE = BitShift(1, -($BITS_PER_SAMPLE - 1)) - 1
    ; Let's go. DirectSound8 over DirectSound only because of the convinient links (http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.reference.directsoundcreate8(VS.85).aspx)
    Local $aCall = DllCall("dsound.dll", "long", "DirectSoundCreate8", _
            "ptr", 0, _
            "ptr*", 0, _
            "ptr", 0)
    If @error Or $aCall[0] Then
        Return SetError(1, 0, 0) ; DirectSoundCreate8 or call to it failed
    EndIf
    ; Collect
    Local $pDSound = $aCall[2]
    ; Define IDirectSound8 vTable methods
    Local $tagIDirectSound = "QueryInterface;" & _
            "AddRef;" & _
            "Release;" & _ ; IUnknown
            "CreateSoundBuffer;" & _
            "GetCaps;" & _
            "DuplicateSoundBuffer;" & _
            "SetCooperativeLevel;" & _
            "Compact;" & _
            "GetSpeakerConfig;" & _
            "SetSpeakerConfig;" & _
            "Initialize;" & _ ; IDirectSound
            "VerifyCertification;" ; IDirectSound8
    ; Wrapp IDirectSound8 interface
    $__DS_oIDirectSound8 = _AutoItObject_WrapperCreate($pDSound, $tagIDirectSound)
    ; Fill the structures
    DllStructSetData($__DS_tWAVEFORMATEX, "FormatTag", $WAVE_FORMAT_PCM)
    DllStructSetData($__DS_tWAVEFORMATEX, "Channels", $NUM_CHANNELS)
    DllStructSetData($__DS_tWAVEFORMATEX, "BitsPerSample", $BITS_PER_SAMPLE)
    DllStructSetData($__DS_tWAVEFORMATEX, "SamplesPerSec", $SAMPLING_RATE)
    DllStructSetData($__DS_tWAVEFORMATEX, "BlockAlign", $NUM_CHANNELS * $BITS_PER_SAMPLE / 8)
    DllStructSetData($__DS_tWAVEFORMATEX, "AvgBytesPerSec", $SAMPLING_RATE * $NUM_CHANNELS * $BITS_PER_SAMPLE / 8)
    DllStructSetData($__DS_tWAVEFORMATEX, "Size", 0)
    ; DSBUFFERDESC too
    DllStructSetData($__DS_tDSBUFFERDESC, "Size", DllStructGetSize($__DS_tDSBUFFERDESC))
    DllStructSetData($__DS_tDSBUFFERDESC, "Flags", BitOR($DSBCAPS_CTRLPOSITIONNOTIFY, $DSBCAPS_CTRLFREQUENCY, $DSBCAPS_GLOBALFOCUS))
    DllStructSetData($__DS_tDSBUFFERDESC, "Format", DllStructGetPtr($__DS_tWAVEFORMATEX))
    Local $aCall = $__DS_oIDirectSound8.SetCooperativeLevel("long", "hwnd", Number(_WinAPI_GetDesktopWindow()), "dword", $DSSCL_NORMAL)
    If Not IsArray($aCall) Or $aCall[0] Then
        $__DS_oIDirectSound8 = 0
        $__DS_tWAVEFORMATEX = 0
        $__DS_tDSBUFFERDESC = 0
        Return SetError(2, 0, 0) ; SetCooperativeLevel failed
    EndIf
    Return 1
EndFunc   ;==>_StartDSBeep

Func _StopDSBeep()
    $__DS_oIDirectSound8 = 0
    $__DS_tDSBUFFERDESC = 0
    $__DS_tWAVEFORMATEX = 0
EndFunc   ;==>_StopDSBeep

Func _Beep($iNote = 0, $iOctave = 4, $iDuration = 200, $iPause = 0, $nTempo = 1, $iTone = 0)
    If Not IsObj($__DS_oIDirectSound8) Then Return SetError(1, 0, 0)
    Local Static $nTempoLocal = $nTempo
    If @NumParams > 4 Then $nTempoLocal = $nTempo
    Local Static $iToneLocal = $iTone
    If @NumParams > 5 Then $iToneLocal = $iTone
    Local $iFrequency = 440 * 2 ^ (($iNote + $iToneLocal) / 12 + $iOctave + 1 / 6 - 4)
    $iDuration = $iDuration / $nTempoLocal
    Local $iSleep = $iPause / $nTempoLocal
    Local Const $DSBLOCK_ENTIREBUFFER = 2
    Local Const $DSBPLAY_LOOPING = 1
    Local Const $BITS_PER_SAMPLE = 16
    Local Const $NUM_CHANNELS = 2 ; stereo (no particular reason why)
    Local Const $SAMPLING_RATE = 44100
    ; Derived
    Local Const $SCALE = BitShift(1, -($BITS_PER_SAMPLE - 1)) - 1; Byrocracy... (http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.idirectsound8.idirectsound8.setcooperativelevel(VS.85).aspx)
    ; Zero
    Local $iHalfPeriod = Int($SAMPLING_RATE * $NUM_CHANNELS / (2 * $iFrequency))
    ; Limit
    If $iHalfPeriod < 1 Then $iHalfPeriod = 1
    ; Calculate buffer size
    Local $iBufferSize = Int(2 * $iHalfPeriod * $BITS_PER_SAMPLE / 8)
    ; Set buffer size
    DllStructSetData($__DS_tDSBUFFERDESC, "BufferBytes", $iBufferSize)
    ; Make SoundBuffer (http://msdn.microsoft.com/en-us/library/microsoft.directx_sdk.idirectsound8.idirectsound8.createsoundbuffer(VS.85).aspx)
    Local $aCall = $__DS_oIDirectSound8.CreateSoundBuffer("long", "ptr", Number(DllStructGetPtr($__DS_tDSBUFFERDESC)), "ptr*", 0, "ptr", 0)
    If Not IsArray($aCall) Or $aCall[0] Then
        Return SetError(2, 0, 0) ; CreateSoundBuffer failed
    EndIf
    ; Collect data
    Local $pDirectSoundBuffer = $aCall[3]
    ; Define IDirectSoundBuffer vTable methods
    Local $tagIDirectSoundBuffer = "QueryInterface;" & _
            "AddRef;" & _
            "Release;" & _ ; IUnknown
            "GetCaps;" & _
            "GetCurrentPosition;" & _
            "GetFormat;" & _
            "GetVolume;" & _
            "GetPan;" & _
            "GetFrequency;" & _
            "GetStatus;" & _
            "Initialize;" & _
            "Lock;" & _
            "Play;" & _
            "SetCurrentPosition;" & _
            "SetFormat;" & _
            "SetVolume;" & _
            "SetPan;" & _
            "SetFrequency;" & _
            "Stop;" & _
            "Unlock;" & _
            "Restore;" ; DirectSoundBuffer
    ; Wrapp IDirectSoundBuffer interface
    Local $oIDirectSoundBuffer = _AutoItObject_WrapperCreate($pDirectSoundBuffer, $tagIDirectSoundBuffer)
    ; Get frequency
    $aCall = $oIDirectSoundBuffer.GetFrequency("long", "dword*", 0)
    If Not IsArray($aCall) Then
        $oIDirectSoundBuffer = 0
        Return SetError(3, 0, 0) ; GetFrequency failed
    EndIf
    ; Collect data
    Local $iPlayFreq = $aCall[2]
    ; Correct input frequency (integer rounding)
    $iPlayFreq = $iPlayFreq * 2 * $iFrequency * $iHalfPeriod / ($SAMPLING_RATE * $NUM_CHANNELS)
    ; Set corrected frequency
    $aCall = $oIDirectSoundBuffer.SetFrequency("long", "dword", $iPlayFreq)
    ; Get pointer to buffer where audio is stored
    $aCall = $oIDirectSoundBuffer.Lock("long", "dword", 0, "dword", $iBufferSize, "ptr*", 0, "dword*", 0, "ptr", 0, "ptr", 0, "dword", $DSBLOCK_ENTIREBUFFER)
    If Not IsArray($aCall) Or $aCall[0] Then
        $oIDirectSoundBuffer = 0
        Return SetError(4, 0, 0) ; Lock
    EndIf
    ; Collect interesting data out of that call
    Local $pWrite = $aCall[4]
    Local $iLen = $aCall[5]
    ; Make writable buffer at thet address
    Local $tSoundBuffer = DllStructCreate("short[" & $iLen / 2 & "]", $pWrite)
    ; Write square wave (to get sound similar to onboard buzzer's)
    For $i = 1 To $iHalfPeriod ; First half is below 0
        DllStructSetData($tSoundBuffer, 1, -$SCALE, $i)
    Next
    For $i = $iHalfPeriod + 1 To $iLen / 2 ; Second is above
        DllStructSetData($tSoundBuffer, 1, $SCALE, $i)
    Next
    ; Unlock memory (will not check for errors from now on since it's just call, call, call... situation)
    $oIDirectSoundBuffer.Unlock("long", "ptr", $pWrite, "dword", $iLen, "ptr", 0, "dword", 0)
    ; Set current position to 0 (start)
    $oIDirectSoundBuffer.SetCurrentPosition("long", "dword", 0)
    ; Play the beep
    $oIDirectSoundBuffer.Play("long", "dword", 0, "dword", 0, "dword", $DSBPLAY_LOOPING)
    ; Sleep for duration
    Sleep($iDuration)
    ; Stop the beep
    $oIDirectSoundBuffer.Stop("long")
    ;Release object
    $oIDirectSoundBuffer = 0
    Sleep($iSleep)
    ; Return ok
    Return 1
EndFunc   ;==>_Beep

And then that last example could be (with ruined tempo):

#include "DSBeep.au3"

Opt("MustDeclareVars", 1)

HotKeySet("{ESC}", "_Quit")

; Error monitoring
Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc()
    ConsoleWrite("! COM Error !  Number: 0x" & Hex($oError.number, 8) & "   ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF)
    Return
EndFunc   ;==>_ErrFunc

; Initialize DSBeep
_StartDSBeep()

; Play
_Beep(8, 4, 100, 0, 0.8, 0) ; set tempo and tone
_Beep(7,4,100)
_Beep(8,4,100)
_Beep(9,4,100)
_Beep(8,4,100,100)
_Beep(1,5,100,100)

_Beep(8, 4, 100, 0, 1) ; new tempo
_Beep(7,4,100)
_Beep(8,4,100)
_Beep(9,4,100)
_Beep(8,4,100,100)
_Beep(12,4,100,100)

_Beep(8,4,100)
_Beep(7,4,100)
_Beep(8,4,100)
_Beep(9,4,100)
_Beep(8,4,100)

_Beep(6, 5, 100, 0, 0.8) ; new tempo
_Beep(3,5,100)
_Beep(12,4,100)
_Beep(8,4,100)
_Beep(6,4,100)
_Beep(5,4,100)
_Beep(4,4,200,300)

_Beep(1,5,100)
_Beep(12,4,100)
_Beep(11,4,100)
_Beep(9,4,100)
_Beep(1,5,100,100)
_Beep(6,5,100,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(8,4,100)
_Beep(1,5,100,100)

_Beep(4,5,100,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,100)
_Beep(3,4,100)
_Beep(7,4,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(4,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(3,5,250,250)

;===========================


_Beep(8, 4, 100, 0, 1.1) ; new tempo
_Beep(7, 4, 100)
_Beep(8, 4, 100)
_Beep(9, 4, 100)
_Beep(8, 4, 100, 100)
_Beep(1, 5, 100, 100)

_Beep(8, 4, 100)
_Beep(7, 4, 100)
_Beep(8, 4, 100)
_Beep(9, 4, 100)
_Beep(8, 4, 100, 100)
_Beep(12, 4, 100, 100)

_Beep(8, 4, 100)
_Beep(7, 4, 100)
_Beep(8, 4, 100)
_Beep(9, 4, 100)
_Beep(8, 4, 100)

_Beep(6, 5, 100)
_Beep(3, 5, 100)
_Beep(12, 4, 100)
_Beep(8, 4, 100)
_Beep(6, 4, 100)
_Beep(5, 4, 100)
_Beep(4, 4, 200, 300)

_Beep(1, 5, 100)
_Beep(12, 4, 100)
_Beep(11, 4, 100)
_Beep(9, 4, 100)
_Beep(1, 5, 100, 100)
_Beep(6, 5, 100, 100)
_Beep(4, 5, 100)
_Beep(3, 5, 100)
_Beep(1, 5, 100)
_Beep(8, 4, 100)
_Beep(1, 5, 100, 100)

_Beep(4, 5, 100, 100)
_Beep(4, 5, 100)
_Beep(3, 5, 100)
_Beep(1, 5, 100)
_Beep(3, 5, 100)

;=============================

_Beep(8, 4, 100)
_Beep(12, 4, 100)
_Beep(3, 5, 100)
_Beep(8, 5, 100)
_Beep(6, 5, 100)
_Beep(4, 5, 100)
_Beep(3, 5, 100)
_Beep(1, 5, 300, 200)

_Beep(3, 5, 100, 0, 1.8) ; new tempo
_Beep(1, 5, 100)
_Beep(12, 4, 100)
_Beep(11, 4, 100)
_Beep(4, 4, 100)
_Beep(8, 4, 100)
_Beep(11, 4, 100)
_Beep(4, 4, 100)
_Beep(8, 4, 100)
_Beep(11, 4, 100)
_Beep(12, 4, 100)
_Beep(1, 5, 150, 150)
_Beep(9, 4, 200, 100)
_Beep(3, 5, 100)
_Beep(1, 5, 100)
_Beep(12, 4, 100)
_Beep(11, 4, 100)
_Beep(3, 4, 100)
_Beep(6, 4, 100)
_Beep(11, 4, 100)
_Beep(3, 4, 100)
_Beep(6, 4, 100)
_Beep(11, 4, 100)
_Beep(12, 4, 100)
_Beep(1, 5, 150, 150)
_Beep(8, 4, 200, 100)

_Beep(4, 5, 100, 0, 1.1) ; new tempo
_Beep(3, 5, 100)
_Beep(6, 5, 100)
_Beep(4, 5, 100)
_Beep(3, 5, 100)
_Beep(1, 5, 100)
_Beep(4, 5, 100)
_Beep(3, 5, 100)
_Beep(1, 5, 100)
_Beep(11, 4, 100)
_Beep(3, 5, 150, 150)
_Beep(11, 4, 300, 100)

_Beep(3, 5, 100)
_Beep(1, 5, 100)
_Beep(4, 5, 100)
_Beep(3, 5, 100)
_Beep(1, 5, 100)
_Beep(11, 4, 100)
_Beep(3, 5, 100)
_Beep(1, 5, 100)
_Beep(11, 4, 100)
_Beep(9, 4, 100)
_Beep(11, 4, 400, 100)

_Beep(3, 5, 100, 0, 1.8) ; new tempo
_Beep(1, 5, 100)
_Beep(12, 4, 100)
_Beep(11, 4, 100)
_Beep(4, 4, 100)
_Beep(8, 4, 100)
_Beep(11, 4, 100)
_Beep(4, 4, 100)
_Beep(8, 4, 100)
_Beep(11, 4, 100)
_Beep(12, 4, 100)
_Beep(1, 5, 150, 150)
_Beep(9, 4, 200, 100)
_Beep(3, 5, 100)
_Beep(1, 5, 100)
_Beep(12, 4, 100)
_Beep(11, 4, 100)
_Beep(3, 4, 100)
_Beep(6, 4, 100)
_Beep(11, 4, 100)
_Beep(3, 4, 100)
_Beep(6, 4, 100)
_Beep(11, 4, 100)
_Beep(12, 4, 100)
_Beep(1, 5, 150, 150)
_Beep(8, 4, 150, 150)

_Beep(4, 5, 100, 0, 1.2) ; new tempo
_Beep(3, 5, 100)
_Beep(2, 5, 100)
_Beep(1, 5, 100)
_Beep(12, 4, 100)
_Beep(1, 5, 100)
_Beep(3, 5, 100)
_Beep(6, 5, 100)
_Beep(4, 5, 100)
_Beep(3, 5, 100)
_Beep(1, 5, 100)
_Beep(4, 5, 100)
_Beep(11, 4, 100)
_Beep(4, 5, 100)
_Beep(8, 5, 100)
_Beep(11, 5, 100, 0, 0.8) ; new tempo
_Beep(10, 5, 100)
_Beep(9, 5, 100)
_Beep(8, 5, 100)
_Beep(6, 5, 100)
_Beep(4, 5, 100)
_Beep(3, 5, 100)
_Beep(1, 5, 100)
_Beep(11, 4, 100)
_Beep(9, 4, 100, 0, 0.5) ; new tempo
_Beep(8, 4, 100)
_Beep(6, 4, 100, 0, 0.2) ; new tempo
_Beep(4, 4, 200)


; Stop the engine
_StopDSBeep()
; Exit (redundant)
_Quit()




Func _Quit()
    Exit
EndFunc   ;==>_Quit

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

May I suggest a little change?

that's quite a 'little' change haha :mellow:. Neat alternative though.

AZJIO: what about storing all the Beep sequences in an array (one for each song), and then just using a For...Next loop?

Edited by Ascend4nt

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

May I suggest a little change?

Thank you very much for this. It makes a big difference.

Now all that is left to do is to write Beethoven's brain. :mellow:

Edited by czardas

Share this post


Link to post
Share on other sites

It would be cool to have ability to change instruments. For example if I change lines 165-171 in DSBeep.au3 from

; Write square wave (to get sound similar to onboard buzzer's)
For $i = 1 To $iHalfPeriod ; First half is below 0
    DllStructSetData($tSoundBuffer, 1, -$SCALE, $i)
Next
For $i = $iHalfPeriod + 1 To $iLen / 2 ; Second is above
    DllStructSetData($tSoundBuffer, 1, $SCALE, $i)
Next

to

; Write sine wave (like beep on new x64 systems)
For $i = 1 To $iLen / 2
    DllStructSetData($tSoundBuffer, 1, $SCALE * Sin($i * 3.14159 / ($iHalfPeriod)), $i)
Next

...new instrument is made.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Lol:)


[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Another extremely useful feature would be to have the option to play chords. I don't really know the best way to do this without synchronizing several scripts running at the same time. Although: this is nothing more than a work around solution. It would be more convenient to have multiple voice options within one script. How to create several beeps at once, and keep them all synchronized? :mellow:

Edit: Although I imagine it would be possible to create chords by adding sine waves together, separate voices would be more useful. Having both options would be awesome.

Edited by czardas

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Jóhann Sebástian Bach - Prelude C-Major

Global $tempo=0.7
Global $Tone=0
HotKeySet("{ESC}", "_Quit")


_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,5,100)

_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,5,100)

_Beep(1,4,100)
_Beep(3,4,100)
_Beep(10,4,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(10,4,100)
_Beep(3,5,100)
_Beep(6,5,100)

_Beep(1,4,100)
_Beep(3,4,100)
_Beep(10,4,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(10,4,100)
_Beep(3,5,100)
_Beep(6,5,100)

_Beep(12,3,100)
_Beep(3,4,100)
_Beep(8,4,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(8,4,100)
_Beep(3,5,100)
_Beep(6,5,100)

_Beep(12,3,100)
_Beep(3,4,100)
_Beep(8,4,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(8,4,100)
_Beep(3,5,100)
_Beep(6,5,100)

_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,5,100)

_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,5,100)

_Beep(1,4,100)
_Beep(5,4,100)
_Beep(10,4,100)
_Beep(5,5,100)
_Beep(10,5,100)
_Beep(10,4,100)
_Beep(5,5,100)
_Beep(10,5,100)

_Beep(1,4,100)
_Beep(5,4,100)
_Beep(10,4,100)
_Beep(5,5,100)
_Beep(10,5,100)
_Beep(10,4,100)
_Beep(5,5,100)
_Beep(10,5,100)

_Beep(1,4,100)
_Beep(3,4,100)
_Beep(7,4,100)
_Beep(10,4,100)
_Beep(3,5,100)
_Beep(7,4,100)
_Beep(10,4,100)
_Beep(3,5,100)

_Beep(1,4,100)
_Beep(3,4,100)
_Beep(7,4,100)
_Beep(10,4,100)
_Beep(3,5,100)
_Beep(7,4,100)
_Beep(10,4,100)
_Beep(3,5,100)

_Beep(12,3,100)
_Beep(3,4,100)
_Beep(8,4,100)
_Beep(3,5,100)
_Beep(8,5,100)
_Beep(8,4,100)
_Beep(3,5,100)
_Beep(8,5,100)

_Beep(12,3,100)
_Beep(3,4,100)
_Beep(8,4,100)
_Beep(3,5,100)
_Beep(8,5,100)
_Beep(8,4,100)
_Beep(3,5,100)
_Beep(8,5,100)

_Beep(12,3,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)

_Beep(12,3,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)

_Beep(10,3,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)

_Beep(10,3,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(1,5,100)

_Beep(3,3,100)
_Beep(10,3,100)
_Beep(3,4,100)
_Beep(7,4,100)
_Beep(1,5,100)
_Beep(3,4,100)
_Beep(7,4,100)
_Beep(1,5,100)

_Beep(3,3,100)
_Beep(10,3,100)
_Beep(3,4,100)
_Beep(7,4,100)
_Beep(1,5,100)
_Beep(3,4,100)
_Beep(7,4,100)
_Beep(1,5,100)

_Beep(8,3,100)
_Beep(12,3,100)
_Beep(3,4,100)
_Beep(8,4,100)
_Beep(12,4,100)
_Beep(3,4,100)
_Beep(8,4,100)
_Beep(12,4,100)

_Beep(8,3,100)
_Beep(12,3,100)
_Beep(3,4,100)
_Beep(8,4,100)
_Beep(12,4,100)
_Beep(3,4,100)
_Beep(8,4,100)
_Beep(12,4,100)

_Beep(8,3,100)
_Beep(11,3,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(2,5,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(2,5,100)

_Beep(8,3,100)
_Beep(11,3,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(2,5,100)
_Beep(5,4,100)
_Beep(8,4,100)
_Beep(2,5,100)

_Beep(6,3,100)
_Beep(10,3,100)
_Beep(3,4,100)
_Beep(10,4,100)
_Beep(3,5,100)
_Beep(3,4,100)
_Beep(10,4,100)
_Beep(3,5,100)

_Beep(6,3,100)
_Beep(10,3,100)
_Beep(3,4,100)
_Beep(10,4,100)
_Beep(3,5,100)
_Beep(3,4,100)
_Beep(10,4,100)
_Beep(3,5,100)

_Beep(6,3,100)
_Beep(9,3,100)
_Beep(3,4,100)
_Beep(6,4,100)
_Beep(12,4,100)
_Beep(3,4,100)
_Beep(6,4,100)
_Beep(12,4,100)

_Beep(6,3,100)
_Beep(9,3,100)
_Beep(3,4,100)
_Beep(6,4,100)
_Beep(12,4,100)
_Beep(3,4,100)
_Beep(6,4,100)
_Beep(12,4,100)

_Beep(5,3,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(1,4,100)
_Beep(8,4,100)
_Beep(1,5,100)

_Beep(5,3,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(8,4,100)
_Beep(1,5,100)
_Beep(1,4,100)
_Beep(8,4,100)
_Beep(1,5,100)

_Beep(5,3,100)
_Beep(6,3,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(6,4,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(6,4,100)

_Beep(5,3,100)
_Beep(6,3,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(6,4,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(6,4,100)

_Beep(3,3,100)
_Beep(6,3,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(6,4,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(6,4,100)

_Beep(3,3,100)
_Beep(6,3,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(6,4,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(6,4,100)

_Beep(8,2,100)
_Beep(3,3,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(6,4,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(6,4,100)

_Beep(8,2,100)
_Beep(3,3,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(6,4,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(6,4,100)

_Beep(1,3,100)
_Beep(5,3,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(5,4,100)

_Beep(1,3,100)
_Beep(5,3,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(5,4,100)

_Beep(1,3,100)
_Beep(8,3,100)
_Beep(11,3,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(11,3,100)
_Beep(1,4,100)
_Beep(5,4,100)

_Beep(1,3,100)
_Beep(8,3,100)
_Beep(11,3,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(11,3,100)
_Beep(1,4,100)
_Beep(5,4,100)

_Beep(6,2,100)
_Beep(6,3,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(5,4,100)

_Beep(6,2,100)
_Beep(6,3,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(5,4,100)

_Beep(7,2,100)
_Beep(1,3,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(4,4,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(4,4,100)

_Beep(7,2,100)
_Beep(1,3,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(4,4,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(4,4,100)

_Beep(9,2,100)
_Beep(6,3,100)
_Beep(12,3,100)
_Beep(1,4,100)
_Beep(3,4,100)
_Beep(12,3,100)
_Beep(1,4,100)
_Beep(3,4,100)

_Beep(9,2,100)
_Beep(6,3,100)
_Beep(12,3,100)
_Beep(1,4,100)
_Beep(3,4,100)
_Beep(12,3,100)
_Beep(1,4,100)
_Beep(3,4,100)

_Beep(8,2,100)
_Beep(6,3,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(3,4,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(3,4,100)

_Beep(8,2,100)
_Beep(6,3,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(3,4,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(3,4,100)

_Beep(8,2,100)
_Beep(5,3,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(5,4,100)

_Beep(8,2,100)
_Beep(5,3,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(5,4,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(5,4,100)

_Beep(8,2,100)
_Beep(3,3,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(6,4,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(6,4,100)

_Beep(8,2,100)
_Beep(3,3,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(6,4,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(6,4,100)

_Beep(8,2,100)
_Beep(3,3,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(6,4,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(6,4,100)

_Beep(8,2,100)
_Beep(3,3,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(6,4,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(6,4,100)

_Beep(8,2,100)
_Beep(4,3,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(7,4,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(7,4,100)

_Beep(8,2,100)
_Beep(4,3,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(7,4,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(7,4,100)

_Beep(8,2,100)
_Beep(5,3,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(8,4,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(8,4,100)

_Beep(8,2,100)
_Beep(5,3,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(8,4,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(8,4,100)

_Beep(8,2,100)
_Beep(3,3,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(6,4,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(6,4,100)

_Beep(8,2,100)
_Beep(3,3,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(6,4,100)
_Beep(8,3,100)
_Beep(1,4,100)
_Beep(6,4,100)

_Beep(8,2,100)
_Beep(3,3,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(6,4,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(6,4,100)

_Beep(8,2,100)
_Beep(3,3,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(6,4,100)
_Beep(8,3,100)
_Beep(12,3,100)
_Beep(6,4,100)

_Beep(1,2,100)
_Beep(1,3,100)
_Beep(8,3,100)
_Beep(11,3,100)
_Beep(5,4,100)
_Beep(8,3,100)
_Beep(11,3,100)
_Beep(5,4,100)

_Beep(1,2,100)
_Beep(1,3,100)
_Beep(8,3,100)
_Beep(11,3,100)
_Beep(5,4,100)
_Beep(8,3,100)
_Beep(11,3,100)
_Beep(5,4,100)

_Beep(1,2,100)
_Beep(1,3,100)
_Beep(6,3,100)
_Beep(10,3,100)
_Beep(1,4,100)
_Beep(6,4,100)
_Beep(1,4,100)
_Beep(10,3,100)
_Beep(6,3,100)
_Beep(10,3,100)
_Beep(6,3,100)
_Beep(3,3,100)
_Beep(6,3,100)
_Beep(3,3,100)

_Beep(1,2,100)
_Beep(1,3,100)
_Beep(8,4,100)
_Beep(12,4,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(3,5,100)
_Beep(12,4,100)
_Beep(8,4,100)
_Beep(12,4,100)
_Beep(8,4,100)
_Beep(8,4,100)
_Beep(6,4,100)
_Beep(8,4,100)
_Beep(6,4,100)
_Beep(5,4,100)

_Beep(1,3,900)


Func _Beep($nota,$octave=4,$Duration=200,$pause=0)
    $Frequency=440*2^(($nota+$Tone)/12+$octave+1/6-4)
    Beep($Frequency, $Duration/$tempo)
    If $pause<>0 Then Sleep($pause/$tempo)
EndFunc

Func _Quit()
Exit
EndFunc

Polonaise. Oginsky

;Polonaise. Oginsky.

Global $tempo=0.7
Global $Tone=-12
HotKeySet("{ESC}", "_Quit")


_Beep(5,5,600)
_Beep(4,5,100)
_Beep(5,5,100)
_Beep(6,5,200)
_Beep(5,5,200)
_Beep(1,5,200)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,600)
_Beep(1,5,200)
_Beep(5,5,170,30)
_Beep(5,5,200)
_Beep(10,5,600)
_Beep(5,5,200)
_Beep(8,5,300)
_Beep(7,5,100)
_Beep(6,5,600)
_Beep(3,5,170,30)
_Beep(12,5,300)
_Beep(10,5,100)
_Beep(9,5,300)
_Beep(6,5,100)
_Beep(5,5,300)
_Beep(3,5,100)
_Beep(5,5,300)
_Beep(3,5,100)
_Beep(1,5,600)
_Beep(10,4,200)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(12,4,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(10,5,100)
_Beep(1,6,600)
_Beep(10,5,200)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(3,6,100)
_Beep(6,6,100)
_Beep(5,6,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(9,5,100)
_Beep(12,5,400)
_Beep(10,5,400)




;=========================



_Beep(5,6,600)
_Beep(4,6,100)
_Beep(5,6,100)
_Beep(6,6,200)
_Beep(5,6,200)
_Beep(1,6,300)
_Beep(12,5,100)
_Beep(10,5,600)
_Beep(1,6,200)
_Beep(5,6,170,30)
_Beep(5,6,200)
_Beep(10,6,600)
_Beep(5,6,200)
_Beep(8,6,300)
_Beep(7,6,100)
_Beep(6,6,600)
_Beep(3,5,170,30)
_Beep(12,5,300)
_Beep(10,5,100)
_Beep(9,5,300)
_Beep(6,5,100)
_Beep(5,5,300)
_Beep(3,5,100)
_Beep(5,5,300)
_Beep(3,5,100)
_Beep(1,5,600)
_Beep(10,4,200)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(12,4,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(10,5,100)
_Beep(1,6,600)
_Beep(10,5,200)

_Beep(12,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(3,6,100)
_Beep(6,6,100)
_Beep(5,6,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(9,5,100)
_Beep(12,5,400)
_Beep(10,5,350,50)



;=========================


_Beep(9,4,300)
_Beep(12,4,100)
_Beep(5,5,600)
_Beep(3,5,200)
_Beep(1,5,500)
_Beep(10,4,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(9,4,100)
_Beep(5,4,100)
_Beep(9,4,100)
_Beep(12,4,100)
_Beep(5,5,600)
_Beep(3,5,200)
_Beep(1,5,500)

_Beep(10,4,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(9,4,100)
_Beep(5,4,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(9,4,100)
_Beep(12,4,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(9,5,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(12,5,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(3,6,100)
_Beep(6,6,100)
_Beep(3,6,100)


;=========================


_Beep(5,6,570,30)
_Beep(5,6,170,30)
_Beep(5,6,170,30)
_Beep(5,6,170,30)
_Beep(5,6,570,30)
_Beep(5,6,170,30)
_Beep(5,6,370,30)
_Beep(5,6,650)
_Beep(4,6,50)
_Beep(5,6,50)
_Beep(6,6,350)
_Beep(5,6,100)
_Beep(1,6,300)
_Beep(12,5,100)
_Beep(10,5,600)
_Beep(1,6,200)
_Beep(5,6,170,30)
_Beep(5,6,200)
_Beep(10,6,600)
_Beep(5,6,200)
_Beep(8,6,300)
_Beep(7,6,100)
_Beep(6,6,600)
_Beep(3,6,170,30)
_Beep(12,5,300)
_Beep(10,5,100)
_Beep(9,5,300)
_Beep(6,5,100)
_Beep(5,5,300)
_Beep(3,5,100)
_Beep(5,5,300)
_Beep(3,5,100)
_Beep(1,5,600)
_Beep(10,4,200)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(12,4,100)
_Beep(3,5,100)
_Beep(6,5,100)
_Beep(5,5,100)
_Beep(3,5,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(10,4,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(10,5,100)

_Beep(1,6,600)
_Beep(10,5,200)

_Beep(12,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(3,6,100)
_Beep(6,6,100)
_Beep(5,6,100)
_Beep(3,6,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(9,5,100)
_Beep(12,5,400)
_Beep(10,5,350,50)



;=========================



_Beep(10,5,400,100)
_Beep(5,5,100)
_Beep(7,5,100)
_Beep(9,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(10,5,100)
_Beep(12,5,400,100)

_Beep(5,5,100)
_Beep(9,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(12,5,100)
_Beep(1,6,400,100)

_Beep(8,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(5,6,100)
_Beep(1,6,100)
_Beep(3,6,400,100)

_Beep(8,5,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(5,6,100)
_Beep(6,6,100)
_Beep(3,6,100)
_Beep(5,6,300)
_Beep(4,6,100)
_Beep(5,6,200)
_Beep(6,6,200)
_Beep(5,6,200)
_Beep(3,6,200)
_Beep(1,6,200)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(10,5,500,100)
_Beep(1,6,200)
_Beep(12,5,200)
_Beep(12,5,100)
_Beep(5,6,100)
_Beep(5,5,500,100)
_Beep(9,5,150)
_Beep(12,5,50)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(10,5,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(1,6,100)
_Beep(3,6,100)
_Beep(5,6,200)
_Beep(1,6,200)
_Beep(12,5,200)
_Beep(12,5,100)
_Beep(5,6,100)
_Beep(5,5,500,100)
_Beep(9,5,150)
_Beep(12,5,50)
_Beep(10,5,100)
_Beep(9,5,100)
_Beep(1,6,100)
_Beep(12,5,100)
_Beep(12,5,400)
_Beep(10,5,350,50)


Func _Beep($nota,$octave=4,$Duration=200,$pause=0)
    $Frequency=440*2^(($nota+$Tone)/12+$octave+1/6-4)
    Beep($Frequency, $Duration/$tempo)
    If $pause<>0 Then Sleep($pause/$tempo)
EndFunc

Func _Quit()
Exit
EndFunc

Edited by AZJIO

Share this post


Link to post
Share on other sites

Trancexx, I have been trying to figure out the following line of code in your _Beep function.

Local $iFrequency = 440 * 2 ^ (($iNote + $iToneLocal) / 12 + $iOctave + 1 / 6 - 4)

I wish to use frequencies that are not constant. Would this be right?

Local $iFrequency = $fMyFrequency*2^($iOctave - 1)

Does $iFrequency have to be an integer measure of hertz? Confused. :mellow:

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