Jump to content

_Beep


AZJIO
 Share

Recommended Posts

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:

That's one of the three things taken from AZJIO's function, so don't ask me "Honey"

... star fucker

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Yes and No.... A=440

No... For example $fMyFrequency=441.57

Beep(500.57, 1000) = Beep(500, 1000)

Posted Image

google >> 1.059463094

I'm not sure if you understand what I wish to do. I wish to use the overtone series. However I will also create some different variations of pitch. The pitch of a note will not necessarily be constant throughout the music. Edited by czardas
Link to comment
Share on other sites

Flageolets?

They are natural frequencies. But I will also alter the frequencies sometimes. I can't find my calculations.

Octave = 2 : 1

5th = 3 : 2

4th = 4 : 3

3rd = 5 : 4

4th + 5th = Octave

4/3 * 3/2 = 2/1

Tritone = 2 : 2^0.5 => artificial

I will look for my calculations but I need to work on them. I will change the frequencies when the music modulates to another key.

Edited by czardas
Link to comment
Share on other sites

AZJIO,

I'm surprised you haven't linked to your other version of '_Beep' that uses MIDI and the same calling convention. I'm referring to this post in the MIDI UDF thread of course.

Also, with my update to the basic MIDI UDF module, it works properly now on AutoIt v3.3.6+ and Win2000->Win7.

Link to comment
Share on other sites

Five new Irish melodic variations in 6/8 time. Requires DSBeep.au3 (from Trancexx) and AutoItObject.au3.

#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()

; Number 1
_Beep(3,5,450)
_Beep(5,5,150)
_Beep(3,5,150)
_Beep(5,5,150)
_Beep(12,4,450)
_Beep(10,4,150)
_Beep(10,4,150)
_Beep(10,4,150)
_Beep(8,4,450)
_Beep(10,4,150)
_Beep(12,4,150)
_Beep(10,4,150)
_Beep(8,4,450)
_Beep(10,4,150)
_Beep(12,4,150)
_Beep(1,5,150)
_Beep(10,4,450)
_Beep(8,4,150)
_Beep(10,4,100)
_Beep(8,4,100)
_Beep(10,4,100)
_Beep(12,4,450)
_Beep(1,5,150)
_Beep(12,4,150)
_Beep(1,5,150)
_Beep(1,5,450)
_Beep(12,4,450)
_Beep(10,4,450)
_Beep(8,4,450)
_Beep(3,5,450)
_Beep(5,5,150)
_Beep(3,5,150)
_Beep(5,5,150)
_Beep(12,4,450)
_Beep(10,4,150)
_Beep(10,4,150)
_Beep(10,4,150)
_Beep(8,4,450)
_Beep(10,4,150)
_Beep(12,4,150)
_Beep(10,4,150)
_Beep(8,4,450)
_Beep(10,4,150)
_Beep(12,4,150)
_Beep(1,5,150)
_Beep(10,4,450)
_Beep(8,4,150)
_Beep(10,4,100)
_Beep(8,4,100)
_Beep(10,4,100)
_Beep(12,4,450)
_Beep(1,5,150)
_Beep(12,4,150)
_Beep(1,5,150)
_Beep(1,5,450)
_Beep(12,4,450)
_Beep(10,4,900)

Sleep(3000)

