wav/info
wav-open-read
(wav-open-read [path :cstr] :ptr<void>)
open a WAV/PCM/FLAC/AIFF file for reading.
| path | filesystem path to the audio file |
(ok handle) on success; (err 0) if the file could not be opened. Pass handle as :int to wav/reader and wav/info functions. Free with wav-close when done.
(let [r (wav-open-read "sound.wav")]
(if (ok? r) (let [w (ok-val r)] ...) (println "open failed")))
Since: WV0
wav-open-write
(wav-open-write [path :cstr sample-rate :int channels :int format :cstr] :ptr<void>)
open a new audio file for writing.
| 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" |
(ok handle) on success; (err 0) if the file could not be created. Pass handle as :int to wav/writer and wav/info functions. Free with wav-close when done.
(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
wav-close
(wav-close [w :int] :void)
close a WAV handle and free associated memory.
| w | WAV handle (ok-val from wav-open-read or wav-open-write) |
void
(wav-close w)
Since: WV0
wav-sample-rate
(wav-sample-rate [w :int] :int)
return the sample rate of an open WAV handle.
| w | WAV handle (ok-val from wav-open-read or wav-open-write) |
Sample rate in Hz as :int.
(println (wav-sample-rate w))
Since: WV0
wav-channels
(wav-channels [w :int] :int)
return the channel count of an open WAV handle.
| w | WAV handle (ok-val from wav-open-read or wav-open-write) |
Number of channels as :int.
(println (wav-channels w))
Since: WV0
wav-frame-count
(wav-frame-count [w :int] :int)
return the total frame count of an open WAV handle.
| w | WAV handle (ok-val from wav-open-read; 0 for write handles) |
Total number of sample frames as :int.
(println (wav-frame-count w))
Since: WV0
wav-format
(wav-format [w :int] :cstr)
return a string describing the container format.
| w | WAV handle (ok-val from wav-open-read or wav-open-write) |
One of "wav", "aiff", "flac", or "unknown" as :cstr.
(println (wav-format w))
Since: WV0
Internal definitions
__ok-- create an ok result wrapping integer value v.__err-- create an err result wrapping integer error value e.