hly-0.16: Haskell LilyPond

Safe HaskellSafe
LanguageHaskell98

Music.LilyPond.Light.Analysis

Contents

Synopsis

Basic traversal

m_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 -> Bool Source #

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 #

Temporal map

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

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

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

mm_start_times :: Temporal_Map -> Integer -> [(Rational, Rational, 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 :: Time_Signature -> Location -> Location Source #

Convert a location to normal form under given time signature.

type Locate_ST = (Time_Signature, Location) Source #

Type to thread state through location calculations.

st_set_part :: Locate_ST -> Part_ID -> Locate_ST Source #

Update state part number.

st_set_mode :: Locate_ST -> Locate_Mode -> Locate_ST Source #

Update state part number.

location_step :: Locate_ST -> Duration -> Locate_ST Source #

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.

locate' :: [Music] -> [LM] Source #

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_extract_part :: Part_ID -> [LV a] -> [LV a] Source #

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

Time-signature structure analysis.

ts_structure :: Music -> [[(Time_Signature, 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 -> a Source #

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 st Source #

transform_st :: ST_f st -> st -> Music -> ST_r st Source #

Repeats

Replace

note_replace_pitch :: Pitch -> Music -> Music Source #

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 -> Music Source #

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 -> Music Source #

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 String Source #

L.Notes in chords must not have duration.