Repository navigation
audiotap module - #11639
Open
FoamyGuy wants to merge 1 commit into
Open
audiotap module#11639FoamyGuy wants to merge 1 commit into
FoamyGuy wants to merge 1 commit into
Conversation
tannewt
requested changes
Oct 20, 2026
tannewt
left a comment
Member
There was a problem hiding this comment.
Neat idea! A couple comments on the API.
| def pull(sample, times=1): | ||
| out = [] | ||
| for _ in range(times): | ||
| result, buffer = get_buffer(sample) |
Member
There was a problem hiding this comment.
This seems weird to me. I didn't realize audiocore had a get_buffer. I expected you to get something straight from the tap.
Comment on lines
+54
to
+58
| //| :param int buffer_size: The total size in bytes of each of the two playback buffers to use | ||
| //| :param int sample_rate: The sample rate to be used | ||
| //| :param int bits_per_sample: The bits per sample of the audio: 8 or 16 | ||
| //| :param bool samples_signed: Effect is signed (True) or unsigned (False) | ||
| //| :param int channel_count: The number of channels the source samples contain. 1 = mono; 2 = stereo. |
Member
There was a problem hiding this comment.
Do you need this? Could you inherit these from whatever you play? You could even allocate the ringbuf for the capacity at play time.
| //| samples_signed=mic_format.samples_signed, | ||
| //| max_packet_size=mic_format.max_packet_size, | ||
| //| ) | ||
| //| # Keep a quarter second, more than arrives between reads of the loop below. |
Member
There was a problem hiding this comment.
Maybe you actually want capacity in terms of time too.
| MP_DEFINE_CONST_FUN_OBJ_1(audiotap_tap_clear_obj, audiotap_tap_obj_clear); | ||
|
|
||
| //| def levels(self) -> Tuple[float, float]: | ||
| //| """Returns the peak and RMS level of the audio that passed through |
Member
There was a problem hiding this comment.
Do you need both values for the same snapshot of time? If not, you could avoid this tuple allocation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This new module provides an FX chain object that passes unmodified audio through while keeping a small buffer that can be accessed from the python side.
It allows python code to check the level of the streaming audio for drawing level indicators and similar. Or to read data from the audio stream for analysis while it's still being played.