Skip to content

AudioMixer reversed play order results in silent output #10154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
relic-se opened this issue Mar 20, 2025 · 0 comments
Open

AudioMixer reversed play order results in silent output #10154

relic-se opened this issue Mar 20, 2025 · 0 comments

Comments

@relic-se
Copy link

relic-se commented Mar 20, 2025

CircuitPython version and board name

Adafruit CircuitPython 9.2.5 on 2025-03-19; Pimoroni Pico Plus 2 with rp2350b

Code/REPL

import audiobusio
import audiomixer
import board
import synthio

TEST = False

synth = synthio.Synthesizer()

mixer = audiomixer.Mixer(
    voice_count=1,
    channel_count=1,
    sample_rate=11025,
)

dac = audiobusio.I2SOut(
    bit_clock=board.GP0,
    word_select=board.GP1,
    data=board.GP2,
)

if TEST:
    mixer.voice[0].play(synth)
    dac.play(mixer)
else:
    dac.play(mixer)
    mixer.voice[0].play(synth)

synth.press(40)

print(dac.playing)  # Always prints "True"

Behavior

If TEST = False, the DAC outputs the note played by the synthesizer and reports the following REPL output:

dac.playing=True
mixer.playing=True

If TEST = True, no sound is output from the DAC and it reports the following REPL output:

dac.playing=True
mixer.playing=False

Description

If audiomixer.Mixer is played by an audio output object before the audiomixer.MixerVoice object has been loaded with a sample, the output audio is silent. Toggle the TEST constant to flip the order of play and demonstrate this error.

Additional information

This is an aside, but it would also be really nice to allow for chaining, ie: dac.play(mixer.play(synth, voice=0)). I know in the past other users have referenced this style of chaining, but it is definitely not supported. I think all that would be necessary to do this is to return an instance of self (return MP_OBJ_FROM_PTR(self);) on each implementation of play in shared-bindings.

@relic-se relic-se added the bug label Mar 20, 2025
@tannewt tannewt added the audio label Mar 20, 2025
@tannewt tannewt added this to the Long term milestone Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants