pico_audio_pwm: `take_audio_buffer` never returns null
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- audio-video-rtc, embedded-iot
Research direction
Start by tracing the take_audio_buffer implementation and the PWM audio path mentioned in the report. Reproduce the continuous main-loop case and compare the function's behavior with the expected empty-buffer semantics; done means the issue's reported behavior is resolved without advancing audio at an unintended rate.
Written by the indexing model from the issue text.
Description
We've been tinkering with audio on PicoSystem and in the case of at least PWM audio, take_audio_buffer never seems to return null, and never seems to stall for any length of time.
In instances where we're naively calling an "audio_update" function at an arbitrary speed (too quickly in our case) this results in the audio engine getting clocked at some multiple it's intended speed, since we're relying upon take_audio_buffer to give us a buffer if and only if there is an consumed buffer in the pool.
For example, our update_audio function might look something like this:
void update_audio(uint32_t time) {
struct audio_buffer *buffer = take_audio_buffer(audio_pool, false);
if(buffer) {
auto samples = (int16_t *) buffer->buffer->bytes;
for(uint32_t i = 0; i < buffer->max_sample_count; i++) {
*samples++ = get_audio_frame();
}
}
buffer->sample_count = buffer->max_sample_count;
give_audio_buffer(audio_pool, buffer);
}
And this would be called continuously in the main loop.
No matter how fast we run this, if(buffer) is always true.
- Dominant language
- C
- Stars
- 605
- Forks
- 155
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/pico-extras
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/pico-extras#80 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
raspberrypi/pico-extras#59 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
raspberrypi/pico-extras#104 ·
-
Difficulty 5/5 Over a week Newbie friendliness 32/100
raspberrypi/pico-extras#100 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
raspberrypi/pico-extras#98 · 3 comments ·
All issues in raspberrypi/pico-extras
Similar issues
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 comment ·
-
bug Self Built Image SNAPSHOT Supported Device target/ramips
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100