Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
This module has some functions to use sound notation concepts like semitones for pitch and quarternotes for duration
Synopsis
- newtype Semitone = Semitone Int
- pitchStandard :: Hz
- semitoneToHz :: Semitone -> Hz
- raiseSemitones :: Int -> Sound d Pulse -> Sound d Pulse
- diminishSemitones :: Int -> Sound d Pulse -> Sound d Pulse
- asNote :: (Hz -> a) -> Semitone -> a
- c1 :: Semitone
- d1 :: Semitone
- e1 :: Semitone
- f1 :: Semitone
- g1 :: Semitone
- a1 :: Semitone
- b1 :: Semitone
- c2 :: Semitone
- d2 :: Semitone
- e2 :: Semitone
- f2 :: Semitone
- g2 :: Semitone
- a2 :: Semitone
- b2 :: Semitone
- c3 :: Semitone
- d3 :: Semitone
- e3 :: Semitone
- f3 :: Semitone
- g3 :: Semitone
- a3 :: Semitone
- b3 :: Semitone
- c4 :: Semitone
- d4 :: Semitone
- e4 :: Semitone
- f4 :: Semitone
- g4 :: Semitone
- a4 :: Semitone
- b4 :: Semitone
- c5 :: Semitone
- d5 :: Semitone
- e5 :: Semitone
- f5 :: Semitone
- g5 :: Semitone
- a5 :: Semitone
- b5 :: Semitone
- c6 :: Semitone
- d6 :: Semitone
- e6 :: Semitone
- f6 :: Semitone
- g6 :: Semitone
- a6 :: Semitone
- b6 :: Semitone
- c7 :: Semitone
- d7 :: Semitone
- e7 :: Semitone
- f7 :: Semitone
- g7 :: Semitone
- a7 :: Semitone
- b7 :: Semitone
- wholeNote :: Duration
- halfNote :: Duration
- quarterNote :: Duration
- eightNote :: Duration
Semitones
Semitones are tones like c4
, d4
or c5
.
The semitone is used to determine the hz of the tone based on pitchStandard
Instances
Enum Semitone Source # | |
Num Semitone Source # | |
Show Semitone Source # | |
Eq Semitone Source # | |
Ord Semitone Source # | |
Defined in LambdaSound.Note |
pitchStandard :: Hz Source #
440 Hz is used at the pitch standard for the tone a4
semitoneToHz :: Semitone -> Hz Source #
Converts a semitone to the appropriate frequency based on pitchStandard
raiseSemitones :: Int -> Sound d Pulse -> Sound d Pulse Source #
Raise a sound by the given amount of semitones.
This only works for sounds which use the period length given
in the compute step of the sound. sineWave
works but noise
does not.
For example:
raiseSemitones 2 (asNote pulse c3) = asNote pulse d3
diminishSemitones :: Int -> Sound d Pulse -> Sound d Pulse Source #
Diminishes a sound by the given amount of semitones
Notes
wholeNote :: Duration Source #
These are durations for the corresponding note lenghts assuming 60 bpm.
If you know that a sound has 60 bpm, you can easily scale to
different bpm with scaleDuration
:
scaleDuration (wantedBPM / 60) soundWith60BPM
These are durations for the corresponding note lenghts assuming 60 bpm.
If you know that a sound has 60 bpm, you can easily scale to
different bpm with scaleDuration
:
scaleDuration (wantedBPM / 60) soundWith60BPM
quarterNote :: Duration Source #
These are durations for the corresponding note lenghts assuming 60 bpm.
If you know that a sound has 60 bpm, you can easily scale to
different bpm with scaleDuration
:
scaleDuration (wantedBPM / 60) soundWith60BPM
eightNote :: Duration Source #
These are durations for the corresponding note lenghts assuming 60 bpm.
If you know that a sound has 60 bpm, you can easily scale to
different bpm with scaleDuration
:
scaleDuration (wantedBPM / 60) soundWith60BPM