hmt-0.15: Haskell Music Theory

Safe Haskell | Safe
Language | Haskell98

Music.Theory.Array.CSV.Midi

Description

Functions for reading midi note data from CSV files.

Synopsis

- reads_exact :: Read a => String -> Maybe a
- reads_err :: Read a => String -> a
- csv_midi_note_data_hdr :: [String]
- csv_midi_note_data_read' :: (Read t, Real t, Read n, Real n) => (m, m) -> FilePath -> IO [(t, Either m String, n, n)]
- csv_midi_note_data_read :: (Read t, Real t, Read n, Real n) => (m, m) -> FilePath -> IO [(t, m, n, n)]
- midi_tseq_read :: (Read t, Real t, Read n, Real n) => FilePath -> IO (Tseq t (On_Off (n, n)))
- midi_tseq_to_midi_wseq :: (Num t, Eq n) => Tseq t (On_Off (n, n)) -> Wseq t (n, n)
- midi_wseq_to_midi_tseq :: (Num t, Ord t) => Wseq t (n, n) -> Tseq t (On_Off (n, n))
- csv_midi_note_data_write :: (Eq m, Show t, Real t, Show n, Real n) => (m, m) -> FilePath -> [(t, m, n, n)] -> IO ()
- midi_tseq_write :: (Show t, Real t, Show n, Real n) => FilePath -> Tseq t (On_Off (n, n)) -> IO ()

# Documentation

reads_exact :: Read a => String -> Maybe a Source #

Variant of `reads` requiring exact match.

reads_err :: Read a => String -> a Source #

Variant of `reads_exact` that errors on failure.

csv_midi_note_data_hdr :: [String] Source #

The required header field.

csv_midi_note_data_read' :: (Read t, Real t, Read n, Real n) => (m, m) -> FilePath -> IO [(t, Either m String, n, n)] Source #

Midi note data, header is `time,on/off,note,velocity`. Translation values for on/off are consulted.

    let fn = "/home/rohan/cvs/uc/uc-26/daily-practice/2014-08-13.1.csv"
    csv_midi_note_data_read' ("ON","OFF") fn :: IO [(Double,Either String String,Double,Double)]

csv_midi_note_data_read :: (Read t, Real t, Read n, Real n) => (m, m) -> FilePath -> IO [(t, m, n, n)] Source #

Variant of `csv_midi_note_data_read'` that errors on non on/off data.

midi_tseq_read :: (Read t, Real t, Read n, Real n) => FilePath -> IO (Tseq t (On_Off (n, n))) Source #

`Tseq` form of `csv_read_midi_note_data`.

midi_tseq_to_midi_wseq :: (Num t, Eq n) => Tseq t (On_Off (n, n)) -> Wseq t (n, n) Source #

Translate from `Tseq` form to `Wseq` form.

midi_wseq_to_midi_tseq :: (Num t, Ord t) => Wseq t (n, n) -> Tseq t (On_Off (n, n)) Source #

Off-velocity is zero.

csv_midi_note_data_write :: (Eq m, Show t, Real t, Show n, Real n) => (m, m) -> FilePath -> [(t, m, n, n)] -> IO () Source #

Writer.

midi_tseq_write :: (Show t, Real t, Show n, Real n) => FilePath -> Tseq t (On_Off (n, n)) -> IO () Source #

`Tseq` form of `csv_midi_note_data_write`.