-
-
Notifications
You must be signed in to change notification settings - Fork 239
Examples
All examples follow the following naming convention: "scenario type"-"source"-"destination". For the scenario types we might have base (using basic api functionality), stream for examples using Streams and test for the test cases.
For the source we currently have adc for analog input devices like analog microphones, i2s for digital input devices (e.g. digital microphones), file for SD files and a2dp for input from Bluetooth A2DP (e.g. from a Mobile Phone).
For the destination we use dac for analog output (e.g. to an amplifier), i2s for digital output devices (e.g. an external DAC), file for SD files and a2dp for output to Bluetooth A2DP (e.g. a Bluetooth Speaker).
Here is the list of examples:
Here are a couple of simple test sketches to demo different output destinations:
- streams-generator-serial Displaying generated sound on the Serial Plotter
- streams-generator-i2s Output of generated sound on external DAC via I2S
- streams-generator-analog Output of generated sound on ESP32 internal DAC via I2S
- streams-generator-pwm Output of generated sound with PWM
- streams-adc-serial Displaying input from analog microphone on the Serial Plotter
- streams-memory_wav-serial Decoding of WAV from Flash memory and display on the Serial Plotter
And some more useful examples:
- streams-sd_mp3-i2s - Playing an mp3 file from a SD disk and output to external DAC via I2S
- streams-memory_raw-i2s - Play music form Flash Memory via I2S to External DAC
- streams-memory_mp3-metadata Decoding Metadata from a MP3 file
- ...
These are just a few examples, but you can combine any Input Stream with any Output Stream as you like...
With most of the examples above you needed to make sure that you connect the right pins to the corresponding modules. If you use a Audio Kit which comes with all microphones, DACs and ADCs included, things get quite easy. Here are a couple of examples:
- streams-sd-audiokit - Play a single mp3 file
- player-sd-audiokit - A mp3 file player
- streams-pins-audiokit - FLITE Text to Speach Engine and Button Support
- and many more ...
Naturally you can use these examples w/o AudioKit or LyraT board. Just change the output or input to use a I2SStream instead of the AudioKitStream!
Here you can find examples for streaming from the Internet, A2DP, serving Audio via Http etc
If your microcontroller does not support I2S you can use a VS1053 Module. Here are some examples:
There are quite a few alternative examples to do Text to Speech
We provide some generic output which will also work on Linux, Windows and OS/X The cmake is downloading all dependencies and builds an executable from the sketch.