jdxi_editor.audio.audio_buffer
A preallocated stereo ring.
The capture callback is the only writer. The analysis worker is the only reader. Neither side allocates, and the reader copies out so a later write cannot change a buffer the worker is still using.
Classes
The most recent stereo frames, overwriting the oldest. |
Module Contents
- class jdxi_editor.audio.audio_buffer.SampleRing(capacity: int)[source]
The most recent stereo frames, overwriting the oldest.
capacityis the number of frames kept. Writes larger than that keep only the tail; capture blocks are far smaller, so the callback never takes that path.- write(frames: numpy.ndarray) None[source]
Copy
framesin. Shape(n,)or(n, 1)is written to both channels. Shape(n, 2)is stereo.- Parameters:
frames – np.ndarray samples
- Returns:
None
- latest(count: int) numpy.ndarray[source]
A copy of the newest
countframes, shape(n, 2).- Parameters:
count – int frames wanted
- Returns:
np.ndarray