Giter VIP home page Giter VIP logo

pschatzmann / arduino-audio-driver Goto Github PK

View Code? Open in Web Editor NEW
45.0 6.0 8.0 2.32 MB

Flexible driver library for audio boards and codec chips e.g AC101 ES8388 ES8311 CS43l22 ES7243 etc

License: GNU General Public License v3.0

C++ 32.42% C 59.37% HTML 8.09% CMake 0.12%
arduino-library ac101 audiokit cs43l22 es8311 es8388 lyrat es7243 wm8960 es8156 es8960 wm8994 audio-driver audio-drivers

arduino-audio-driver's Introduction

Arduino Audio Driver

I was never quite happy with my AudioKit project, that was a quick and dirty adaptation of the Espressif IDF Drivers for Arduino.

In this project I finally implemented some clean and simple C++ classes. This reduced the complexity considerably and increased the flexibility tremendously!

The goal of this project is to provide an easy API to configure different audio codec chips. After setting up the codec, you can use the I2S functionality provided by your microcontroller.

Supported audio codec chips are e.g

  • AC101
  • ES8388
  • ES8311
  • CS43l22
  • ES7243
  • etc

While you can use this library stand alone, I recommend to use it together with my AudioTools project which provides a nice integration with it's I2SCodecStream class. Further information can be found in the Wiki.

Documentation

Support

I spent a lot of time to provide a comprehensive and complete documentation. So please read the documentation first and check the issues and discussions before posting any new ones on Github.

Open issues only for bugs and if it is not a bug, use a discussion: Provide enough information about

  • the selected scenario/sketch
  • what exactly you are trying to do
  • your hardware
  • your software versions
  • what exactly your problem is

to enable others to understand and reproduce your issue.

Finally, don't send me any e-mails or post questions on my personal website!

Installation in Arduino

You can download the library as zip and call include Library -> zip library. Or you can git clone this project into the Arduino libraries folder e.g. with

cd  ~/Documents/Arduino/libraries
git clone https://github.com/pschatzmann/arduino-audio-driver.git

I recommend to use git because you can easily update to the latest version just by executing the git pull command in the project folder.

Sponsor Me

This software is totally free, but you can make me happy by rewarding me with a treat

arduino-audio-driver's People

Contributors

alteman avatar fathermarco1971 avatar pschatzmann avatar uutzinger 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  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

arduino-audio-driver's Issues

Encoding failed: Handle passed to function call was invalid

Hi, I am using the codec with Arduino Audio Tools on an Audio Kit board.

[E] AACEncoderFDK.h : 234 - Encoding failed: Handle passed to function call was invalid

I am using the streams-audiokit-webserver_aac.ino example.
I am also using the new Auduino-Audio-Driver.
I am also using the auduino-fdk-acc codec

The code builds and uploads but i get this runtime error in the serial monitor when i connect to the web server via Chrome.

Thanks

Eric

suggest explicit braces to avoid ambiguous 'else' [-Werror=dangling-else]

Error in title compiling main stream:

for (auto &tmp : spi) {
      AD_LOGD("DriverPins::begin::SPI::begin");
      if (tmp.function == PinFunction::SD)
        if (sd_active)
          result &= tmp.begin();
      else
        result &= tmp.begin();
    }

I think that adding braces make code cleaer effectively

   for (auto &tmp : spi) {
      AD_LOGD("DriverPins::begin::SPI::begin");
      if (tmp.function == PinFunction::SD)
      {
        if (sd_active)
          result &= tmp.begin();
      else
        result &= tmp.begin();
      }
    }

Audio kit keeps rebooting

I have the ESP32 Audio kit V2.2 and I am running this code:

#include <Arduino.h>

/**
 * @brief We use a predefied board (AudioKitEs8388V1) and output_device a sine
 * with the help of the AudioTools I2SCodecStream
 * @author phil schatzmann
 */

#include "AudioTools.h" // install https://github.com/pschatzmann/arduino-audio-tools
#include "AudioLibs/I2SCodecStream.h"

AudioInfo info(44100, 2, 16);
SineWaveGenerator<int16_t> sineWave(32000);
GeneratedSoundStream<int16_t> sound(sineWave);
I2SCodecStream out(AudioKitEs8388V1);
StreamCopy copier(out, sound);

void setup()
{
  // Setup logging
  Serial.begin(115200);
  AudioLogger::instance().begin(Serial, AudioLogger::Warning);
  LOGLEVEL_AUDIODRIVER = AudioDriverWarning;

  // start I2S & codec with i2c and i2s configured above
  Serial.println("starting I2S...");
  auto config = out.defaultConfig();
  config.copyFrom(info);
  out.begin(config);

  // Setup sine wave
  sineWave.begin(info, N_B4);
}

// Arduino loop - copy sound to out
void loop() { copier.copy(); }

on PlatformIO
with this platformio.ini


[platformio]
description = Audio Example
default_envs = esp32dev

[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32.git
board = esp32dev
framework = arduino
lib_deps =  
    https://github.com/pschatzmann/arduino-audio-tools.git
    https://github.com/pschatzmann/arduino-audio-driver.git
lib_ldf_mode = deep+
build_flags =  -DCORE_DEBUG_LEVEL=5 -DAUDIOKIT_BOARD=5 
monitor_speed = 115200
monitor_filters = esp32_exception_decoder

Compile and upload work fine, but it keeps rebooting with this message :


ELF file SHA256: 11734f0e505573e4

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x1f (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4
[    23][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
starting I2S...
Warning: Pin '13' not set up because of conflict
[    35][I][esp32-hal-i2c.c:75] i2cInit(): Initialising I2C Master: sda=33 scl=32 freq=100000
Error:   ->p_wire->endTransmission: 2
Error:   ES8388 not found on I2C address 10, check wiring
Error:   AudioDriver::begin::init failed
Error:   ->p_wire->endTransmission: 2
Error:   ->p_wire->endTransmission: 2
Error:   ->p_wire->endTransmission: 2
Error:   ->p_wire->endTransmission: 2
Error:   ->p_wire->endTransmission: 2
Error:   ->p_wire->endTransmission: 2
[E] I2SCodecStream.h : 73 - virtual bool audio_tools::I2SCodecStream::begin()
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400e1cda  PS      : 0x00060a30  A0      : 0x800d3f4b  A1      : 0x3ffb2120  
A2      : 0x00000000  A3      : 0x3ffba8a0  A4      : 0x00000400  A5      : 0x3ffb2160  
A6      : 0xffffffff  A7      : 0x3ffc2f24  A8      : 0x00000000  A9      : 0x3ffb2120  
A10     : 0x3ffb2164  A11     : 0x00000010  A12     : 0x40ac101f  A13     : 0x37354443  
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x0000001d  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000018  LBEG    : 0x400029ac  LEND    : 0x400029cb  LCOUNT  : 0x00000000  


Backtrace: 0x400e1cd7:0x3ffb2120 0x400d3f48:0x3ffb2160 0x400d3ff9:0x3ffb21d0 0x400d4039:0x3ffb21f0 0x400d5cd7:0x3ffb2210 0x400d5e90:0x3ffb2230 0x400d5fa6:0x3ffb2270 0x400de4a9:0x3ffb2290




ELF file SHA256: 11734f0e505573e4

Rebooting...

What am I doing wrong?
Thanks!

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.