Difference between revisions of "Sound data structures"

From HaskellWiki
Jump to: navigation, search
(Adding in the RIFF library which only parses a container format, not actual audio.)
 
(6 intermediate revisions by one other user not shown)
Line 26: Line 26:
 
| 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]]
  +
|-
  +
| [http://hackage.haskell.org/package/riff riff]
  +
| <hask>Data.ByteString.Lazy</hask>
 
|}
 
|}
   
Line 53: Line 62:
 
|-
 
|-
 
| [[Synthesizer|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|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>
 
|}
 
|}
   
Line 77: Line 86:
 
| [[Haskore]]
 
| [[Haskore]]
 
| Uses midi library
 
| Uses midi library
  +
|-
  +
| [[ALSA|alsa-seq]]
  +
| Custom midi structures
 
|-
 
|-
 
| YampaSynth
 
| YampaSynth

Latest revision as of 23:01, 29 April 2014

At the request of Don Stuart, here is some information about the formats supported by different sound libraries.

In-memory data formats

In-memory sound formats are fairly diverse.

Reading and writing sound files

Library Sound file format
HCodecs (Audible a) => DiffUArray Int a
hsndfile MArray with Float and Double
HSoundFile [[Double]]
ALUT OpenAL.AL.Buffer
WAVE [[Int32]]
Sox Lists, Storable Vector, whatever you have a hPut and hGetContents function for.
libsox Storable Vector
riff Data.ByteString.Lazy

Playing sounds

Library Sound file format
OpenAL Ptr UInt8, Ptr Int16, 1-N channels
SDL-mixer ForeignPtr ChunkStruct, ForeignPtr MusicStruct

Sound processing libraries

Library Sound file format
dsp Array a, [a]
synthesizer [a], StorableVector.Lazy a, (StateT s Maybe a, s) (like stream-fusion)
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]

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

Special-purpose APIs only (FFIs, etc.)

Library Sound file format
hCsound CsoundPtr
HasSound / Haskore OrcExp
hsc3 UGen

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