Sound data structures
From HaskellWiki
(Difference between revisions)
(synthesizer library) |
(→MIDI-based: alsa-seq only MIDI data) |
||
| (8 intermediate revisions not shown.) | |||
| Line 15: | Line 15: | ||
| <hask>(Audible a) => DiffUArray Int a</hask> | | <hask>(Audible a) => DiffUArray Int a</hask> | ||
|- | |- | ||
| - | | hsndfile | + | | [[hsndfile]] |
| <hask>MArray</hask> with <hask>Float</hask> and <hask>Double</hask> | | <hask>MArray</hask> with <hask>Float</hask> and <hask>Double</hask> | ||
|- | |- | ||
| Line 21: | Line 21: | ||
| <hask>[[Double]]</hask> | | <hask>[[Double]]</hask> | ||
|- | |- | ||
| - | | ALUT | + | | [[ALUT]] |
| <hask>OpenAL.AL.Buffer</hask> | | <hask>OpenAL.AL.Buffer</hask> | ||
|- | |- | ||
| WAVE | | WAVE | ||
| <hask>[[Int32]]</hask> | | <hask>[[Int32]]</hask> | ||
| + | |- | ||
| + | | [[Sox]] | ||
| + | | Lists, [[Storable Vector]], whatever you have a <hask>hPut</hask> and <hask>hGetContents</hask> function for. | ||
| + | |- | ||
| + | | [[Sox|libsox]] | ||
| + | | [[Storable Vector]] | ||
|} | |} | ||
| Line 35: | Line 41: | ||
! Sound file format | ! Sound file format | ||
|- | |- | ||
| - | | OpenAL | + | | [[OpenAL]] |
| <hask>Ptr UInt8</hask>, <hask>Ptr Int16</hask>, 1-N channels | | <hask>Ptr UInt8</hask>, <hask>Ptr Int16</hask>, 1-N channels | ||
|- | |- | ||
| Line 49: | Line 55: | ||
! Sound file format | ! Sound file format | ||
|- | |- | ||
| - | | dsp | + | | [[DSP|dsp]] |
| <hask>Array a, [a]</hask> | | <hask>Array a, [a]</hask> | ||
|- | |- | ||
| - | | [[Synthesizer]] | + | | [[Synthesizer|synthesizer]] |
| - | | <hask>[a], StorableVector.Lazy a, (StateT s Maybe a, s)</hask> | + | | <hask>[a]</hask>, [[Storable Vector|StorableVector.Lazy a]], <hask>(StateT s Maybe a, s)</hask> (like {{HackagePackage|id=stream-fusion}}) |
|- | |- | ||
| - | | jack | + | | [[JACK|jack]] |
| - | | Operates via mapping functions<br /><hask>mainMono :: (CFloat -> IO CFloat) -> IO ()</hask><br /><hask>mainStereo :: ((CFloat, CFloat) -> IO (CFloat, CFloat)) -> IO ()</hask> | + | | Operates via mapping functions<br /><hask>mainMono :: (CFloat -> IO CFloat) -> IO ()</hask><br /><hask>mainStereo :: ((CFloat, CFloat) -> IO (CFloat, CFloat)) -> IO ()</hask>, <br /><hask>StorableArray</hask> |
| + | |- | ||
| + | | [[ALSA|alsa-pcm]] | ||
| + | | <hask>(SampleFrame a) => Ptr a</hask> | ||
| + | |- | ||
| + | | [[Hommage]] | ||
| + | | <hask>[a]</hask> | ||
|} | |} | ||
| - | === MIDI-based === | + | === [[MIDI]]-based === |
{| border="1" | {| border="1" | ||
| Line 69: | Line 81: | ||
| Reads and writes MIDI files | | Reads and writes MIDI files | ||
|- | |- | ||
| - | | midi | + | | [[MIDI|midi]] |
| Reads and writes MIDI files | | Reads and writes MIDI files | ||
|- | |- | ||
| - | | alsa-midi | + | | [[ALSA|alsa-midi]] |
| Uses midi library | | Uses midi library | ||
|- | |- | ||
| [[Haskore]] | | [[Haskore]] | ||
| Uses midi library | | Uses midi library | ||
| + | |- | ||
| + | | [[ALSA|alsa-seq]] | ||
| + | | Custom midi structures | ||
|- | |- | ||
| YampaSynth | | YampaSynth | ||
| Line 89: | Line 104: | ||
! Sound file format | ! Sound file format | ||
|- | |- | ||
| - | | hCsound | + | | [[CSound|hCsound]] |
| <hask>CsoundPtr</hask> | | <hask>CsoundPtr</hask> | ||
|- | |- | ||
| Line 95: | Line 110: | ||
| <hask>OrcExp</hask> | | <hask>OrcExp</hask> | ||
|- | |- | ||
| - | | hsc3 | + | | [[SuperCollider|hsc3]] |
| <hask>UGen</hask> | | <hask>UGen</hask> | ||
|} | |} | ||
Current revision
At the request of Don Stuart, here is some information about the formats supported by different sound libraries.
Contents |
1 In-memory data formats
In-memory sound formats are fairly diverse.
1.1 Reading and writing sound files
| Library | Sound file format |
|---|---|
| HCodecs | (Audible a) => DiffUArray Int a |
| hsndfile | MArray Float Double |
| HSoundFile | [[Double]] |
| ALUT | OpenAL.AL.Buffer |
| WAVE | [[Int32]] |
| Sox | Lists, Storable Vector, whatever you have a hPut hGetContents |
| libsox | Storable Vector |
1.2 Playing sounds
| Library | Sound file format |
|---|---|
| OpenAL | Ptr UInt8 Ptr Int16 |
| SDL-mixer | ForeignPtr ChunkStruct ForeignPtr MusicStruct |
1.3 Sound processing libraries
| Library | Sound file format |
|---|---|
| dsp | Array a, [a] |
| synthesizer | [a] (StateT s Maybe a, s) |
| jack | Operates via mapping functions mainMono :: (CFloat -> IO CFloat) -> IO () mainStereo :: ((CFloat, CFloat) -> IO (CFloat, CFloat)) -> IO () StorableArray |
| alsa-pcm | (SampleFrame a) => Ptr a |
| Hommage | [a] |
1.4 MIDI-based
| Library | Sound file format |
|---|---|
| HCodecs | Reads and writes MIDI files |
| midi | Reads and writes MIDI files |
| alsa-midi | Uses midi library |
| Haskore | Uses midi library |
| alsa-seq | Custom midi structures |
| YampaSynth | Stand-alone program |
1.5 Special-purpose APIs only (FFIs, etc.)
| Library | Sound file format |
|---|---|
| hCsound | CsoundPtr |
| HasSound / Haskore | OrcExp |
| hsc3 | UGen |
1.6 No public sound-buffer API
| Library | Sound file format |
|---|---|
| hbeat | The relevant source files are missing! |
| hogg | Very low-level API for Ogg internals only |
| libmpd | No sound buffer API |
| sonic-visualizer | No sound buffer API |
| truelevel | Stand-alone program (uses WAVE) |
| wavconvert | Stand-alone program |
