Skip to content

D34G/SamdAudioSD

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Audio Library for Arduino Nano 33 IoT or SAMD based boards

The SamdAudio library enables an Arduino Nano 33 IoT to playback mono 8bit .wav files from a storage device like an SD card, without blocking program execution. Compatible with Atmel SAMD series MCU and is best used with DAC related amplifiers.

Features

Plays Mono channel unsigned 8-bit mono .WAV files with sample rates of 22050 Hz or 44100 Hz
Reading audio files from an SD card using SPI
Software volume control
Hardware volume control
Multi channel audio playback
Audio playback looping
Audio mute
Blocking and non-blocking audio playback
Audio playback status

Updates

Version 1.0.0
  o Initial Commit, forked from AloyseTech/SamdAudio
  o modified library for use with PAM8302, should be fine with any Class D amplifier
  o modified player.ino example for clarity and testing
  o added blocking flag as an option to increase flexibility of this library
  o functions added: begin(uint32_t, uint8_t, uint16_t), play(const char *), setBlocking(bool),setVolume(uint8_t)
  o functions added: selectShutdownPin(uint8_t), setShutdownPinState(bool), setShutdownPinState(bool, bool), selectDACPin(uint8_t)
Version 1.1.0
  o Added MCP4XXX library for hardware volume control through a digital potentiometer
  o modified audio playback to remove the 'pop' when playback starts and stops
  o functions added: setVolume(uint8_t), volumeUp(), volumeDown(), selectDigitalPotPin(uint8_t)
Version 1.1.1
  o Added a fix for SPI clock speed that is needed due to poor SPI handling by the MCP4XXX library

Tutorial

Check out https://github.com/D34G/SamdAudioSD/wiki/SamdAudioSD-Wiki-Page for helpful information to use this library!

Why another library?

IMO, AudioZero (the library which is reffered to most often for newer Arduino’s) absolutely sucks. It’s not maintained well and some pretty important bugs have not been addressed in years.

I found AloyseTech’s library and thought this is perfect, almost. Sdfat (as of Ver 2.0.5) doesn’t play well with the Nano 33 IoT, so I changed the SD card driver to SD.h. I added some good controls for Class D amplifiers that are commonly used. I recently added hardware volume control through integration of the MCP4XXX library which controls a digital potentiometer. A few more changes to go and this library will be your go-to for wav file playback!

To-Do:
  o Add stereo playback (need help with this one)
  o Add native MP3 decoding
  o take le nap then fire Z MISSILES!

Dependencies

MCP4XXX Library https://github.com/D34G/mcp4xxx (control of digital potentiometer circuits for amps with electronic control of gain)

License

Copyright (c) D34G. All right reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

About

Audio library for Atmel SAMD series Arduino Family of microcontrollers. Tested on the Nano 33 IoT.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%