Skip to content
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

Implement audiomixer.MixerVoice.level as synthio.BlockInput #9899

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

relic-se
Copy link

Allow tremolo-style effects using audiomixer.MixerVoice by implementing block input on level property.

LFO ticking is not completely implemented yet because it relies on changes to shared_bindings_synthio_lfo_tick introduced in #9776 to allow for a duration less than SYNTHIO_MAX_DUR.

Demonstration:

import audiobusio
import audiocore
import audiomixer
import board
import synthio
import time

DELAY = 3.0

wave_file = open("StreetChicken.wav", "rb")
wave = audiocore.WaveFile(wave_file)

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

audio = audiobusio.I2SOut(
    bit_clock=board.GP3,
    word_select=board.GP4,
    data=board.GP5,
)

audio.play(mixer)
mixer.play(wave, loop=True)

print("full")
time.sleep(DELAY)
mixer.voice[0].level = 0.5
print("half")
time.sleep(DELAY)
mixer.voice[0].level = synthio.LFO(rate=0.5, scale=0.5, offset=0.5)
print("lfo")
time.sleep(DELAY)
mixer.voice[0].stop()

@relic-se relic-se marked this pull request as ready for review December 20, 2024 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant