diff --git a/src/Audio/SoundFont/Gleitz.purs b/src/Audio/SoundFont/Gleitz.purs index d30e3c8..3dbbe1f 100644 --- a/src/Audio/SoundFont/Gleitz.purs +++ b/src/Audio/SoundFont/Gleitz.purs @@ -8,7 +8,7 @@ module Audio.SoundFont.Gleitz ( ) where -import Prelude (class Show, (<>), ($), (+), (-), (*), map, negate, show) +import Prelude (class Show, (<>), ($), (+), (*), map, negate, show) import Data.String.Regex as Regex import Data.String.Regex.Flags (noFlags) import Data.String (toUpper) @@ -95,7 +95,7 @@ midiPitch1 s = -- | The MIDI standard does not standardise on a particular middle C toMidiPitch :: Int -> Int -> Int -> Int toMidiPitch octave pitch accidental = - (12 * octave) + pitch + accidental - 12 + (12 * octave) + pitch + accidental + 12 lookupPitch :: Pitch -> Maybe Int lookupPitch p = diff --git a/test/Main.purs b/test/Main.purs index c88e9f5..03b8ef7 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -16,15 +16,15 @@ gleitzSuite :: forall t. Free (TestF t) Unit gleitzSuite = suite "gleitz" do test "midi pitch C4" do - Assert.equal 36 (midiPitch "C4") + Assert.equal 60 (midiPitch "C4") test "midi pitch Bb1" do - Assert.equal 10 (midiPitch "Bb1") + Assert.equal 34 (midiPitch "Bb1") test "midi pitch A#1" do - Assert.equal 10 (midiPitch "A#1") + Assert.equal 34 (midiPitch "A#1") test "midi pitch A4" do - Assert.equal 45 (midiPitch "A4") + Assert.equal 69 (midiPitch "A4") test "midi pitch C8" do - Assert.equal 84 (midiPitch "C8") + Assert.equal 108 (midiPitch "C8") main :: forall t. Eff