No matching definitions.

wav/reader

src/wav/reader.tur
defn

wav-open-read

(wav-open-read [path :cstr] :ptr<void>)

open a WAV/PCM/FLAC/AIFF file for reading.

pathfilesystem path to the audio file

(ok handle) on success; (err 0) if the file could not be opened. Pass handle as :int to wav-read-float, wav-seek, wav-close, and wav/info. 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

defn

wav-close

(wav-close [w :int] :void)

close a WAV handle and free associated memory.

wWAV handle (ok-val from wav-open-read)

void

(wav-close w)

Since: WV0

defn

wav-read-float

(wav-read-float [w :int buf :cstr frames :int] :int)

read interleaved float samples from an open WAV handle.

wWAV handle (ok-val from wav-open-read)
bufpointer to a float buffer, passed as :cstr (cast to float*)
framesnumber of sample frames to read

Number of frames actually read as :int; may be less than frames at EOF.

(let [n (wav-read-float w buf 1024)]
    (println n))

Since: WV0

defn

wav-seek

(wav-seek [w :int frame-offset :int whence :cstr] :ptr<void>)

seek to a frame position within an open WAV handle.

wWAV handle (ok-val from wav-open-read)
frame-offsetframe offset from the whence anchor
whenceseek anchor keyword: ":set", ":cur", or ":end"

(ok new-position) on success; (err 0) if the seek failed.

(let [r (wav-seek w 0 ":set")]
    (if (ok? r) (println "seeked") (println "seek failed")))

Since: WV0

Internal definitions
__ok-- create an ok result wrapping integer value v.
__err-- create an err result wrapping integer error value e.