wav/writer
src/wav/writer.tur
defn
wav-open-write
(wav-open-write [path :cstr sample-rate :int channels :int format :cstr] :ptr<void>)
open a new audio file for writing.
Parameters
| path | filesystem path for the new audio file | |
| sample-rate | sample rate in Hz (e.g. 44100) | |
| channels | number of channels (e.g. 1 for mono, 2 for stereo) | |
| format | format keyword: ":wav-pcm16", ":wav-pcm24", ":wav-pcm32", | |
| ":wav-float", ":aiff-pcm16", ":flac-pcm16", ":flac-pcm24" |
Returns
(ok handle) on success; (err 0) if the file could not be created. Pass handle as :int to wav-write-float. Free with wav-close from wav/info when done.
Example
(let [r (wav-open-write "/tmp/out.wav" 44100 2 ":wav-pcm16")]
(if (ok? r) (let [w (ok-val r)] ...) (println "open failed")))
Since: WV0
defn
wav-write-float
(wav-write-float [w :int buf :cstr frames :int] :int)
write interleaved float samples to an open WAV handle.
Parameters
| w | WAV handle (ok-val from wav-open-write) | |
| buf | pointer to a float buffer, passed as :cstr (cast to const float*) | |
| frames | number of sample frames to write |
Returns
Number of frames actually written as :int.
Example
(let [n (wav-write-float w buf 1024)]
(println n))
Since: WV0
Internal definitions
__ok-- create an ok result wrapping integer value v.__err-- create an err result wrapping integer error value e.