Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Sound.PlSynth
Description
Convenience wrappers for pl_synth C API.
The generator is always using the 44100 s16le stereo format.
The generator is using static pointers inside and is NOT thread-safe.
Synopsis
- withPlSynth :: IO a -> IO a
- data PlSynthT = PlSynthT {
- osc0_oct :: Word8
- osc0_det :: Word8
- osc0_detune :: Word8
- osc0_xenv :: Word8
- osc0_vol :: Word8
- osc0_waveform :: Word8
- osc1_oct :: Word8
- osc1_det :: Word8
- osc1_detune :: Word8
- osc1_xenv :: Word8
- osc1_vol :: Word8
- osc1_waveform :: Word8
- noise_fader :: Word8
- env_attack :: Word32
- env_sustain :: Word32
- env_release :: Word32
- env_master :: Word32
- fx_filter :: Word8
- fx_freq :: Word32
- fx_resonance :: Word8
- fx_delay_time :: Word8
- fx_delay_amt :: Word8
- fx_pan_freq :: Word8
- fx_pan_amt :: Word8
- lfo_osc_freq :: Word8
- lfo_fx_freq :: Word8
- lfo_freq :: Word8
- lfo_amt :: Word8
- lfo_waveform :: Word8
- emptyPlSynthT :: PlSynthT
- pattern SIN :: Word8
- pattern SAW :: Word8
- pattern SQR :: Word8
- pattern TRI :: Word8
- data PlSynthSoundT = PlSynthSoundT {}
- writeSound :: FilePath -> PlSynthSoundT -> IO ()
- withSound :: PlSynthSoundT -> (Ptr Word8 -> Int -> IO a) -> IO a
- data PlSynthSongT = PlSynthSongT {
- row_len :: Word32
- num_tracks :: Word8
- tracks :: Ptr PlSynthTrackT
- writeSong :: FilePath -> PlSynthSongT -> IO ()
- withSong :: PlSynthSongT -> (Ptr Word8 -> Int -> IO a) -> IO a
- withSongTracks :: Word32 -> [([Word8], [[Word8]], PlSynthT)] -> (PlSynthSongT -> IO a) -> IO a
- newSong :: Word32 -> [PlSynthTrackT] -> IO PlSynthSongT
- freeSongTracks :: PlSynthSongT -> IO ()
- newTrack :: [Word8] -> [[Word8]] -> PlSynthT -> IO PlSynthTrackT
- freeTrack :: PlSynthTrackT -> IO ()
Documentation
withPlSynth :: IO a -> IO a Source #
Initialize generator using a temporary buffer.
Constructors
PlSynthT | |
Fields
|
Instances
Storable PlSynthT Source # | |
Defined in Sound.PlSynth.FFI | |
Show PlSynthT Source # | |
Eq PlSynthT Source # | |
data PlSynthSoundT Source #
Instances
Storable PlSynthSoundT Source # | |
Defined in Sound.PlSynth.FFI Methods sizeOf :: PlSynthSoundT -> Int # alignment :: PlSynthSoundT -> Int # peekElemOff :: Ptr PlSynthSoundT -> Int -> IO PlSynthSoundT # pokeElemOff :: Ptr PlSynthSoundT -> Int -> PlSynthSoundT -> IO () # peekByteOff :: Ptr b -> Int -> IO PlSynthSoundT # pokeByteOff :: Ptr b -> Int -> PlSynthSoundT -> IO () # peek :: Ptr PlSynthSoundT -> IO PlSynthSoundT # poke :: Ptr PlSynthSoundT -> PlSynthSoundT -> IO () # | |
Show PlSynthSoundT Source # | |
Defined in Sound.PlSynth.FFI Methods showsPrec :: Int -> PlSynthSoundT -> ShowS # show :: PlSynthSoundT -> String # showList :: [PlSynthSoundT] -> ShowS # | |
Eq PlSynthSoundT Source # | |
Defined in Sound.PlSynth.FFI Methods (==) :: PlSynthSoundT -> PlSynthSoundT -> Bool # (/=) :: PlSynthSoundT -> PlSynthSoundT -> Bool # |
writeSound :: FilePath -> PlSynthSoundT -> IO () Source #
Generate samples and write into a file.
If file extension is .wav
, then the file would be WAV-wrapped.
Otherwise, raw PCM data would be dumped.
withSound :: PlSynthSoundT -> (Ptr Word8 -> Int -> IO a) -> IO a Source #
Generate sound samples in a temporary buffer.
Copy the pointer contents before using.
data PlSynthSongT Source #
Constructors
PlSynthSongT | |
Fields
|
Instances
Storable PlSynthSongT Source # | |
Defined in Sound.PlSynth.FFI Methods sizeOf :: PlSynthSongT -> Int # alignment :: PlSynthSongT -> Int # peekElemOff :: Ptr PlSynthSongT -> Int -> IO PlSynthSongT # pokeElemOff :: Ptr PlSynthSongT -> Int -> PlSynthSongT -> IO () # peekByteOff :: Ptr b -> Int -> IO PlSynthSongT # pokeByteOff :: Ptr b -> Int -> PlSynthSongT -> IO () # peek :: Ptr PlSynthSongT -> IO PlSynthSongT # poke :: Ptr PlSynthSongT -> PlSynthSongT -> IO () # | |
Show PlSynthSongT Source # | |
Defined in Sound.PlSynth.FFI Methods showsPrec :: Int -> PlSynthSongT -> ShowS # show :: PlSynthSongT -> String # showList :: [PlSynthSongT] -> ShowS # | |
Eq PlSynthSongT Source # | |
Defined in Sound.PlSynth.FFI |
writeSong :: FilePath -> PlSynthSongT -> IO () Source #
Generate song samples and write into a file.
If file extension is .wav
, then the file would be WAV-wrapped.
Otherwise, raw PCM data would be dumped.
withSong :: PlSynthSongT -> (Ptr Word8 -> Int -> IO a) -> IO a Source #
Generate song samples in a temporary buffer.
Copy the pointer contents before using.
Arguments
:: Word32 | |
-> [([Word8], [[Word8]], PlSynthT)] | args for |
-> (PlSynthSongT -> IO a) | |
-> IO a |
Prepare temporary buffers from track definitions.
Arguments
:: Word32 | row length |
-> [PlSynthTrackT] | track buffers |
-> IO PlSynthSongT |
freeSongTracks :: PlSynthSongT -> IO () Source #
Free song buffers AND all of its tracks.
Arguments
:: [Word8] | Sequences (1-based pattern numbers to play, 0 - silent sequence) |
-> [[Word8]] | Patterns (at most 32 note numbers to play, 0 to skip) |
-> PlSynthT | An instrument to play |
-> IO PlSynthTrackT |
freeTrack :: PlSynthTrackT -> IO () Source #