-
-
Notifications
You must be signed in to change notification settings - Fork 280
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...
I am also providing a simple (single user) webserver which can render the audio data as wav result. Here are some examples:
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:
- player-url_icy-audiokit - An Internet MP3 Radio
- 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!
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
Here you can find examples for streaming from the Internet, A2DP, serving Audio via Http etc
- streams-generator-webserver_wav A Webserver which renders some generated sound
- streams-sam-webserver_wav A Webserver which renders the result from the SAM TTS engine
- streams-tts-webserver_wav A Webserver which renders the result from the Arduino TTS engine
- streams-flite-webserver_wav A Webserver which renders the result from the Flite TTS engine
- streams-effect-webserver_wav. A Webserver which Demonstrates the Audio Effects:Boost, Distortion,Fuzz,Tremolo
- streams-i2s-webserver_wav. Streaming an I2S microphone to the browser
- ...
If you want to be able to support multiple users you can use the TinyHttp Server which can act like any regular Audio Sink:
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.
Just some examples using the basic API. Though this continues to work, we recommend that you use the Stream API because it is easier to use. However, the Bluetooth Audio A2DP examples are more efficient than the Stream based examples.
- base-adc-serial - Sample analog sound and write it to Serial
- base-file_raw-serial - Read Raw File from SD card to and write it to Serial
- base-i2s-serial - Sample digital sound and write it to Serial
- ...