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

Copyright(c) 2012--2013 W. Bas de Haas and Jose Pedro Magalhaes
LicenseLGPL-3
Maintainerbas@chordify.net, dreixel@chordify.net
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell98

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 = Double Source

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 a Source

alternative TimedData constructor

timedDataBT :: a -> BarTime -> BarTime -> TimedData a Source

alternative TimedData constructor

getBarTime :: TimedData a -> BarTime Source

Returns the start time stamp

getBeat :: TimedData a -> Beat Source

Returns the start Beat

onset :: TimedData a -> NumData Source

Returns the onset time stamp

offset :: TimedData a -> NumData Source

Returns the offset time stamp

setData :: TimedData a -> b -> TimedData b Source

wraps a datatype in TimedData

Type conversion and other utilities

concatTimedData :: a -> TimedData a -> TimedData a -> TimedData a Source

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

nextBeat :: Beat -> Beat Source

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 -> Beat Source

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 ProbChord Source

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 -> NumData Source

Returns the NumData timestamp, given a BarTime

beat :: BarTime -> Beat Source

Returns the NumData timestamp, given a BarTime

prettyPrint :: Show a => [TimedData a] -> String Source

Pretty prints a list of TimedDatas, one per line