hs-pattrans-0.1.0.2: DSL for musical patterns and transformation, based on contravariant functors.

Safe HaskellNone
LanguageHaskell2010

Types

Synopsis

Documentation

type Time = Double Source #

Time in crochet beats.

type MIDI = Integer Source #

MIDI values are represented with integers.

type Interval = Integer Source #

Intervals are represented with integers (i.e. number of semitones).

data PatternGroup Source #

A pattern group is one of the patterns of a piece of music, identified by an expert or algorithm, and defined by a pattern prototype and other pattern occurences.

Constructors

PatternGroup 

Fields

type Pattern = [Note] Source #

A pattern is a sequence of notes.

data Note Source #

A simplistic music note (only time and pitch).

Constructors

Note 

Fields

Instances

Eq Note Source # 

Methods

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

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

Show Note Source # 

Methods

showsPrec :: Int -> Note -> ShowS #

show :: Note -> String #

showList :: [Note] -> ShowS #

(.@) :: MIDI -> Time -> Note Source #

Infix variant of the Note constructor.

(.@@) :: [Time] -> [MIDI] -> [Note] Source #

type MusicPiece = Pattern Source #

A piece of music is a huge pattern.

type Song = String Source #

Songs are identified with a string.

inverse :: Num a => [a] -> [a] Source #

Negate the values of a numeric list.

basePitch :: Pattern -> Maybe MIDI Source #

The base pitch of a pattern (the pitch of its first note). e.g. basePitch [(25,1), (27,2), (25,2.5)] = Just 25

pitch :: Pattern -> [MIDI] Source #

The (real) pitch structure of a pattern. e.g. pitch [(25,1), (27,2), (25,2.5)] = [25, 27, 25]

intervals :: Pattern -> [Interval] Source #

The (relative) pitch structure of a pattern. e.g. intervals [(25,1), (27,2), (25,2.5)] = [2, -2]

onsets :: Pattern -> [Time] Source #

The (real) rhythmic structure of a pattern. e.g. onset [(25,1), (27,2), (25,2.5)] = [1, 2, 2.5]

durations :: Pattern -> [Time] Source #

The (relative) rhythmic structure of a pattern. e.g. rhythm [(25,1), (27,2), (25,2.5)] = [1, 0.5]

normalRhythm :: Pattern -> [Time] Source #

Normalized (relative) rhythmic structure of a pattern. e.g. normalRhythm [(A,2), (C#,6), (Eb,8), (B,1), (A,2)] = [1, 3, 4, 1/2, 1]

translateH :: Time -> Note -> Note Source #

Translate a note horizontally (in time). e.g. translateH (-0.5) [(25,1), (27,2), (25,2.5)] = [(25,0.5), (27,1.5), (25,2)]

translateV :: Interval -> Note -> Note Source #

Translate a note vertically (in pitch). e.g. translateV (-20) [(25,1), (27,2), (25,2.5)] = [(5,1), (7,2), (5,2.5)]

pairs :: [a] -> [(a, a)] Source #

Get list as pairs of consecutive elements. e.g. pairs [a, b, c, d] = [(a, b), (b, c), (c, d)]

pmap :: (a -> b) -> [a] -> [b] Source #

Parallel map.

pforM :: Traversable t => t a -> (a -> IO b) -> IO (t b) Source #

Parallel forM.

pmapM :: Traversable t => (a -> IO b) -> t a -> IO (t b) Source #

Parallel mapM.