Giter Site home page Giter Site logo

bobh / esp32audioframework Goto Github PK

View Code? Open in Web Editor NEW
40.0 6.0 3.0 5.79 MB

Dual core concurrent multi-task processing of continuous real-time audio on the ESP-32

License: MIT License

C++ 100.00%
audio multi-task sweep esp32 esp32-arduino realtime

esp32audioframework's Introduction

Dual Core Audio Framework for ESP32

Proof Of Concept Demos: Dual core concurrent multi-task processing of continuous real-time audio on the ESP-32.

Tested on Espressif ESP32 Dev board Rev. 1 silicon

Arduino IDE with the ESP32 core from espressif

ADC/DAC sample processing at 8Ksps for voice audio range (< 4KHz). Not suitable for music as is.

Core 1 -- Sample Service

Core 0 -- Application Processor

Cores use alternating ping-pong buffers to pass samples between them every N samples. Tasks synchronize on a "FrameAvailable" semaphore.

Frame processing runs every N samples on the Application Processor. The Frame processing technique introduces latency delay (audio input to output).

Concurrency examples include:

  • Continuous sine wave
  • Dual tone (frequencies re-create old telephone dial tone)
  • Continuous phase frequency sweep test signal (300--3000 Hz in 5 sec.,repeated)
  • Microphone talk-through
  • Pink Noise example from portaudio.com
  • Voice Alert Example

I'll add more Digital Signal Processing examples to test the limits of this framework. And maybe find some optimizations.

bobolink twitter: @wm6h


ref: esp32 arduino ide https://github.com/espressif/arduino-esp32

Sensorsslot's ESP32 Arduino IDE Dual core multi-tasking intro: YouTube video: https://www.youtube.com/watch?v=k_D_Qu0cgu8 http://esp32.info/docs/esp_idf/html/dd/d3c/group__xTaskCreate.html

some watchdog info: espressif/arduino-esp32#595

You can do Digital Filtering with a MCU YouTube https://www.youtube.com/watch?v=k0LHp6jtHA8

High-Voltage Signal Conditioning for Low-Voltage ADCs http://www.ti.com/lit/an/sboa097b/sboa097b.pdf

Audio Out Circuit.

The PAM 8403 uses 5VDC from the ESP-32 Dev Board. Output is on DAC1 GPIO pin 25 of the ESP32 No DAC re-construction filter is used. Some aliasing on the sweep app is heard at high volume. Maybe a re-construction at the DAC output would help.

Audio In circuit: SparkFun Electret Microphone Breakout BOB-12758 https://www.sparkfun.com/products/12758 It has a freq. response to 10KHz and we sample at 8Ksps so a pole is added to its response to turn it into a 1st order (20 dB/Decade power drop-off) anti-aliasing filter (LPF) with 4KHz cutoff Add a 47pF cap across R5 (820K). From JP1-3 to U1-4 is easier. We would like a 2nd order filter here (40 dB/Decade power drop-off). https://cdn.sparkfun.com/datasheets/BreakoutBoards/Electret_Microphone_Breakout_v20.pdf

note: this circuit could be avoided by sampling at 16Ksps

mic audio is on analogRead(34) ADC_WIDTH_9Bit to more or less match the DAC 8 bits. An ADC_ATTEN_11db pad is set in order to run the mic at 3.3 Volts

3/10/18 Pink Noise example from portaudio.com modified for ESP32 Audio Framework. Statistics haven't been verified with spectrum analyzer.

3/15/18 modified sine generator with nkolban's BLE library. Select freq of sine over BLE (30-3000 Hz UTF-8 unsigned int string < 5 chars). https://youtu.be/MGNU7COFlT4

3/21/18 Voice Alert example. Audio samples stored as an array in the source. File edited in Audacity (Audacity.com) and saved as mono, 8Ksps, signed 16-bit PCM Microsoft WAV file. Converted to C source with xxd -i fn.wav fn.c

3/24/18 Project completed and Summary.md posted.

BlockDiagram

ESP32_AudioFramework

esp32audioframework's People

Contributors

bobh 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

esp32audioframework's Issues

Error on TwoCoreTalkThrough

Hi, Trying out the 2 core demos and the code errors out after the first print of Setup: Executing on Core 1.

`Frame Processing: Executing on core 0
Setup: Executing on core 1

assert failed: xQueueGenericSend queue.c:832 (pxQueue->pcHead != ((void *)0) || pxQueue->u.xSemaphore.xMutexHolder == ((void *)0) || pxQueue->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle())

Backtrace: 0x40083445:0x3ffcd820 0x4008804d:0x3ffcd840 0x4008cf31:0x3ffcd860 0x40088852:0x3ffcd990 0x400d17b9:0x3ffcd9d0 0x400d2bcd:0x3ffcd9f0`

Am using a ESP32-WROOM-32 generic board.

Any ideas where to look?

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.