Git Product home page Git Product logo

adafruit_zeroi2s's Introduction

Adafruit ZeroI2S Build StatusDocumentation

I2S audio playback library for the Arduino Zero / Adafruit M0 (SAMD21 processor) -and- Adafruit M4 (SAMD51 processor) boards

Supports:

  • DMA / interrupt support. Uses the Adafruit ZeroDMA library to set up DMA transfers, see examples!
  • Both Transmit (audio/speaker output) & Receive (audio/mic input) support.

TODO:

  • MCLK output. Only supports output for BCLK, LRCLK, and data.

Installation

To install, use the Arduino Library Manager and search for "Adafruit ZeroI2S" and install the library.

Dependencies

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Documentation and doxygen

Documentation is produced by doxygen. Contributions should include documentation for any new code added.

Some examples of how to use doxygen can be found in these guide pages:

https://learn.adafruit.com/the-well-automated-arduino-library/doxygen

https://learn.adafruit.com/the-well-automated-arduino-library/doxygen-tips

Formatting and clang-format

This library uses clang-format to standardize the formatting of .cpp and .h files. Contributions should be formatted using clang-format:

The -i flag will make the changes to the file.

clang-format -i *.cpp *.h

If you prefer to make the changes yourself, running clang-format without the -i flag will print out a formatted version of the file. You can save this to a file and diff it against the original to see the changes.

Note that the formatting output by clang-format is what the automated formatting checker will expect. Any diffs from this formatting will result in a failed build until they are addressed. Using the -i flag is highly recommended.

clang-format resources

About this Driver

Written by Dean Miller for Adafruit Industries. MIT license, check license.txt for more information All text above must be included in any redistribution

adafruit_zeroi2s's People

Contributors

deanm1278 avatar dfl avatar dhalbert avatar evaherrada avatar ladyada avatar macegr avatar sah avatar siddacious avatar tdicola 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

Watchers

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

adafruit_zeroi2s's Issues

Feature Request: Slave mode support

  • Arduino board: Arduino MKR Zero

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.9

I briefly tested the library on my board and used the tone_generator example as a base. It worked great however it seems that I2S is always initialized in master mode. For my use case, I would like to use an external ADC that is run in master mode and use the Arduino in slave mode. It would be great if you could implement that in the library.

48kHz output mismatch

  • Arduino board: Sparkfun ATSAMD21G R3 Breakout Board

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.18.19

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

Hi!

I2S audio amplifier connected to the standard pins (D0 frame clock, D1 bit clock, D9 data). Works well and is stable with all the Adafruit Github demos included in the library, thanks so much for sharing this code.

My specific issue is in the DMA demo from here:

https://github.com/adafruit/Adafruit_ZeroI2S/blob/master/examples/dma/dma.ino

This demo code works perfectly and I've verified the frame sync frequency on my 'scope is correct:

  /* begin I2S on the default pins. 24 bit depth at
   * 44100 samples per second
   */
  i2s.begin(I2S_32_BIT, 44100);
  i2s.enableTx();

  stat = myDMA.startJob();

However, changing the sample rate to this instead

  /* begin I2S on the default pins. 24 bit depth at
   * 44100 samples per second
   */
  i2s.begin(I2S_32_BIT, 48000);
  i2s.enableTx();

  stat = myDMA.startJob();

... results in clock frequency of 50.00 Khz

Being curious, I set the frequency to 8000 and measured 8.07 Khz, which tracks since I'm using the internal oscillator, not a crystal.

Other testing:

8000 Hz request --> 8.07 kHz output
46kHz request --> 46.89 kHz output
48kHz request --> 50.00 kHz output

Maybe I've made a silly error somewhere? I'm running the demo code otherwise unmodified.

i2s.disableTx() does not work

Hello,
I am using Adafruit_M0 board which sends a sinewave from the DMA buffer to external amplifier via I2S. I have 2 chips on the board which get triggered simultaneously. I was trying to use i2s_1.disableTx() and i2s_2.disableTx() alternately to get the sinewave on both the chips alternately, but instead I see sinewave on both chips output simultaneously. I suspect the disabling is not getting implemented.
Anyone had issues with getting the disable() function to work correctly?

Sample player

Hi, is there any example to play audio files using feather with this library and SD card?

How to read Mono Channel Data?

I am using an Adafruit I2S Mic with M0 Feather Board. Which parameters/flags do I need to change to read MONO channel data? Currently it is reading stereo data.

pinning guide - what pins to use?

Hi,

if someone (me) wants to create a wing with I2S interface it's a bit tricky to figure out the right pins.
From "Learn" I found that

  • Feather M0 is capable of either I2S Data out OR Data in
    • WS (pin0), CLK(pin1)
    • Data In/out (pin9)
  • Feather M4 is cabable of I2S Data out AND Data in (simultaneous)
    • WS (pin0), CLK(pin1)
    • Data in (pin12)
    • Data out (pin11)

From basic example I found pin2 as data in.

Adafruit_ZeroI2S i2s(0, 1, 9, 2);

And last but not least.. if the MCLK output is supported in the future.. which pin would that be?

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.