Last active
August 29, 2015 14:11
-
-
Save Thorium/f5954ddcdf305e9c1cfb to your computer and use it in GitHub Desktop.
Musical Note Frequencies: With the usual Western music it is common to use the Equal temperament: http://en.wikipedia.org/wiki/Equal_temperament http://hyperphysics.phy-astr.gsu.edu/hbase/music/et.html Then the note frequencies are calculated by this formula. For more information: http://en.wikipedia.org/wiki/Pitch_(music) http://en.wikipedia.or…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// (Infinite) list of note-frequency -pairs | |
let tones = | |
let bass = 55.0 | |
let octave = ["A"; "A#"; "B"; "C"; "C#"; "D"; "D#"; "E"; "F"; "F#"; "G"; "G#"] | |
let notes = seq { while true do yield! octave } | |
let frequency = bass |> Seq.unfold (fun x -> Some (x, x*System.Math.Pow(2.0, 1.0 / 12.0))) | |
Seq.zip notes frequency | |
//let ``guitar open A`` = tones |> Seq.nth 24 // val it : float * string = (220.0, "A") | |
//let ``A to F#`` = tones |> Seq.skip 36 |> Seq.take 10 |> Seq.toArray | |
// [|("A", 440.0); ("A#", 466.1637615); ("B", 493.8833013); ("C", 523.2511306); | |
// ("C#", 554.365262); ("D", 587.3295358); ("D#", 622.2539674); | |
// ("E", 659.2551138); ("F", 698.4564629); ("F#", 739.9888454)|] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment