8.16.0.4
WAVE File Format (WAV)
(require binary-class/wave) | package: binary-class-riff |
This module provides utilities for reading and writing WAVE files.
Some of the more advanced features of the format are not implemented; let me know if you need them!
1 Reading and Writing
procedure
in : input-port? = (current-input-port)
Reads WAVE data from in and returns it.
procedure
(write-wave wav [out]) → void?
wav : wave? out : output-port? = (current-output-port)
Writes the WAVE object wav to out.
2 Utilities
Predicate for WAVE data. Equivalent to
(and (is-a? v riff:list%) (bytes=? #"WAVE" (get-field type v))).
procedure
(wave-bits wav) → exact-positive-integer?
wav : wave?
Returns the number of bits per sample of wav.
procedure
(wave-channels wav) → exact-positive-integer?
wav : wave?
Returns the number of channels in wav.
procedure
wav : wave?
Returns the sample rate of wav.
procedure
(wave-format wav) → (is-a?/c wave:format%)
wav : wave?
Returns the format chunk of wav. An exception will be raised
if none is found.
procedure
(in-wave-channel wav ch) → sequence?
wav : wave? ch : exact-nonnegative-integer?
Returns a sequence consisting of the samples of channel number ch
in wav.
Returns a sequence consisting of the samples of wav. Each
element of the sequence has as many values as there are channels.
3 Binary Classes
|
superclass: riff% |
A type representing the WAVE format chunk.
constructor
(new wave:format% [format-tag format-tag] [channels channels] [samples-per-sec samples-per-sec] [avg-bytes-per-sec avg-bytes-per-sec] [block-align block-align] [bits-per-sample bits-per-sample]) → (is-a?/c wave:format%) format-tag : exact-nonnegative-integer? channels : exact-positive-integer? samples-per-sec : exact-positive-integer? avg-bytes-per-sec : exact-positive-integer? block-align : exact-positive-integer? bits-per-sample : exact-positive-integer?
|
superclass: wave:format% |
Represents extensible format data.
constructor
(new wave:format:extensible% [extension-size extension-size] ...superclass-args...) → (is-a?/c wave:format:extensible%) extension-size : exact-nonnegative-integer?
|
superclass: wave:format:extensible% |
Represents extended format data.
constructor
(new wave:format:extended% [valid-bits-per-sample valid-bits-per-sample] [channel-mask channel-mask] [sub-format sub-format] ...superclass-args...) → (is-a?/c wave:format:extended%) valid-bits-per-sample : exact-nonnegative-integer? channel-mask : exact-nonnegative-integer? sub-format : bytes?