synthesizer-alsa-0.5: Control synthesizer effects via ALSA/MIDI

Safe HaskellNone

Synthesizer.ALSA.Storable.Play

Contents

Description

Play audio signals via ALSA. The module could also be called Output, because with a file sink, data can also be written to disk.

Synopsis

auxiliary functions

defaultChunkSize :: ChunkSizeSource

A suggested default chunk size. It is not used by the functions in this module.

makeSinkSource

Arguments

:: (SampleFmt y, C t) 
=> Device

ALSA output device

-> t

period (buffer) size expressed in seconds

-> SampleFreq

sample rate

-> SoundSink Pcm y 

Useful values for the output device are

  • "default" for mixing with the output of other applications.
  • "plughw:0,0" for accessing sound output in an exclusive way.
  • "tee:default,'output.raw',raw" for playing and simultaneously writing raw data to disk.
  • "tee:default,'output.wav',wav" for playing and writing to WAVE file format. Note that the length cannot be written, when the program is terminated, leaving the file in an invalid format.

write :: Storable y => SoundSink handle y -> handle y -> Vector y -> IO ()Source

writeLazy :: Storable y => SoundSink handle y -> handle y -> Vector y -> IO ()Source

play functions

auto :: SampleFmt y => SoundSink handle y -> T y -> IO ()Source

autoAndRecord :: (SampleFmt y, C y) => FilePath -> SoundFmt y -> SoundSink handle y -> T y -> IO ExitCodeSource

Play a signal and write it to disk via SoX simultaneously. Consider using auto with tee device.

autoAndRecordMany :: (SampleFmt y, C y, Traversable f) => f FilePath -> SoundFmt y -> SoundSink handle y -> T y -> IO (f ExitCode)Source

Play a signal and write it to multiple files. The Functor f may be Maybe for no or one file to write, or [] for many files to write.

monoToInt16 :: (Storable y, C y) => SoundSink handle Int16 -> T y -> IO ()Source

stereoToInt16 :: (Storable y, C y) => SoundSink handle (T Int16) -> T (T y) -> IO ()Source