Git Product home page Git Product logo

esp_a2dp_sink_spdif's Introduction

ESP32 S/PDIF driver

This is the S/PDIF driver for ESP32.

The driver files are follows.

  • spdif.h
  • spdif.c

The three APIs are provided.

  • void spdif_init(int rate)
  • void spdif_write(const void *src, size_t size)
  • void spdif_set_sample_rates(int rate)

Example

The driver project includes modified version of a2dp_sink example to use the S/PDIF driver.

Hardware Required

The S/PDIF toslink transmitter is needed. The default data output pin is GPIO27. You can change the pin to use "idf.py menuconfig". circuit board

Configure the project

idf.py menuconfig

Build and Flash

idf.py -p PORT flash monitor

(To exit the serial monitor, type Ctrl-].)

esp_a2dp_sink_spdif's People

Contributors

amedes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

joba-1 blrichwine

esp_a2dp_sink_spdif's Issues

Soft clicks generated by a2dp to spdif chain after ~1-2 min

Hi Amedes,

thanks for your spdif encoder. In itself it works great.
Unfortunately the higher I2S frequency or the added encoding burden seem to consistently break the ESP32 A2DB stream in my tests.

I'd like to ask if you experience the same issue or if I maybe doing somthing wrong?

What I did (not too much to do wrong here, I guess):

  • download and install current esp32 idf (5.0)
  • git clone your repo
  • init the idf environment
  • build, flash and monitor your code on an esp32 with a toslink transceiver at pin 27

What I get when sending sound from my phone:

  • crystal clear sound via my soundcard optical in or my av receiver with its own dac for ~1-2min - hooray!
  • then soft clicks every ~4-5s begin, each accompanied by one warning message "W (120735) BT_APPL: Pkt dropped" :(

I worked on this with pschatzmann, who added SPDIF to his arduino-audio-tools and I even added tasks doing the encoding and i2s writes on the other core to remove stress from the bluetooth core. But same issue, so far nothing helped.
pschatzmann/ESP32-A2DP#168,
pschatzmann/ESP32-A2DP#137

I also added an issue on the espressif idf repo, but so far no reaction.
espressif/esp-idf#8368

My current point of view is: the dropped frame in the bluetooth layer leads to an incomplete stream delivered via the bt callback to your encoder. Since this drop happens inside the closed source code, one can only influence it by changing configuration. The algorithm itself is ok, verified by encoding and sending a locally generated sine wave.

I hope you have some insights there, that might help making it work - would be awsome to get rid of the analog line from the esp to the receiver.

Regards,
Joachim

Example from SD card?

Hello, your project is the only one that i checked and can really generate audio. Do you perhaps have example on how to play mp3 from sd card?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.