• Stars
    star
    322
  • Rank 130,398 (Top 3 %)
  • Language
    C++
  • License
    Creative Commons ...
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sample code for reading audio samples from the ESP32 ADC using I2S

This code is now pretty old

It's probably still useful, but I would recomment people check out the fantastic work here: https://github.com/pschatzmann/arduino-audio-tools

ESP32 I2S Audio

Explanatory video of the analog mic boards here (MAX9814 and MAX4466) here

Demo Video

And for the two I2S boards (SPH0645 and INMP441) here

Demo Video

For audio output we can use the MAX98357A boards - there's a explanatory video here

Demo Video

This project demonstrates how to use the ESP32 built-in Analog to Digital Converters and I2S for capturing audio data and for audio output..

There are four projects in this repository: loop_sampling, i2s_sampling, i2s_output and server.

server

This is a simple node server that writes the samples received from the ESP32 to a file.

Check the README.md file in the server folder for detailed instructsions.

You will need to have node and yarn. You may already have these on your system.

Check with:

node --version
yarn --version

Then just run:

cd server
yarn

To install the dependencies. And

cd server
yarn start

When you want to run the server.

loop_sampling

This project shows how to use the Arduino analogRead function and the Espressif adc1_get_raw function.

It also demonstrates how to get a calibrated value back from the ADC to give you the actual voltage at the input.

i2s_sampling

This project handles both analogue devices (such as the MAX4466 and the MAX9814) and I2S devices (such as the SPH0645 and INMP441).

This project demonstrates how to use the I2S peripheral for high-speed sampling using DMA to transfer samples directly to RAM.

We can read these samples from the internal ADC or from the I2S peripheral directly.

Samples are read from the DMA buffers and sent to a server running on your laptop/desktop machine.

The current set of pin assignment in the code are:

ADC

Function GPIO Pin Notes
Analogue input GPIO35 ADC_UNIT_1, ADC1_CHANNEL_7

I2S

Function GPIO Pin Notes
bck_io_num GPIO_NUM_32 I2S - Serial clock
ws_io_num GPIO_NUM_25 I2S - LRCLK - left right clock
data_in_num GPIO_NUM_33 I2S - Serial data

i2s_output

This example shows how to drive an I2S output device - I've tested this against the MAX98357 breakout board from Adafruit - https://learn.adafruit.com/adafruit-max98357-i2s-class-d-mono-amp

There is an example WAV file that can be played or you can play a simple sin wave through the output.

To play the WAV file you will need to download the file to the SPIFFS file system.

This is now annoyingly hard to find on platform.io - watch this video to see how to find it.

FS Upload

The pins currently configured are:

Function GPIO Pin Notes
bck_io_num GPIO_NUM_27 I2S - Serial clock
ws_io_num GPIO_NUM_14 I2S - LRCLK - left right clock
data_out_num GPIO_NUM_26 I2S - Serial data

More Repositories

1

VisionCoreMLSample

Sample application using Vision Framework and Core ML
Swift
597
star
2

esp32-walkie-talkie

A Walkie-Talkie based around the ESP32 using UDP broadcast or ESP-NOW
C++
424
star
3

diy-alexa

DIY Alexa
Jupyter Notebook
387
star
4

diy-esp32-epub-reader

An ESP32 e-reader
C
323
star
5

self-organising-leds

Using an ESP32 Camera board to create self organising LEDs
C++
148
star
6

ar-browser-sudoku

Solving Sudoku Puzzles in the Browser Using Augmented Reality
Jupyter Notebook
119
star
7

voice-controlled-robot

A voice-controlled robot using the ESP32 and TensorFlow Lite
Jupyter Notebook
108
star
8

tensorflow-lite-esp32

SImple example getting TensorFlow Lite up and running on the ESP32 with Platform.io
C++
103
star
9

command_line_chatgpt

A command line chat bot using the ChatGPT API from OpenAI
Python
95
star
10

kicad-coil-plugins

Some simple plugins for generating stator coils in kicad
Jupyter Notebook
88
star
11

esp32_sdcard_audio

A simple example that shows how to record a WAV file to an SD Card on the ESP32
C++
72
star
12

esp32-play-mp3-demo

A very simple example showing how to play mp3 files on the ESP32
C
72
star
13

m5stack-core2-audio-monitor

A fun little project to test out the mic on the M5Stack CORE2
C
66
star
14

esp32-i2s-mic-test

The Simplest Test Code for an I2S Microphone on the ESP32 I can Imagine
C++
52
star
15

esp32-tft-audio-monitor

Port of my M5Stack Core 2 audio monitor project to generic ESP32s with TFT screens
C
52
star
16

esp32-laser-show

C
50
star
17

esp32_wireless_microphone

Wireless microphone using websockets or TCP sockets
C++
49
star
18

esp-asteroids

Asteroids and lasers - what could possibly go wrong...
C
48
star
19

ESPNowSimpleSample

A simple example of using ESP-NOW for broadcast and peer to peer messaging
C++
32
star
20

platformio-tensorflow-lite

Easily extract the tfmicro framework for use in platform.io
Dockerfile
28
star
21

wordle_robot

A robot to solve wordle puzzles
Python
23
star
22

esp32-hsp-hf

ESP32 hsp_hf bluetooth profile using the bluekitchen/btstack
C
21
star
23

ICS-43434-breakout-board

Sample code for the ICS-43434 breakout board and the ESP32
C++
15
star
24

esp-now-range-test

Some simple code for testing esp now range
C++
14
star
25

ESP32RemoteLogging

This repository shows you how to log messages from your Arduino/ESP device to a remote logging system
C++
12
star
26

micropython-i2s-esp32-test

A simple example showing how to use MicroPython with I2S on the ESP32
C++
10
star
27

esp32_deep_sleep

Examples for ESP32 deep sleep
C++
10
star
28

ChessGPT

A Simple Plugin For ChatGPT to help it play chess
Python
10
star
29

ESP32-E-Paper-Weather

ESP32 E-Paper Weather Display using the LILYGO® TTGO T5s V2.8 ESP32 2.7" EPaper Plus Module
C++
9
star
30

chatgpt-memory

A simple experiment adding memory to ChatGPT
Python
8
star
31

esp32-ulp

A couple of demos showing how to use the Ultra Low Power coprocessor on the ESP32
C++
8
star
32

tensorflow-tutorial

A collection of simple tensorflow tutorials
Jupyter Notebook
8
star
33

ESP32Ota

Simple demonstration of updating the ESP32 Over The Air.
C++
6
star
34

stereo-i2s-amp-board

MAX98357 Stereo Amplifier Breakout Board
6
star
35

ESP32WebSPIFFS

Demonstration project serving html from SPIFFS on the ESP32
C++
5
star
36

as5048a-demo

Sample code for the AS5048A Magnetic Rotary Encoder
C++
4
star
37

supersise-seven-segment

C++
4
star
38

gpt-chess

Play chess against ChatGPT
TypeScript
3
star
39

esp32-gps

A simple example of connecting a GPS module to the ESP32
C++
2
star
40

wio-terminal-audio-monitor

A nice little audio visualiser for the Wio terminal using the built in microphone
C++
1
star
41

esp32-s3-pinouts

ESP32-S3 Pinout Quick Guide
1
star
42

esp32-jpeg-perf-tests

C
1
star
43

crypto-totals

Totals up all your crypto coins and tells you the total value
JavaScript
1
star
44

chatgpt-hangman

A plugin to play hangman with ChatGPT
Python
1
star
45

react-native-web-view

This repository demonstrates how to expose a native Swift view to React Native.
Java
1
star