Files
snapclient/README.md

100 lines
4.2 KiB
Markdown
Raw Normal View History

2020-05-27 00:30:43 +02:00
# Snapcast client for ESP32
2020-05-27 00:12:46 +02:00
2020-05-27 00:30:43 +02:00
### Synchronous Multiroom audio streaming client for [Snapcast](https://github.com/badaix/snapcast) ported to ESP32
2020-05-27 00:12:46 +02:00
2020-05-27 00:30:43 +02:00
## Feature list
- Opus decoding currently supported
- Wifi connection hardcoded in app
2020-06-06 00:13:03 +02:00
- Auto connect to snapcast server on network
2020-05-27 00:30:43 +02:00
- Buffers up to 150 ms on Wroom modules
- Buffers more then enough on Wrover modules
2020-06-06 00:13:03 +02:00
- Multiroom sync delay controlled from Snapcast server
## Description
I have continued the work from @badaix and @bridadan towards a ESP32 Snapcast client. Currently it support basic features like multirum sync, network controlled volume and mute. For now it only support Opus 16bit/48Khz audio streams and the synchornization part is still being worked on.
Please check out the task list and feel free to fill in.
I have used the Infineon MA12070P Multi level Class D combined coded/amp due to its superior power effecienty on a high supply rail. It allows battery power system with good playback time at normal listen level and stil have the power to start the party.
### Codebase
2020-06-06 00:13:03 +02:00
The codebase is split into components and build on vanilla ESP-IDF. I stil have some refactoring on the todo list as the concept has started to settle and allow for new features can be added in a stuctured manner. In the code you will find parts that are only partly related features and still not on the task list.
Components
- MerusAudio : Low level communication interface MA12070P
- opus : Opus audio coder/decoder full submodule
- rtprx : Alternative RTP audio client UDP low latency also opus based
- lightsnapcast : Port of @bridadan scapcast packages decode library
- libbuffer : Generic buffer abstraction
- esp-dsp : Port of ESP-DSP library - stripped version - submodule considered
- dsp_processor : Audio Processor and I2S low level interface including sync buffer
2020-05-27 00:12:46 +02:00
### Hardware
- ESP pinout MA12070P
------------------------------------------------------
-> I2S_BCK Audio Clock 3.072 MHz
-> I2S_WS Frame Word Select or L/R
-> GND Ground
-> I2S_DI Audio data 24bits LSB first
-> MCLK Master clk connect to I2S_BCK
-> I2C_SCL I2C clock
-> I2C_SDA I2C Data
-> GND Ground
-> NENABLE Amplifier Enable active low
-> NMUTE Amplifier Mute active low
2020-05-27 00:30:43 +02:00
## Build
Clone this repo:
2020-05-27 16:45:05 +02:00
git clone https://github.com/jorgenkraghjakobsen/snapclint
2020-05-27 00:30:43 +02:00
Update third party code:
2020-05-27 16:49:06 +02:00
git submodule update --init
2020-05-27 00:12:46 +02:00
2020-05-27 00:30:43 +02:00
Configure to match your setup:
2020-05-27 00:12:46 +02:00
- Wifi network name and password
- Audio coded setup
2020-05-27 00:30:43 +02:00
Build, compile and flash:
2020-05-27 16:49:06 +02:00
idf.py build flash monitor
2020-05-27 00:12:46 +02:00
2020-05-27 00:30:43 +02:00
## Test
2020-05-27 00:12:46 +02:00
Setup a snapcast server on your network
2020-05-27 00:30:43 +02:00
2020-05-27 00:12:46 +02:00
On a linux box:
2020-05-27 00:30:43 +02:00
2020-05-27 00:12:46 +02:00
Clone snapcast build and start the server
2020-05-27 00:30:43 +02:00
2020-05-27 16:45:05 +02:00
./snapserver
2020-05-27 00:30:43 +02:00
2020-05-27 00:12:46 +02:00
Pipe some audio to the snapcast server fifo
2020-05-27 00:30:43 +02:00
2020-05-27 16:45:05 +02:00
mplayer http://ice1.somafm.com/secretagent-128-aac -ao pcm:file=/tmp/snapfifo -af format=s16LE -srate 48000
2020-05-27 00:30:43 +02:00
2020-05-27 00:12:46 +02:00
Test the server config on other knowen platform
2020-05-27 00:30:43 +02:00
2020-05-27 16:45:05 +02:00
./snapclient from the snapcast repo
2020-05-27 00:30:43 +02:00
2020-05-27 00:12:46 +02:00
Android : snapclient from the app play store
2020-05-27 16:49:06 +02:00
## Task list
2020-06-06 00:13:03 +02:00
- [ok] Fix to alinge with above
2020-05-27 16:49:06 +02:00
* kconfig
* add codec description
2020-05-27 00:12:46 +02:00
- [ ] Integrate ESP wifi provision
2020-05-31 01:04:27 +02:00
- [ok] Find and connect to Avahi broadcasted Snapcast server name
2020-05-27 00:12:46 +02:00
- [ ] Add a client command interface layer like volume/mute control
- [ ] Build a ESP-ADF branch
2020-05-31 01:04:27 +02:00
## Minor task
2020-06-06 00:13:03 +02:00
- [ ] Propergate mute/unute from server message to DSP backend mute control.
- [ ] soft mute - play sample in buffer with decresing volume
- [ok] hard mute - pass on zero at the DSP hackend
- [ ] Startup: do not start parsing on samples to codec before sample ring buffer hits requested buffer size.
- [ok] Start from empty buffer