GNU General Public License v3.0

项目介绍

schreibfaul1/ESP32-audioI2S 是一个托管在 GitHub 上的开源项目,主要使用 C 编写,采用 GNU General Public License v3.0 许可证,目前获得 1.7k 个 Star、426 次 Fork。

仓库全名
schreibfaul1/ESP32-audioI2S
开源许可证
GNU General Public License v3.0
Star 数
1.7k
Fork 数
426
未关闭 Issue
10

README 摘要

ESP32-audioI2S :warning: This library only works on multi-core chips like ESP32-S3, ESP32-S31 and ESP32-P4. The ESP32 is suitable to a limited extent. PSRAM is required! It does not work on the ESP32-S2, ESP32-C3 etc :warning: Supported codecs: wav, mp3, aac, flac, opus, vorbis Sampling rate: 16–48 kHz Bits per sample: 8, 16, 24, 32 Container formats: ogg, mp4, m3u8 The output sample rate can be set to a fixed value…

完整内容见 GitHub 原始 README 或本页 。

常见问题

ESP32-audioI2S 用什么语言开发?

主要使用 C 编写,采用 GNU General Public License v3.0 许可证,目前有 1.7k 个 Star。

ESP32-audioI2S 可以免费商用吗?

仓库标注的许可证为 GNU General Public License v3.0,商用前请先阅读仓库 LICENSE 文件确认授权范围。

如何获取 ESP32-audioI2S 的源码?

可以直接克隆仓库:git clone https://github.com/schreibfaul1/ESP32-audioI2S.git,默认分支为 master;安装与运行步骤见仓库 README。

ESP32-audioI2S 最近还在维护吗?

仓库最近一次更新为 1 天前,当前有 10 个未关闭 Issue;Star 数为 1.7k,可作为社区活跃度的参考。

简要分析

热度分
2613
价值分
1163
活跃状态
活跃

语言占比

C
C++
CMake

Release

README

ESP32-audioI2S

:warning: This library only works on multi-core chips like ESP32-S3, ESP32-S31 and ESP32-P4.
The ESP32 is suitable to a limited extent. PSRAM is required!
It does not work on the ESP32-S2, ESP32-C3 etc
:warning:

Supported codecs: wav, mp3, aac, flac, opus, vorbis
Sampling rate: 16–48 kHz
Bits per sample: 8, 16, 24, 32
Container formats: ogg, mp4, m3u8

The output sample rate can be set to a fixed value of 44.1 or 48 kHz if required by the external I²S device

Works with MAX98357A (3 Watt amplifier with DAC), connected three lines (DOUT, BLCK, LRC) to I2S. The I2S output frequency is always 48kHz, regardless of the input source, so Bluetooth devices can also be connected without any problems. For stereo are two MAX98357A necessary. AudioI2S works with UDA1334A (Adafruit I2S Stereo Decoder Breakout Board), PCM5102A and CS4344. Other HW may work but not tested. Plays also icy-streams, GoogleTTS and OpenAIspeech. Can be compiled with Arduino IDE. WIKI

#include "Arduino.h"
#include "WiFi.h"
#include "Audio.h"

// Digital I/O used
#define I2S_DOUT      25
#define I2S_BCLK      27
#define I2S_LRC       26

String ssid =     "*******";
String password = "*******";

Audio audio;

// callbacks
void my_audio_info(Audio::msg_t m) {
    Serial.printf("%s: %s\n", m.s, m.msg);
}

void setup() {
    Audio::audio_info_callback = my_audio_info; // optional
    Serial.begin(115200);
    WiFi.begin(ssid.c_str(), password.c_str());
    while (WiFi.status() != WL_CONNECTED) delay(1500);
    audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
    audio.setVolume(21); // default 0...21
    audio.connecttohost("http://stream.antennethueringen.de/live/aac-64/stream.antennethueringen.de/");
}

void loop(){
    audio.loop();
    vTaskDelay(1);
}

You can find more examples here: https://github.com/schreibfaul1/ESP32-audioI2S/tree/master/examples

// detailed cb output
void my_audio_info(Audio::msg_t m) {
    switch(m.e){
        case Audio::evt_info:           Serial.printf("info: ....... %s\n", m.msg); break;
        case Audio::evt_eof:            Serial.printf("end of file:  %s\n", m.msg); break;
        case Audio::evt_bitrate:        Serial.printf("bitrate: .... %s\n", m.msg); break; // icy-bitrate or bitrate from metadata
        case Audio::evt_icyurl:         Serial.printf("icy URL: .... %s\n", m.msg); break;
        case Audio::evt_id3data:        Serial.printf("ID3 data: ... %s\n", m.msg); break; // id3-data or metadata
        case Audio::evt_lasthost:       Serial.printf("last URL: ... %s\n", m.msg); break;
        case Audio::evt_name:           Serial.printf("station name: %s\n", m.msg); break; // station name or icy-name
        case Audio::evt_streamtitle:    Serial.printf("stream title: %s\n", m.msg); break;
        case Audio::evt_icylogo:        Serial.printf("icy logo: ... %s\n", m.msg); break;
        case Audio::evt_icydescription: Serial.printf("icy descr: .. %s\n", m.msg); break;
        case Audio::evt_image: for(int i = 0; i < m.vec1.size(); i += 2){
                                        Serial.printf("cover image:  segment %02i, pos %07lu, len %05lu\n", i / 2, m.vec1[i], m.vec1[i + 1]);} break; // APIC
        case Audio::evt_lyrics:         Serial.printf("sync lyrics:  %s\n", m.msg); break;
        case Audio::evt_log   :         Serial.printf("audio_logs:   %s\n", m.msg); break;
        default:                        Serial.printf("message:..... %s\n", m.msg); break;
    }
}


Wiring schematic


Impulse diagram Impulse diagram


评论

暂无评论