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

PicoSystem bleepy audio #712

Merged
merged 9 commits into from
Sep 13, 2021
Merged

Conversation

Gadgetoid
Copy link
Contributor

  • Add Pico PWM audio - uses dithered audio output + PIO magic intended for driving a speaker- basically inaudible on PicoSystem
  • Add bleepy basic PWM audio - uses GPIO 11's PWM slice to output the first SQUARE wave enabled channel to the piezo- quiet but beepy!
  • Fix a bug in the audio engine where decay could leave a >0 volume and sustain==0 never turned the envelope generator off.
  • Fix some indentation in Pico CMakeLists

@Daft-Freak
Copy link
Collaborator

Hmm, is the audio_pwm stuff still useful with no users? (The pio_sm_set_clkdiv bit needs an #if OVERCLOCK_250 around it if it's staying...)

@Gadgetoid
Copy link
Contributor Author

Hmm, is the audio_pwm stuff still useful with no users? (The pio_sm_set_clkdiv bit needs an #if OVERCLOCK_250 around it if it's staying...)

I hope we'll find a use for it one day 😆

@Gadgetoid
Copy link
Contributor Author

Right, moved break as per your demo (nice!) and add a guard around the PIO clock divider.

@Daft-Freak
Copy link
Collaborator

I hope we'll find a use for it one day laughing

PicoSystem+ with improved audio 😄

(I did try it on the VGA board, but it's hardcoded to mono output and i2s is better)

32blit-pico/CMakeLists.txt Outdated Show resolved Hide resolved
32blit-pico/audio.cpp Outdated Show resolved Hide resolved
32blit-pico/audio.cpp Show resolved Hide resolved
@Gadgetoid Gadgetoid force-pushed the picosystem-audio branch 2 times, most recently from 2efc804 to 6c1fce4 Compare September 9, 2021 18:03
@Gadgetoid
Copy link
Contributor Author

I'm sneaking a new PicoSystem-specific hardware test in here...

@Daft-Freak
Copy link
Collaborator

FIFO fix somehow ended up in there despite being merged already?

Maybe the pico-specific hardware test should have a less rainbow-y background, doing a per-pixel hsv_to_rgba is pretty slow there.

@Gadgetoid
Copy link
Contributor Author

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA!!!!!!!!!!!!!!!!!

Gadgetoid and others added 7 commits September 10, 2021 09:54
Bring up PWM audio on GPIO 11, pio1 for PicoSystem.

This enables audio output for the  32blit audio engine,
but the transistor-amplified piezo on PicoSystem is *really* quiet.

Music is probably a no-go on this feeble beeper.
In some cases the ADSR might never decay fully to 0.

* If sustain volume is 0, proceed right from decay -> off
* Clamp ADSR to sustain volume when sustain phase is triggered
Extract the frequency/duty cycle from the first SQUARE wave channel and route it to PWM on GPIO 11.
Run the audio engine to process ADSR phases.

Co-authored-by: Charlie Birks <[email protected]>
Add a hardware test for the RP2040-based PicoSystem.

Since the PicoSystem has fewer buttons, no joystick and no tilt it makes more sense to ship a different hardware-test rather than IFDEF the other one to oblivion.
Specify `-DAUDIO_PWM:bool=true` when configuring and builds will use AUDIO_PWM instead of AUDIO_BEEP.

This is intended for PicoSystems which have been end-user modified with a 20x15mm .7w 8Ohm speaker.
@Gadgetoid Gadgetoid merged commit 3789c78 into 32blit:master Sep 13, 2021
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.

2 participants