Skip to content

nRF52: Add support for sound output over I2S #2623

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ssievert42
Copy link
Contributor

This adds support for sound output over I2S.

Tested to work on a Jolt.js and a XiaoBLE, with a MAX98357 I2S amplifier (Adafruit Audio BFF, but anything that can cope with having no master clock should probably work as well).

Still very much WIP and currently hardcoded to only do 32 kHz audio, but it actually sounds quite nice :)

I'm not quite sure yet how to handle different sample rates - looks like that isn't very straightforward and will always be a little off: https://docs.nordicsemi.com/bundle/ps_nrf52840/page/i2s.html#ariaid-title6 (section "Master clock (MCK)")

Weirdly enough, the charge LED on Jolt.js blinks in sync with the beat when powering the amplifier from Q0.

I2S on nRF52840 wants audio as S16 instead of the U16 that the Waveform class wants, so beware of horrible noises and potential speaker and ear damage when testing this.

Slightly modified QOA module with I2S output support: https://gist.github.com/ssievert42/b71276ebb327ab4888012521a922bd63

Suggestions and feedback very much welcome :)

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