Skip to content

Examples

Phil Schatzmann edited this page Jun 1, 2024 · 84 revisions

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:

And some more useful examples:

These are just a few examples, but you can combine any Input Stream with any Output Stream as you like...

The AI Thinker Audio Kit and other Audio Boards

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:

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!

Communications

Here you can find examples for streaming from the Internet, A2DP, serving Audio via Http etc

VS1053 Audio Decoder

If your microcontroller does not support I2S you can use a VS1053 Module. Here are some examples:

Text to Speech TTS

There are quite a few alternative examples to do Text to Speech

Building an executable for the Desktop

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.

Clone this wiki locally