Module audio.buffer
Generic container for audio signal data.
The module can also be called directly as a function, e.g.: mybuf = audio.buffer(1024, 2)
Functions
create (frames, channels, samples) | Create a new audio_buffer filled with silence. |
load (filename) | Create a new audio_buffer from an audio file on disk. |
Class audio_buffer
buffer:write (func, start, dur) | Write values into a buffer |
Functions
- create (frames, channels, samples)
-
Create a new audio_buffer filled with silence.
Parameters:
- frames int The number of frames (sample length) of the buffer
- channels optional int The number of channels per frame
- samples An optional pointer to existing sample memory
Returns:
-
SNDFILE
- load (filename)
-
Create a new audio_buffer from an audio file on disk.
Parameters:
- filename string The name or full path of a soundfile to load.
Returns:
-
SNDFILE
Class audio_buffer
A sound file class.- buffer:write (func, start, dur)
-
Write values into a buffer
Parameters:
- func function A function that will be called to set each frame of the buffer. For a multi-channel buffer, this function should return multiple values (one for each channel).
- start optional int The starting index to write data (default 0)
- dur optional int The number of frames to write (default all frames of the buffer)
Returns:
-
audio_buffer
self