HarmTrace-Base-1.0.0.2: Parsing and unambiguously representing musical chords.

Portabilitynon-portable
Stabilityexperimental
Maintainerbas@chordify.net, dreixel@chordify.net
Safe HaskellSafe-Inferred

HarmTrace.Base.MusicTime

Contents

Description

Summary: A set of types and classes for representing musical time, mainly (but not necessarily) in the context of recognising chords from an arbitrary audio source.

Synopsis

Datatypes

Types for representing Chords and their probabilities

type ChordAnnotation = [TimedData ProbChord]Source

A chord annotation consists of a list with chords and segment boundaries.

data ProbChordSeg Source

Clustering ProbChords in a collection of chords that share a key

Constructors

Segment 

data ProbChord Source

Combines a ChordLabel with a probability.

Constructors

ProbChord 

data ChordCand Source

A chord candidate: an intermediate datatype that matches shorthand, chord structure and root note (plus inversion)

Representing musical time

data TimedData a Source

A datatype that wraps around an (musical) datatype, adding information about the musical time to this datatype. Musical time is stored as a list of BarTime time stamps that can optionally be augmented with information about the Beat position of the particular time stamp inside the bar.

Constructors

TimedData 

Fields

getData :: a

Returns the contained datatype

getTimeStamps :: [BarTime]

Returns the list of TimeStamps

Instances

data Beat Source

For now, we fix the number of available beats to four, because this is also hard-coded into the bar and beat-tracker.

Constructors

One 
Two 
Three 
Four 
NoBeat 

Instances

data BarTime Source

Represents a musical time stamp, which is a NumData possibly augmented with a Beat denoting the position of the time stamp within a bar.

type NumData = DoubleSource

A type synonym is defined for our main numerical representation, this allows us to easily change the precision.

Representing raw audio data

data ChordinoLine Source

Represents two chroma features and a time stamp.

Constructors

ChordinoLine 

Fields

time :: NumData

Returns the time stamp of the chroma features

bass :: [NumData]

Returns the bass chroma feature

treb :: [NumData]

Returns the treble chroma feature

type ChordStruct = [NumData]Source

A chord template is list of NumDatas

Functions

Data access

timedData :: a -> NumData -> NumData -> TimedData aSource

alternative TimedData constructor

timedDataBT :: a -> BarTime -> BarTime -> TimedData aSource

alternative TimedData constructor

getBarTime :: TimedData a -> BarTimeSource

Returns the start time stamp

getBeat :: TimedData a -> BeatSource

Returns the start Beat

onset :: TimedData a -> NumDataSource

Returns the onset time stamp

offset :: TimedData a -> NumDataSource

Returns the offset time stamp

setData :: TimedData a -> b -> TimedData bSource

wraps a datatype in TimedData

Type conversion and other utilities

concatTimedData :: a -> TimedData a -> TimedData a -> TimedData aSource

concatenates the BarTime timestamps of two TimedDatas and creates a new TimedData that stores the first argument.

nextBeat :: Beat -> BeatSource

returns the next beat, e.g. nextBeat Two = Three . Following the (current) definition of Beat, we still assume 4/4, in the future this function should also have the meter as an argument.

prevBeat :: Beat -> BeatSource

returns the previous Beat, similar to prevBeat.

returns the next beat, e.g. nextBeat Two = Three . Following the (current) definition of Beat, we still assume 4/4, in the future this function should also have the meter as an argument.

updateTPChord :: (ChordLabel -> ChordLabel) -> TimedData ProbChord -> TimedData ProbChordSource

Updates transforms ChordLabel wrapped in a ProbChord and TimedData

dropProb :: [TimedData ProbChord] -> [TimedData ChordLabel]Source

drops the probabilties paired with chordlabels (in a list of ProbChords) and returns a list of ChordLabels

dropTimed :: [TimedData a] -> [a]Source

drops the time (with or without Beat) information of a list Timed data structure

timeStamp :: BarTime -> NumDataSource

Returns the NumData timestamp, given a BarTime

beat :: BarTime -> BeatSource

Returns the NumData timestamp, given a BarTime