lambdasound-1.2.0: A libary for generating low-level sounds with high-level combinators
Safe HaskellSafe-Inferred
LanguageGHC2021

LambdaSound.Note

Description

This module has some functions to use sound notation concepts like semitones for pitch and quarternotes for duration

Synopsis

Semitones

newtype Semitone Source #

Semitones are tones like c4, d4 or c5. The semitone is used to determine the hz of the tone based on pitchStandard

Constructors

Semitone Int 

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

asNote :: (Hz -> a) -> Semitone -> a Source #

Transforms a function taking a Hz to one taking a Semitone. Should be used like the following:

asNote sineWave c4

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

halfNote :: 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

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