Jump to content

NoteToFrequency function


jvanegmond
 Share

Recommended Posts

Syntax:

Note (A-G) & Modifier (# || b ) & Scale (0-9)

Example code on how to use this:

; Displays the entire fourth scale in several message boxes.
MsgBox(0, "Note: C4", NoteToFreq("C4"))
MsgBox(0, "Note: C#4 & Db4", NoteToFreq("C#4") & @CRLF & NoteToFreq("Db4"))
MsgBox(0, "Note: D4", NoteToFreq("D4"))
MsgBox(0, "Note: D#4 & Eb4", NoteToFreq("D#4") & @CRLF & NoteToFreq("Eb4"))
MsgBox(0, "Note: E4", NoteToFreq("E4"))
MsgBox(0, "Note: F4", NoteToFreq("F4"))
MsgBox(0, "Note: F#4 & Gb4", NoteToFreq("F#4") & @CRLF & NoteToFreq("Gb4"))
MsgBox(0, "Note: G4", NoteToFreq("G4"))
MsgBox(0, "Note: G#4 & Ab4", NoteToFreq("G#4") & @CRLF & NoteToFreq("Ab4"))
MsgBox(0, "Note: A4", NoteToFreq("A4"))
MsgBox(0, "Note: A#4 & Bb4", NoteToFreq("A#4") & @CRLF & NoteToFreq("Bb4"))
MsgBox(0, "Note: B4", NoteToFreq("B4"))
; Displays the entire fifth scale in several message boxes.
MsgBox(0, "Note: C5", NoteToFreq("C5"))
MsgBox(0, "Note: C#5 & Db5", NoteToFreq("C#5") & @CRLF & NoteToFreq("Db5"))
MsgBox(0, "Note: D5", NoteToFreq("D5"))
MsgBox(0, "Note: D#5 & Eb5", NoteToFreq("D#5") & @CRLF & NoteToFreq("Eb5"))
MsgBox(0, "Note: E5", NoteToFreq("E5"))
MsgBox(0, "Note: F5", NoteToFreq("F5"))
MsgBox(0, "Note: F#5 & Gb5", NoteToFreq("F#5") & @CRLF & NoteToFreq("Gb5"))
MsgBox(0, "Note: G5", NoteToFreq("G5"))
MsgBox(0, "Note: G#5 & Ab5", NoteToFreq("G#5") & @CRLF & NoteToFreq("Ab5"))
MsgBox(0, "Note: A5", NoteToFreq("A5"))
MsgBox(0, "Note: A#5 & Bb5", NoteToFreq("A#5") & @CRLF & NoteToFreq("Bb5"))
MsgBox(0, "Note: B5", NoteToFreq("B5"))oÝ÷ Ø Ý¶ºw-ÚºÚ"µÍ[ÈÝUÑJ    ÌÍÑ[ÝJBSØØ[   ÌÍÓÝK   ÌÍÓ[Ù   ÌÍÓYSØØ[ÛÛÝ ÌÍØHHKÌLBRYÝ[Ó[   ÌÍÑ[ÝJHH[BIÌÍÓÝHHÝ[ÓY
    ÌÍÑ[ÝKJBBIÌÍÓYHÝ[ÔYÚ
    ÌÍÑ[ÝKJBQ[ÙRYÝ[Ó[    ÌÍÑ[ÝJHHÈ[BIÌÍÓÝHHÝ[ÓY
    ÌÍÑ[ÝKJBBIÌÍÓ[ÙHÝ[ÓZY
    ÌÍÑ[ÝKJBBIÌÍÓYHÝ[ÔYÚ
    ÌÍÑ[ÝKJBQ[ÙBBTÙ]ÜJBBT]Q[YSØØ[  ÌÍÜÝIÌÍÜÝOH
IÌÍÓY
H
LRY ÌÍÓ[ÙH  ][ÝÈÉ][ÝÈ[BIÌÍÜÝ
ÏHBQ[ÙRY  ÌÍÓ[ÙH  ][ÝØ][ÝÈ[BIÌÍÜÝOHBQ[YTÙ[XÝBPØÙH ÌÍÓÝHH  ][ÝÐI][ÝÂBBIÌÍÜÝ
ÏHBPØÙH  ÌÍÓÝHH  ][ÝÐ][ÝÂBBIÌÍÜÝ
ÏHBPØÙH  ÌÍÓÝHH  ][ÝÐÉ][ÝÂBBIÌÍÜÝOHBBPØÙH ÌÍÓÝHH  ][ÝÑ  ][ÝÂBBIÌÍÜÝOH
ÂBPØÙH   ÌÍÓÝHH  ][ÝÑI][ÝÂBBIÌÍÜÝOH
BBPØÙH    ÌÍÓÝHH  ][ÝÑ][ÝÂBBIÌÍÜÝOH
BPØÙH ÌÍÓÝHH  ][ÝÑÉ][ÝÂBBIÌÍÜÝOHBPØÙH[ÙBBBTÙ]ÜBBBT]Q[Ù[XÝSØØ[   ÌÍÙ]Y[ÞHH


ÌÍØWÌÍÜÝT]   ÌÍÙ]Y[ÞB[[

Please find any mistakes and post them. If you don't like the efficiency of this thing, rewrite it yourself and make it faster or do more error checking, I am not interested in neither. If you do post, and you like the function, please leave a thank you to let me know who I made this for. Thank you.

Link to comment
Share on other sites

Most likely the first toneladder ever played in AutoIt through a internal speaker.

#include <NoteToFreq.au3>
For $ladder = 3 to 6
    Beep(NoteToFreq("C"&$ladder),150)
    Beep(NoteToFreq("D"&$ladder),150)
    Beep(NoteToFreq("E"&$ladder),150)
    Beep(NoteToFreq("F#"&$ladder),150)
    Beep(NoteToFreq("G"&$ladder),150)
    Beep(NoteToFreq("A"&$ladder),150)
    Beep(NoteToFreq("B"&$ladder),150)
NextoÝ÷ Øw«{lj«¢rGÚ+;¬·
èµçè®Øb³
âµì!jܨ»§¶Ú!yªÚÛazzkzË-åâØ^¶kmrçz»ajجæjYrºÇ¶¥¢Ç¯+.µ«­¢+Ø¥¹±Õ±Ðí9½ÑQ½ÉĹÔÌÐì)U%
ÉÑ ÅÕ½Ðí9½ÑU$ÅÕ½Ðì°ØÈÈ°ÐÐà°ÄäÈ°ÄÈÔ¤(ÀÌØí%¹ÁÕÐÄôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°À°À°ØÈÄ°ÐÐؤ)U%MÑMÑÑ ¤)]¡¥±Ä(%%Õ¥Ñ5Í ¤ô´ÌQ¡¸($$ÀÌØí9½ÑôMÑÉ¥¹MÁ±¥Ð¡U%
ÑɱI ÀÌØí%¹ÁÕÐĤ°ÅÕ½ÐìÅÕ½Ðì¤($%½ÈÀÌØíàôÄѼÀÌØí9½ÑlÁt($$% À¡9½ÑQ½ÉÄ ÀÌØí9½ÑlÀÌØíát¤°ÄÔÀ¤($%9áÐ(%¹%)]¹
Edited by Manadar
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...