Module

Data.Abc.Tempo

Package
purescript-abc-parser
Repository
newlandsvalley/purescript-abc-parser

Conversion functions for Tempo.

#MidiTick Source

type MidiTick = Int

A MIDI tick - used to give a note duration.

#AbcTempo Source

type AbcTempo = { bpm :: Int, tempoNoteLength :: Rational, unitNoteLength :: Rational }

The tempo when the tune is being played. This is usually represented as (for example) 1/4 = 120 - i.e. 120 querter notes per minute. this is a consolidation of both the Tempo and the Unit Note length which thus encapsulates everything you need to calculate the overall tempo of the tune

tempoNoteLength - the note length of a tempo definition bpm - the beats per minute of a tempo Definition unitNoteLength - the length of a 'unit note' in the ABC definition

#defaultTempo Source

defaultTempo :: TempoSignature

The default Tempo - 1/4=120.

#defaultAbcTempo Source

defaultAbcTempo :: AbcTempo

default to 1/4=120 with eighth notes as the default note length this works out that an eighth notes last for 1/4 second

#getAbcTempo Source

getAbcTempo :: AbcTune -> AbcTempo

Get the ABC tempo from the tune

#midiTempo Source

midiTempo :: AbcTempo -> Int

The MIDI tempo measured in microseconds per beat. JMW!!! check

#beatsPerSecond Source

beatsPerSecond :: AbcTempo -> Rational

calculate the number of beats per second given by an ABC tempo to give a simple indication of the tempo of the overall melody note that this is independent of the unit note length

#getBpm Source

getBpm :: AbcTune -> Int

Get the tempo of the tune in beats per minute from the tunes header (if it exists) or the default of 120 if it does not.

#setBpm Source

setBpm :: Int -> AbcTune -> AbcTune

Change the tempo of the tune by altering the beats per minute (bpm) in the tune's tempo header (if it exists) or by altering a newly incorporated default tempo if not.

#standardMidiTick Source

standardMidiTick :: MidiTick

A standard MIDI tick - we use 1/4 note = 480 ticks. this is known as 'ticks per quarter note' or 'parts per quarter' in MIDI literature, 480 tends to be standard.

#noteTicks Source

noteTicks :: Rational -> MidiTick

Assume a standard unit note length of 1/4 and a standard number of ticks per unit (1/4) note of 480.

#chordalNoteTicks Source

chordalNoteTicks :: Rational -> Rational -> MidiTick

Find the MIDI duration of a note within a chord in standard ticks (1/4 note == 480 ticks)