tcalculus-1.0.0: A DSL prototype for structured realtime/reactive functional programing

Copyright(c) David Janin, 2017
Licensesee the LICENSE file in the distribution
Maintainerjanin@labri.fr
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

TScore.Midi

Description

This module provides basic definitions for midi music

Synopsis

Documentation

data PitchClass Source #

Type enumerating some pitch classes (ordered in perfect fiths)

Constructors

Fbb 
Cbb 
Gbb 
Dbb 
Abb 
Ebb 
Bbb 
Fb 
Cb 
Gb 
Db 
Ab 
Eb 
Bb 
F 
C 
G 
D 
A 
E 
B 
Fs 
Cs 
Gs 
Ds 
As 
Es 
Bs 
Fss 
Css 
Gss 
Dss 
Ass 
Ess 
Bss 
Fsss 
Csss 
Gsss 

pitchClassToPitch :: PitchClass -> MidiPitch Source #

Converts pitchclass into midi pitch from 0 (C) to 11 (B)

pitchClassAndScaleToPitch :: PitchClass -> Int -> MidiPitch Source #

Converts pitchclass and scale number into midi pitch (A0 = 22, C1 = 24)

pitchToPitchClass :: MidiPitch -> PitchClass Source #

Converts midi pitch into pitchClass (from C to A sharp)

type MidiPitch = Int Source #

Type defining the pitch in MIDI

type Channel = Int Source #

Type defining the MIDI channel

type Velocity = Int Source #

Type defining the velocity of the MIDI note

data Midi Source #

Type defining a Midi value

Instances

Eq Midi Source #

Definition of equality in midi

Methods

(==) :: Midi -> Midi -> Bool #

(/=) :: Midi -> Midi -> Bool #

Ord Midi Source #

Definition of order in midi (compares pitches)

Methods

compare :: Midi -> Midi -> Ordering #

(<) :: Midi -> Midi -> Bool #

(<=) :: Midi -> Midi -> Bool #

(>) :: Midi -> Midi -> Bool #

(>=) :: Midi -> Midi -> Bool #

max :: Midi -> Midi -> Midi #

min :: Midi -> Midi -> Midi #

Show Midi Source # 

Methods

showsPrec :: Int -> Midi -> ShowS #

show :: Midi -> String #

showList :: [Midi] -> ShowS #

POrd Midi Source #

Definition of porder in midi

(Eq d, Num d, Lattice d) => Tilable d Midi Source #

Midi values are tilable

Methods

duration :: Midi -> d Source #

stretch :: d -> Midi -> Midi Source #

Updatable Midi d iv Source #

No update needed

Methods

update :: UpdateData d iv -> Midi -> Midi Source #

type EventMidi = Event Midi Source #

Alias for an event carrying a Midi message

type Tone = MidiPitch Source #

Types denoting a tone

type ScalePattern = [Int] Source #

Type defining the direction of a tranposition data Direction = Lower | Upper deriving (Show, Enum, Eq)

Type denoting the pattern of a scale in semi-tones. For example:

>>> major pattern
majorP = [2,2,1,2,2,2,1]
>>> minor pattern
minorP = [2,1,2,2,1,2,2]
>>> tone pattern
toneP  = [2,2,2,2,2]
>>> diminished pattern
dimP = [2,1,2,1,2,1,2,1]

majorP :: ScalePattern Source #

Major scale pattern

betweenP :: ScalePattern Source #

Between scale pattern

minorP :: ScalePattern Source #

Minor scale pattern

toneP :: ScalePattern Source #

Tone scale pattern

chromaticP :: ScalePattern Source #

Half-tone (or chromatic) scale pattern

dimP :: ScalePattern Source #

Diminished scale pattern

pentatonicP :: ScalePattern Source #

Diminished scale pattern

alteredP :: ScalePattern Source #

Altered scale pattern

rotateP :: ScalePattern -> NumMode -> ScalePattern Source #

Rotates a scaler patterns according to a mode nummber

sizeP :: ScalePattern -> Int Source #

Size of a pattern octave (in semitones)

data Scale Source #

Type denoting a scale

note :: Scale -> Int -> MidiPitch Source #

Nth note of a scale

major :: PitchClass -> Scale Source #

Major scales

between :: PitchClass -> Scale Source #

Between scales

majorMode :: PitchClass -> NumMode -> Scale Source #

Major mode scales (ex: D Dorian is majorMode C II)

minor :: PitchClass -> Scale Source #

Minor scales

minorMode :: PitchClass -> NumMode -> Scale Source #

Minor mode scales

tone :: PitchClass -> Scale Source #

Tone scales

pentatonic :: PitchClass -> Scale Source #

Pentatonic scales

altered :: PitchClass -> Scale Source #

Altered scales

chromatic :: PitchClass -> Scale Source #

Chromatic scales

dim :: PitchClass -> Scale Source #

Diminished scales

scale :: PitchClass -> ScaleType -> Scale Source #

Scale out of scale type and pitchClass

noteInScale :: Scale -> Midi -> Midi Source #

Moves a pitch to the nearest higher picth in a given scale

transpose :: Scale -> Int -> Midi -> Midi Source #

Diatonic transpose given scale and interval (in Int)

toScale :: MidiPitch -> MidiPitch -> Midi -> Midi Source #

Moves to a given scale range

pitchShift :: MidiPitch -> Midi -> Midi Source #

Chromatic pitch transpose