hly-0.1: Haskell LilyPond

Music.LilyPond.Light.Analysis

Contents

Synopsis

Documentation

Basic traversal

traverse :: (Music -> a) -> Music -> [a]Source

Apply a function to all elements and collect results in a list.

collect_entries :: (Music -> Bool) -> Music -> [Music]Source

Collect all elements of a given type.

Basic statistical analysis

Basic pitch analysis

has_pitch :: Music -> BoolSource

Does music element contain one or more pitches?

collect_pitches_no_grace :: Music -> [Pitch]Source

Collect pitches from a note or chord or join of such.

collect_pitches :: Music -> [Pitch]Source

Collect pitches from a note, chord, or grace note.

note_seq :: Music -> [Music]Source

Collect note sequence, filters tied notes.

Frequency analysis utilites

freq_anal_by :: Ord a => (a -> a -> Ordering) -> [a] -> [(Int, a)]Source

freq_anal :: Ord a => [a] -> [(Int, a)]Source

Durations

apply_dots :: Rational -> Integer -> RationalSource

Apply d dots to the rational pulse count n.

dur_pulses :: TimeSignature -> Duration -> RationalSource

Convert a duration to a pulse count in relation to the indicated time signature.

pulse_duration :: TimeSignature -> TempoMarking -> RSource

The duration, in seconds, of a pulse at the indicated time signaure and tempo marking.

measure_duration :: TimeSignature -> TempoMarking -> RSource

The duration, in seconds, of a measure at the indicated time signaure and tempo marking.

Temporal map

mm_durations :: Temporal_Map -> Integer -> [(R, Integer)]Source

Return duration (in seconds) and pulse counts for n measures.

integrate :: Num a => [a] -> [a]Source

mm_start_times :: Temporal_Map -> Integer -> [(R, R, Integer)]Source

Return start time and duration (in seconds) and pulse counts for i measures.

Temporal annotations

data Location Source

Data type representing the location of a musical element.

Constructors

Location 

location_nf :: TimeSignature -> Location -> LocationSource

Convert a location to normal form under given time signature.

type Locate_ST = (TimeSignature, Location)Source

Type to thread state through location calculations.

st_set_part :: Locate_ST -> Part_ID -> Locate_STSource

Update state part number.

st_set_mode :: Locate_ST -> Locate_Mode -> Locate_STSource

Update state part number.

location_step :: Locate_ST -> Duration -> Locate_STSource

Step location state by duration.

type LM = (Location, Music)Source

Located music

type LV a = (Location, a)Source

Located value

locate_st :: Locate_ST -> Music -> (Locate_ST, [LM])Source

State threading form of location calculations. Currently, nested polyphonic parts generate duplicate IDs (?)

locate :: Music -> [LM]Source

Run location calculations.

lv_located_parts :: [LV a] -> [Part_ID]Source

Extract list of part identifiers.

lv_group_parts :: [LV a] -> [[LV a]]Source

lv_from_measure :: Integer -> [LV a] -> [LV a]Source

Drop n measures.

lv_group_measures :: [LV a] -> [[LV a]]Source

lv_sort :: [LV a] -> [LV a]Source

Time-signature structure analysis.

ts_rewrite :: Integer -> TimeSignature -> TimeSignatureSource

Rewrite time signature to indicated denominator.

ts_sum :: [TimeSignature] -> TimeSignatureSource

Sum time signatures (ie. 316 and 12 sum to 11/16).

ts_structure :: Music -> [[(TimeSignature, Integer)]]Source

Time signature structure of music.

structure_unfold' :: Integral i => [(a, i)] -> [a]Source

structure_unfold :: Integral i => [(a, i)] -> [Maybe a]Source

map_lookup :: Ord i => [(i, a)] -> i -> aSource

Keys are in ascending order, the value retrieved is the that with the greatest key less than or equal to the key requested.

Tempo

Key/value utilties

kv_group_by :: Ord c => (a -> c) -> [(a, b)] -> [[(a, b)]]Source

kv_collate :: Ord k => (a -> k) -> (a -> v) -> [a] -> [(k, [v])]Source

kv_collate' :: Ord k => [(k, v)] -> [(k, [v])]Source

kv_filter :: (k -> Bool) -> (v -> Bool) -> [(k, v)] -> [(k, v)]Source

Filter with predicates at key and value.

kv_map :: (k -> k') -> (v -> v') -> [(k, v)] -> [(k', v')]Source

Apply functions to keys and values.

Measure collation

Transformation

type ST_r st = (st, Music)Source

type ST_f st = st -> Music -> ST_r stSource

transform_st :: ST_f st -> st -> Music -> ST_r stSource

Repeats

Replace

note_replace_pitch :: Pitch -> Music -> MusicSource

Replace the pitch of note element n1 with that of n0.

replace_notes_fn :: (a -> Pitch) -> [a] -> Music -> ([a], Music)Source

replace_notes_p :: [Pitch] -> Music -> MusicSource

Replaces notes with indicated pitches, rhythms and annotations are not replaced. Tied notes do not use multiple pitches from the input sequence.

Insert

insert_after_notes :: [Maybe Music] -> Music -> MusicSource

Inserts a value after each note as indicated.

Tied notes

discard_tied_notes_pr :: (a -> Bool) -> (a -> Bool) -> [a] -> [a]Source

Spelling

Validation

v_chord_note_valid :: Music -> Maybe StringSource

Notes in chords must not have duration.