No Description

philippe44 7d45fb6f8f CRLF hell 2 years ago
.github 2df24e2463 Update cmake.yml 4 years ago
.settings e51604dd3d more tweak 4 years ago
build-scripts 8b55fa3986 DAC I2S default were wrong - release 4 years ago
components 29a74b9ca8 tweak dac_controlset timing - release 4 years ago
esp-dsp @ de39220fb4 2345503f40 adding submodule 4 years ago
idf-patch c44c31f6d4 i2s ... 5 years ago
main d95d1cd3db green led fix + i2c timeout - release 4 years ago
plugin 7d45fb6f8f CRLF hell 2 years ago
server_certs 2e0ee1fff0 resolve certificate authority - release 4 years ago
.cproject 7c37a0cb1a tweaking JTAG debugging on Windows 4 years ago
.gitattributes a5b37a13c9 :confetti_ball: Added .gitattributes & .gitignore files 5 years ago
.gitignore d76001a023 update plugin link 2 years ago
.gitmodules 2345503f40 adding submodule 4 years ago
.project 7c37a0cb1a tweaking JTAG debugging on Windows 4 years ago
CMakeLists.txt 07873a7710 Jenkins integration - Migrate to CMake 5 years ago
Dockerfile 6cf04a3a83 Merge branch 'master' into nvs_parameters 5 years ago
Makefile ac1bd891e8 project_path #2 4 years ago
Makefile_std.mk c666ad8d63 add esp-dsp 4 years ago
README.md f06c08cef7 Update README.md 4 years ago
TODO 3304571312 add comments & and a TODO 5 years ago
alltags.txt c5fc6b8a81 nvs configuration fixes 5 years ago
github.pem 53369475dc More OTA work 5 years ago
makeBuildDocs.sh b1f234d460 Added in better build instructions. Added script for generating documentation and scripts to add to release zip. (#12) 5 years ago
non-ota-partitions.csv 372dcb1640 align non-ota build 5 years ago
partitions.csv e9ba659b4f Refactor configuration. needs new recovery image! -- release 5 years ago
repo.xml a51ff972ea repo update 4 years ago
sdkconfig.defaults 2597db9e15 add OggFlac & remove BLE - release 4 years ago

README.md

Squeezelite-esp32

What is this

Squeezelite-esp32 is an audio software suite made to run on espressif's ESP32 wifi (b/g/n) and bluetooth chipset. It offers the following capabilities

  • Stream your local music and connect to all major on-line music providers (Spotify, Deezer, Tidal, Qobuz) using Logitech Media Server - a.k.a LMS and enjoy multi-room audio synchronization. LMS can be extended by numerous plugins and can be controlled using a Web browser or dedicated applications (iPhone, Android). It can also send audio to UPnP, Sonos, ChromeCast and AirPlay speakers/devices.
  • Stream from a Bluetooth device (iPhone, Android)
  • Stream from an AirPlay controller (iPhone, iTunes ...) and enjoy synchronization multiroom as well (although it's AirPlay 1 only)

Depending on the hardware connected to the ESP32, you can send audio to a local DAC, to SPDIF or to a Bluetooth speaker. The bare minimum required hardware is a WROVER module with 4MB of Flash and 4MB of PSRAM (https://www.espressif.com/en/products/modules/esp32). With that module standalone, just apply power and you can stream to a Bluetooth speaker. You can also send audio to most I2S DAC as well as to SPDIF receivers using just a cable or an optical transducer (you'll need one resistor...)

But squeezelite-esp32 is highly extensible and you can add

  • Buttons and Rotary Encoder and map/combine them to various functions (play, pause, volume, next ...)
  • IR receiver (no pullup resistor or capacitor needed, just the 38kHz receiver)
  • Monochrome, GrayScale or Color displays using SPI or I2S (supported drivers are SH1106, SSD1306, SSD1322, SSD1326/7, SSD1351, ST7735 and ST7789).

Other features include

  • Resampling
  • 10-bands equalizer
  • Automatic initial setup using any WiFi device
  • Full web interface for further configuration/management
  • Firmware over-the-air update

Supported Hardware

Any esp32-based hardware with at least 4MB of flash and 4MB of PSRAM will be capable of running squeezelite-esp32 and there are various boards that include such chip. A few are mentionned below, but any should work.

Raw WROVER module

Per above description, a WROVER module is enough to run Squeezelite-esp32, but that requires a bit of tinkering to extend it to have analogue audio or hardware buttons (e.g.)

Please note that when sending to a Bluetooth speaker, then resampling must be enabled (using -R) option if you want to send audio with rate other than 44.1kHz. Similarly, when using SPDIF, only 44.1kHz and 48kHz are supported so you might have to enable resampling as well. If you connect a DAC, choice will depends on its capabilities. See below for more details.

Most DAC will work out-of-the-box with simply an I2S connection, but some require specific commands to be sent using I2C. See DAC option below to understand how to send these dedicated commands. There is build-in support for TAS575x, TAS5780, TAS5713 and AC101 DAC.

SqueezeAMP

This is the main hardware companion of Squeezelite-esp32 and has been developped together. Details on capabilities can be found here and here.

if you want to rebuild, use the squeezelite-esp32-SqueezeAmp-sdkconfig.defaults configuration file.

NB: You can use the pre-build binaries SqueezeAMP4MBFlash which has all the hardware I/O set properly. You can also use the generic binary I2S4MBFlash in which case the NVS parameters shall be set to get the exact same behavior

  • set_GPIO: 12=green,13=red,34=jack,2=spkfault
  • batt_config: channel=7,scale=20.24
  • dac_config: model=TAS57xx,bck=33,ws=25,do=32,sda=27,scl=26,mute=14:0
  • spdif_config: bck=33,ws=25,do=15

ESP32-A1S

Works with ESP32-A1S module that includes audio codec and headset output. You still need to use a demo board like this or an external amplifier if you want direct speaker connection.

The board showed above has the following IO set

  • amplifier: GPIO21
  • key2: GPIO13, key3: GPIO19, key4: GPIO23, key5: GPIO18, key6: GPIO5 (to be confirmed with dip switches)
  • key1: not sure, something with GPIO36
  • jack insertion: GPIO39 (inserted low)
  • LED: GPIO22 (active low) (note that GPIO need pullups)

So a possible config would be

  • set_GPIO: 21=amp,22=green:0,39=jack:0
  • dac_config: model=AC101,bck=27,ws=26,do=25,di=35,sda=33,scl=32
  • a button mapping:

    [{"gpio":5,"normal":{"pressed":"ACTRLS_TOGGLE"}},{"gpio":18,"pull":true,"shifter_gpio":5,"normal":{"pressed":"ACTRLS_VOLUP"}, "shifted":{"pressed":"ACTRLS_NEXT"}}, {"gpio":23,"pull":true,"shifter_gpio":5,"normal":{"pressed":"ACTRLS_VOLDOWN"},"shifted":{"pressed":"ACTRLS_PREV"}}]
    

    T-WATCH2020 by LilyGo

    This is a fun smartwatch based on ESP32. It has a 240x240 ST7789 screen and onboard audio. Not very useful to listen to anything but it works. This is an example of a device that requires an I2C set of commands for its dac (see below). There is a build-option if you decide to rebuild everything by yourself, otherwise the I2S default option works with the following parameters

  • dac_config: model=I2S,bck=26,ws=25,do=33,i2c=106,sda=21,scl=22

  • dac_controlset: { "init": [ {"reg":41, "val":128}, {"reg":18, "val":255} ], "poweron": [ {"reg":18, "val":64, "mode":"or"} ], "poweroff": [ {"reg":18, "val":191, "mode":"and"} ] }

  • spi_config: dc=27,data=19,clk=18

  • display_config: SPI,driver=ST7789,width=240,height=240,cs=5,back=12,speed=16000000,HFlip,VFlip

    ESP32-WROVER + I2S DAC

    Squeezelite-esp32 requires esp32 chipset and 4MB PSRAM. ESP32-WROVER meets these requirements. To get an audio output an I2S DAC can be used. Cheap PCM5102 I2S DACs work others may also work. PCM5012 DACs can be hooked up via:

I2S - WROVER
VCC - 3.3V
3.3V - 3.3V
GND - GND
FLT - GND
DMP - GND
SCL - GND
BCK - (BCK - see below)
DIN - (DO - see below)
LCK - (WS - see below) FMT - GND
XMT - 3.3V

Use the squeezelite-esp32-I2S-4MFlash-sdkconfig.defaults configuration file.

SqueezeAmpToo !

And the super cool project https://github.com/rochuck/squeeze-amp-too

Configuration

To access NVS, in the webUI, go to credits and select "shows nvs editor". Go into the NVS editor tab to change NFS parameters. In syntax description below <> means a value while [] describe optional parameters.

I2C

The NVS parameter "i2c_config" set the i2c's gpio used for generic purpose (e.g. display). Leave it blank to disable I2C usage. Note that on SqueezeAMP, port must be 1. Default speed is 400000 but some display can do up to 800000 or more. Syntax is

sda=<gpio>,scl=<gpio>[,port=0|1][,speed=<speed>]

SPI

The NVS parameter "spi_config" set the spi's gpio used for generic purpose (e.g. display). Leave it blank to disable SPI usage. The DC parameter is needed for displays. Syntax is

data=<gpio>,clk=<gpio>[,dc=<gpio>][,host=1|2]

DAC/I2S

The NVS parameter "dac_config" set the gpio used for i2s communication with your DAC. You can define the defaults at compile time but nvs parameter takes precedence except for SqueezeAMP and A1S where these are forced at runtime. If your DAC also requires i2c, then you must go the re-compile route. Syntax is

bck=<gpio>,ws=<gpio>,do=<gpio>[,mute=<gpio>[:0|1][,model=TAS57xx|TAS5713|AC101|I2S][,sda=<gpio>,scl=gpio[,i2c=<addr>]]

if "model" is not set or is not recognized, then default "I2S" is used. I2C parameters are optional an only needed if your dac requires an I2C control (See 'dac_controlset' below). Note that "i2c" parameters are decimal, hex notation is not allowed.

The parameter "dac_controlset" allows definition of simple commands to be sent over i2c for init, power on and off using a JSON syntax:

{ init: [ {"reg":<register>,"val":<value>,"mode":<nothing>|"or"|"and"}, ... {{"reg":<register>,"val":<value>,"mode":<nothing>|"or"|"and"} ],
  poweron: [ {"reg":<register>,"val":<value>,"mode":<nothing>|"or"|"and"}, ... {{"reg":<register>,"val":<value>,"mode":<nothing>|"or"|"and"} ],
  poweroff: [ {"reg":<register>,"val":<value>,"mode":<nothing>|"or"|"and"}, ... {{"reg":<register>,"val":<value>,"mode":<nothing>|"or"|"and"} ] }

This is standard JSON notation, so if you are not familiar with it, Google is your best friend. Be aware that the '...' means you can have as many entries as you want, it's not part of the syntax. Every section is optional, but it does not make sense to set i2c in the 'dac_config' parameter and not setting anything here. The parameter 'mode' allows to or the register with the value or to and it. Don't set 'mode' if you simply want to write. Note that all values must be decimal. You can use a validator like this to verify your syntax

NB: For well-known configuration, this is ignored

SPDIF

The NVS parameter "spdif_config" sets the i2s's gpio needed for SPDIF.

SPDIF is made available by re-using i2s interface in a non-standard way, so although only one pin (DO) is needed, the controller must be fully initialized, so the bit clock (bck) and word clock (ws) must be set as well. As i2s and SPDIF are mutually exclusive, you can reuse the same IO if your hardware allows so.

You can define the defaults at compile time but nvs parameter takes precedence except for SqueezeAMP where these are forced at runtime.

Leave it blank to disable SPDIF usage, you can also define them at compile time using "make menuconfig". Syntax is

bck=<gpio>,ws=<gpio>,do=<gpio>

NB: For well-known configuration, this is ignored

Display

The NVS parameter "display_config" sets the parameters for an optional display. Syntax is

I2C,width=<pixels>,height=<pixels>[address=<i2c_address>][,reset=<gpio>][,HFlip][,VFlip][driver=SSD1306|SSD1326[:1|4]|SSD1327|SH1106]
SPI,width=<pixels>,height=<pixels>,cs=<gpio>[,back=<gpio>][,reset=<gpio>][,speed=<speed>][,HFlip][,VFlip][driver=SSD1306|SSD1322|SSD1326[:1|4]|SSD1327|SH1106|SSD1675|ST7735|ST7789[,rotate]]
  • back: a LED backlight used by some older devices (ST7735). It is PWM controlled for brightness
  • reset: some display have a reset pin that is should normally be pulled up if unused
  • VFlip and HFlip are optional can be used to change display orientation
  • rotate: for non-square drivers, move to portrait mode. Note that width and height must be inverted then
  • Default speed is 8000000 (8MHz) but SPI can work up to 26MHz or even 40MHz
  • SH1106 is 128x64 monochrome I2C/SPI here
  • SSD1306 is 128x32 monochrome I2C/SPI here
  • SSD1322 is 128x128 16-level grayscale SPI here - artwork can be up to 96x96 with vertical vu-meter/spectrum
  • SSD1351 is 128x128 65k/262k color SPI here
  • SSD1326 is 256x32 monochrome or grayscale 16-levels SPI here
  • SSD1327 is 256x64 grayscale 16-levels SPI in multiple sizes here - it is very nice
  • SSD1675 is an e-ink paper and is experimental as e-ink is really not suitable for LMS du to its very low refresh rate
  • ST7735 is a 128x160 65k color SPI here. This needs a backlight control
  • ST7789 is a 240x320 65k (262k not enabled) color SPI here. It also exist with 240x240 displays. See rotate for use in portrait mode

To use the display on LMS, add repository https://raw.githubusercontent.com/sle118/squeezelite-esp32/master/plugin/repo.xml. You will then be able to tweak how the vu-meter and spectrum analyzer are displayed, as well as size of artwork. You can also install the excellent plugin "Music Information Screen" which is super useful to tweak the layout.

The NVS parameter "metadata_config" sets how metadata is displayed for AirPlay and Bluetooth. Syntax is

[format=<display_content>][,speed=<speed>][,pause=<pause>]
  • 'speed' is the scrolling speed in ms (default is 33ms)

  • 'pause' is the pause time between scrolls in ms (default is 3600ms)

  • 'format' can contain free text and any of the 3 keywords %artist%, %album%, %title%. Using that format string, the keywords are replaced by their value to build the string to be displayed. Note that the plain text following a keyword that happens to be empty during playback of a track will be removed. For example, if you have set format=%artist% - %title% and there is no artist in the metadata then only