; Number 2
_Beep(5,5,300)
_Beep(1,5,150)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,150)
_Beep(10,4,450)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,150)
_Beep(12,4,450)
_Beep(8,4,100)
_Beep(10,4,100)
_Beep(12,4,100)
_Beep(8,4,150)
_Beep(5,5,300)
_Beep(3,5,150)
_Beep(1,5,300)
_Beep(12,4,150)
_Beep(1,5,450)
_Beep(3,5,150)
_Beep(3,5,150)
_Beep(1,5,150)
_Beep(10,4,450)
_Beep(12,4,150)
_Beep(10,4,150)
_Beep(12,4,150)
_Beep(1,5,150)
_Beep(12,4,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(10,4,150)
_Beep(10,4,150)
_Beep(8,4,150)
_Beep(10,4,450)
_Beep(5,5,450)
_Beep(5,5,300)
_Beep(1,5,150)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(10,4,150)
_Beep(10,4,450)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(12,4,100)
_Beep(1,5,150)
_Beep(12,4,450)
_Beep(8,4,100)
_Beep(10,4,100)
_Beep(12,4,100)
_Beep(8,4,150)
_Beep(5,5,300)
_Beep(3,5,150)
_Beep(1,5,300)
_Beep(12,4,150)
_Beep(1,5,450)
_Beep(3,5,150)
_Beep(3,5,150)
_Beep(1,5,150)
_Beep(10,4,450)
_Beep(12,4,150)
_Beep(10,4,150)
_Beep(12,4,150)
_Beep(1,5,150)
_Beep(12,4,100)
_Beep(12,4,100)
_Beep(10,4,100)
_Beep(10,4,150)
_Beep(10,4,150)
_Beep(8,4,150)
_Beep(10,4,900)

Sleep(3000)

; Number 3
_Beep(12,4,300)
_Beep(10,4,150)
_Beep(12,4,450)
_Beep(1,5,150)
_Beep(3,5,150)
_Beep(5,5,150)
_Beep(3,5,450)
_Beep(1,5,450)
_Beep(5,5,450)
_Beep(8,4,150)
_Beep(12,4,150)
_Beep(1,5,150)
_Beep(5,5,450)
_Beep(3,5,300)
_Beep(12,4,150)
_Beep(10,4,450)
_Beep(12,4,150)
_Beep(1,5,150)
_Beep(12,4,150)
_Beep(10,4,150)
_Beep(8,4,300)
_Beep(10,4,150)
_Beep(12,4,150)
_Beep(10,4,150)
_Beep(12,4,300)
_Beep(1,5,150)
_Beep(10,4,450)
_Beep(8,4,450)
_Beep(12,4,300)
_Beep(10,4,150)
_Beep(12,4,450)
_Beep(1,5,150)
_Beep(3,5,150)
_Beep(5,5,150)
_Beep(3,5,450)
_Beep(1,5,450)
_Beep(5,5,450)
_Beep(8,4,150)
_Beep(12,4,150)
_Beep(1,5,150)
_Beep(5,5,450)
_Beep(3,5,300)
_Beep(12,4,150)
_Beep(10,4,450)
_Beep(12,4,150)
_Beep(1,5,150)
_Beep(12,4,150)
_Beep(10,4,150)
_Beep(8,4,300)
_Beep(10,4,150)
_Beep(12,4,150)
_Beep(10,4,150)
_Beep(12,4,300)
_Beep(1,5,150)
_Beep(10,4,900)

Sleep(3000)

; Number 4
_Beep(3,5,450)
_Beep(5,5,150)
_Beep(3,5,150)
_Beep(5,5,150)
_Beep(8,4,300)
_Beep(12,4,150)
_Beep(1,5,450)
_Beep(3,5,450)
_Beep(1,5,150)
_Beep(12,4,150)
_Beep(1,5,150)
_Beep(3,5,300)
_Beep(5,5,150)
_Beep(3,5,450)
_Beep(1,5,450)
_Beep(12,4,150)
_Beep(10,4,150)
_Beep(8,4,150)
_Beep(10,4,300)
_Beep(12,4,150)
_Beep(1,5,450)
_Beep(3,5,450)
_Beep(5,5,450)
_Beep(3,5,450)
_Beep(5,5,450)
_Beep(3,5,450)
_Beep(5,5,150)
_Beep(3,5,150)
_Beep(5,5,150)
_Beep(8,4,300)
_Beep(12,4,150)
_Beep(1,5,450)
_Beep(3,5,450)
_Beep(1,5,150)
_Beep(12,4,150)
_Beep(1,5,150)
_Beep(3,5,300)
_Beep(5,5,150)
_Beep(3,5,450)
_Beep(1,5,450)
_Beep(12,4,150)
_Beep(10,4,150)
_Beep(8,4,150)
_Beep(10,4,300)
_Beep(12,4,150)
_Beep(1,5,450)
_Beep(3,5,450)
_Beep(5,5,450)
_Beep(3,5,450)

Sleep(3000)

; Number 5
_Beep(10,4,300)
_Beep(8,4,150)
_Beep(10,4,450)
_Beep(12,4,150)
_Beep(1,5,300)
_Beep(3,5,150)
_Beep(1,5,300)
_Beep(12,4,150)
_Beep(10,4,300)
_Beep(10,4,150)
_Beep(12,4,300)
_Beep(1,5,450)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(3,5,150)
_Beep(1,5,450)
_Beep(12,4,150)
_Beep(1,5,300)
_Beep(12,4,450)
_Beep(1,5,150)
_Beep(3,5,300)
_Beep(3,5,150)
_Beep(5,5,300)
_Beep(5,5,150)
_Beep(3,5,300)
_Beep(1,5,450)
_Beep(8,4,450)
_Beep(10,4,300)
_Beep(8,4,150)
_Beep(10,4,450)
_Beep(12,4,150)
_Beep(1,5,300)
_Beep(3,5,150)
_Beep(1,5,300)
_Beep(12,4,150)
_Beep(10,4,300)
_Beep(10,4,150)
_Beep(12,4,300)
_Beep(1,5,450)
_Beep(12,4,100)
_Beep(1,5,100)
_Beep(5,5,100)
_Beep(3,5,150)
_Beep(1,5,450)
_Beep(12,4,150)
_Beep(1,5,300)
_Beep(12,4,450)
_Beep(1,5,150)
_Beep(3,5,300)
_Beep(3,5,150)
_Beep(5,5,300)
_Beep(5,5,150)
_Beep(3,5,300)
_Beep(1,5,450)

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

Func _Quit()
    Exit
EndFunc   ;==>_Quit
Edited by czardas
Link to comment
Share on other sites

nice. 5 stars

here my try to figure out how it works

for $i = 1 To 20
_Beep($i,5,500)
Next
for $i = 1 To 20
_Beep(12,$i,500)
Next
for $i = 1 To 20
_Beep($i,$i,500)
Next

Just idea for some more experienced. Make it Beep simpson's intro.

Edited by E1M1

edited

Link to comment
Share on other sites

hehe, there's a lot more where they came from! :P

for $i = 1 To 20
_Beep($i,5,500)
Next
for $i = 1 To 20
_Beep(12,$i,500)
Next
for $i = 1 To 20
_Beep($i,$i,500)
Next

There are only 12 notes in an octave, and the human ear can only hear about 10 octaves, I think. :mellow: Edited by czardas
Link to comment
Share on other sites

New Instant Jazz

#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()

;_Beep(3,4,900)
_Beep(5,4,200)
_Beep(8,4,100)
_Beep(11,4,100)
_Beep(10,4,100)
_Beep(8,4,100)
_Beep(5,4,150)
_Beep(8,4,150)
_Beep(10,4,150)
_Beep(11,4,150)
_Beep(12,4,150)
_Beep(3,5,150)
_Beep(12,4,900)
_Beep(11,4,200)
_Beep(10,4,100)
_Beep(8,4,100)
_Beep(10,4,100)
_Beep(11,4,100)
_Beep(10,3,150)
_Beep(8,3,150)
_Beep(8,4,900)
_Beep(5,4,200)
_Beep(3,4,100)
_Beep(12,3,100)
_Beep(3,4,100)
_Beep(5,3,100)
_Beep(8,3,150)
_Beep(5,4,150)
_Beep(8,4,150)
_Beep(10,3,150)
_Beep(8,3,150)
_Beep(5,5,150)
_Beep(11,3,100)
_Beep(10,3,200)
_Beep(8,3,300)
_Beep(5,3,100)
_Beep(8,3,200)
_Beep(8,3,100)
_Beep(5,3,100)
_Beep(8,3,100)
_Beep(10,3,100)
_Beep(8,3,200)
_Beep(10,3,300)
_Beep(8,3,100)
_Beep(5,3,200)
_Beep(8,3,100)
_Beep(5,3,100)
_Beep(8,3,100)
_Beep(5,4,900)
_Beep(8,4,100)
_Beep(5,4,200)
_Beep(3,4,100)
_Beep(12,3,100)
_Beep(3,4,100)
_Beep(5,4,300)
_Beep(3,4,300)
_Beep(12,3,200)
_Beep(3,4,100)
_Beep(11,3,100)
_Beep(10,3,200)
_Beep(8,3,300)
_Beep(5,3,100)
_Beep(8,3,200)
_Beep(8,3,100)
_Beep(5,3,100)
_Beep(8,3,100)
_Beep(10,3,100)
_Beep(8,3,200)
_Beep(10,3,300)
_Beep(8,3,100)
_Beep(5,3,200)
_Beep(8,3,100)
_Beep(5,3,100)
_Beep(8,3,100)
_Beep(5,4,900)
_Beep(8,4,100)
_Beep(5,4,200)
_Beep(3,4,100)
_Beep(12,3,100)
_Beep(3,4,100)
_Beep(5,4,300)
_Beep(3,4,300)
_Beep(12,3,200)
_Beep(3,4,100)
_Beep(8,3,300)
_Beep(5,3,300)
_Beep(12,4,150)
_Beep(12,4,150)
_Beep(11,4,300)
_Beep(10,4,300)
_Beep(8,4,100)
_Beep(5,4,200)
_Beep(3,4,300)
_Beep(8,3,300)
_Beep(8,4,300)
_Beep(5,4,100)
_Beep(5,3,100)
_Beep(8,3,100)
_Beep(10,3,600)
_Beep(10,3,600)
_Beep(11,3,150)
_Beep(12,3,150)
_Beep(3,4,100)
_Beep(8,4,100)
_Beep(10,4,100)
_Beep(11,3,600)
_Beep(10,3,100)
_Beep(5,3,100)
_Beep(8,3,100)
_Beep(10,3,100)
_Beep(8,3,200)
_Beep(10,3,100)
_Beep(8,3,100)
_Beep(11,3,100)
_Beep(10,3,900)
_Beep(11,3,200)
_Beep(12,3,100)
_Beep(3,4,100)
_Beep(8,3,100)
_Beep(5,3,200)
_Beep(8,3,100)
_Beep(10,3,200)
_Beep(8,3,200)

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

Func _Quit()
    Exit
EndFunc   ;==>_Quit
Edited by czardas
Link to comment
Share on other sites

This metronome can gradually increase speed in microseconds. The acceleration is capped at 1.5 times the original speed. It is useful for improving musical technique on any instrument. The accelerated rhythm setting should only be used for training exercises, such as scales. A standard setting should be used for practicing repertoire.

Requires DSBeep.au3 (see post number 13) and AutoItObject.au3.

#include<WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include "DSBeep.au3"

Opt("MustDeclareVars", 1)

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

Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc()
    MsgBox(0, "Error","µTempo just crashed")
    Exit
EndFunc

_StartDSBeep()

Local $hGUI = GUICreate("  µTempo", 122, 78, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP))
GUISetBkColor(0xFFFFE0, $hGUI)
Local $hBPM = GUICtrlCreateInput("110", 4, 6, 45, 20, $ES_READONLY)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1, 300, 30)
GUICtrlCreateLabel(" bpm", 52, 8, 40, 16)
Local $hCheck = GUICtrlCreateCheckbox(" Accel to 1.5 x  @", 8, 29, 104, 20)
Local $iMicroSecs= GUICtrlCreateInput("300", 4, 52, 44, 20, $ES_READONLY)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1, 999, 50)
GUICtrlCreateLabel("µs per beat", 54, 54, 60, 16)
Local $hGo = GUICtrlCreateButton("Go", 81, 6, 37, 20)
GUICtrlSetTip($hGo, "Press Esc to stop")

