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

Buffered WAV file recording and playback #483

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

h4yn0nnym0u5e
Copy link
Contributor

As discussed on forum thread https://forum.pjrc.com/index.php?threads/yet-another-file-player-and-recorder.70963/ Seems to be pretty stable now, so I've added a couple of extra examples and submitted this PR.

Provides 1-, 2-, 4-, 6- and 8- channel playback and recording of WAV files from/to any filesystem, while not interfering with the sketch's ability to access files - all accesses are done via EventResponder so not from within the interrupt handler, which has a tendency to cause all sorts of mayhem.

With reasonably-sized buffers in heap or PSRAM the resilience to other system activities seems pretty good, and playback / recording of multiple files is possible.

Several examples are provided (maybe too many, or too complex?); documentation has been updated.

Original branch is slightly polluted with unrelated fixes
Also omit alignment of user-generated audio buffer, doesn't seem to be needed
@madskjeldgaard
Copy link

Extremely exciting!!!

@salkin-mada
Copy link

yay!

@madskjeldgaard
Copy link

I tested this in two different situations today:

  • A teensy 3.2 with the audio shield
  • A teensy 4.0 with an sd card module and the PCM5102A dac board

And both worked wonderfully. Neither of them could reliably play long wav files without intermittent glitches with the normal sd wav file player but with this it works a charm :)

@madskjeldgaard
Copy link

Oh and heads up: The AudioBuffer class clashes with the AudioBuffer in the codecs library.

https://github.com/FrankBoesing/Arduino-Teensy-Codec-lib/blob/master/audiobuffer.h

@h4yn0nnym0u5e
Copy link
Contributor Author

I'll let Paul adjudicate that one. I'm fairly sure he won't be pulling Frank's library, (a) because there's no PR, and (b) because it's GPL, not MIT-licensed.

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.

3 participants