This commit is contained in:
2026-02-12 21:00:02 -08:00
parent 77f8236347
commit 8bdbf227ca
1141 changed files with 1010880 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
# I2S to Webserver
This sketch reads sound data from I2S. The result is provided as WAV stream which can be listened to in a Web Browser
![INMP441](https://pschatzmann.github.io/Resources/img/inmp441.jpeg)
The INMP441 is a high-performance, low power, digital-output, omnidirectional MEMS microphone with a bottom port. The complete INMP441 solution consists of a MEMS sensor, signal conditioning, an analog-to-digital converter, anti-aliasing filters, power management, and an industry-standard 24-bit I²S interface. The I²S interface allows the INMP441 to connect directly to digital processors, such as DSPs and microcontrollers, without the need for an audio codec in the system.
## Pins
| INMP441 | ESP32
| --------| ---------------
| VDD | 3.3
| GND | GND
| SD | IN (GPIO32)
| L/R | GND
| WS | WS (GPIO15)
| SCK | BCK (GPIO14)
- SCK: Serial data clock for I²S interface
- WS: Select serial data words for the I²S interface
- L/R: Left / right channel selection
When set to low, the microphone emits signals on the left channel of the I²S frame.
When the high level is set, the microphone will send signals on the right channel.
- ExSD: Serial data output of the I²S interface
- VCC: input power 1.8V to 3.3V
- GND: Power groundHigh PSR: -75 dBFS.

View File

@@ -0,0 +1,41 @@
/**
* @file streams-i2s-webserver_wav.ino
*
* This sketch reads sound data from I2S. The result is provided as WAV stream which can be listened to in a Web Browser
*
* @author Phil Schatzmann
* @copyright GPLv3
*/
#include "AudioTools.h"
#include "AudioTools/Communication/AudioHttp.h"
//AudioEncodedServer server(new WAVEncoder(),"ssid","password");
AudioWAVServer server("ssid","password"); // the same a above
I2SStream i2sStream; // Access I2S as stream
ConverterFillLeftAndRight<int16_t> filler(LeftIsEmpty); // fill both channels - or change to RightIsEmpty
void setup(){
Serial.begin(115200);
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
// start i2s input with default configuration
Serial.println("starting I2S...");
auto config = i2sStream.defaultConfig(RX_MODE);
config.i2s_format = I2S_STD_FORMAT; // if quality is bad change to I2S_LSB_FORMAT https://github.com/pschatzmann/arduino-audio-tools/issues/23
config.sample_rate = 22050;
config.channels = 2;
config.bits_per_sample = 16;
i2sStream.begin(config);
Serial.println("I2S started");
// start data sink
server.begin(i2sStream, config, &filler);
}
// Arduino loop
void loop() {
// Handle new connections
server.copy();
}