GUISetState()

Local $msg
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $hGo Then
        GUICtrlSetState ($hGo , $GUI_DISABLE)
        Local $iBpm = GUICtrlRead($hBPM)
        Local $iDelay = 60000/$iBpm
        Local $i = 1
        If BitAnd(GUICtrlRead($hCheck), $GUI_CHECKED) = $GUI_CHECKED Then
            Local $iDiff = 0
            Local $iDecrement = GUICtrlRead($iMicroSecs)/1000
            While $i = 1
                _Beep(1, 5, 20, $iDelay - 20 - $iDiff, 1)
                If $iDiff < $iDelay/3 Then $iDiff += $iDecrement
            Wend
        Else
            While $i = 1
                _Beep(1, 5, 20, $iDelay - 20, 1)
            Wend
        EndIf
    EndIf
WEnd

_StopDSBeep()

Func _stopMetronome()
    $i = 0
    GUICtrlSetState ($hGo , $GUI_ENABLE)
EndFunc

For some reason (unknown to me) it occasionally crashes when pressing the hotkey 'Esc' to stop the beat.

This issue has been fixed and the above code updated. Thanks to ProgAndy and Trancexx for creating the UDFs which I am using. And thanks to AZJIO for starting this thread. :blink:

Name changed to µTempo.

Edit

Oops, I forgot to give credit to the rest of the AutoItObject-Team - Monoceres and Kip.

Edited by czardas
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 year later...

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...