Giter VIP home page Giter VIP logo

adafruit_vs1053_library's Introduction

Adafruit VS1053 Breakout Build StatusDocumentation

This is a library for the Adafruit VS1053 Codec Breakout

Designed specifically to work with the Adafruit VS1053 Codec Breakout ----> https://www.adafruit.com/products/1381

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution

adafruit_vs1053_library's People

Contributors

awong-dev avatar caternuson avatar cogliano avatar daniel-stewart avatar dirker avatar driverblock avatar evaherrada avatar jacgoudsmit avatar jamesguan avatar johnwargo avatar ladyada avatar microbuilder avatar paulgreg avatar paulstoffregen avatar siddacious avatar syndic avatar szymonkaliski avatar tdicola avatar thenitek avatar tyeth avatar ynezz 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_vs1053_library's Issues

Compiler error when using a Arduino Nano Every (ATMega4809)

I use a Arduino Nano Every with the ATMega4809 micro controller. By using the Example "feather_player", there are following compiler errors in the file 'Adafruit_VS1053.cpp':

  • 'OCR0A' was not declared in this scope
  • 'TIMSK0' was not declared in this scope
  • 'OCIE0A' was not declared in this scope

Crashes ESP8266 after a short while

  • Arduino board: Adafruit ESP8266 Feather

  • Featherwing: Adafruit music maker featherwing - https://www.adafruit.com/product/3436

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

Add MP3 files to SD card and insert in reader
Load example sketch feather_player.ino
Upload and run

After a short time playing (random timing) the ESP will crash and reboot. Output from serial monitor below

Exception (0):
epc1=0x402045a0 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: sys
sp: 3ffffc20 end: 3fffffb0 offset: 01a0

stack>>>
3ffffdc0: 40106290 00000200 3ffee8d4 40203256
3ffffdd0: ffffffff 00000020 00000001 00000002
3ffffde0: 00101001 3ffe84cc 00e8ac4d 00000022
3ffffdf0: 3fffc200 40106258 3fffc258 4000050c
3ffffe00: 4000437d 00000030 00000011 ffffffff
3ffffe10: 60000200 00000008 070f0000 80000000
3ffffe20: 20000000 3fff1250 80000000 203fc060
3ffffe30: 80000000 3fffc6fc 3ffeeb90 3fff1254
3ffffe40: 00000214 003fc060 60000600 00000030
3ffffe50: 40102c76 00000000 3ffeeb6c 4020458c
3ffffe60: 00000134 40102a72 00000000 402045af
3ffffe70: 401062f4 00080000 00000016 401062de
3ffffe80: ffffffff 00000020 00000000 4000050c
3ffffe90: 00000000 00000000 0000001f 40100f25
3ffffea0: 4000050c 40106258 3fffc258 4000050c
3ffffeb0: 40000f68 00000030 00000011 ffffffff
3ffffec0: 40000f58 00000000 00000020 00000000
3ffffed0: feefeffe 3ffeeb90 3ffeeb90 0000002e
3ffffee0: ffffffff 3fff0680 3ffeeb90 3fffdab0
3ffffef0: 00000000 400042db 3ffeed54 00000030
3fffff00: 40004b31 3fff11f4 00000274 003fc000
3fffff10: 40101b08 003782f7 3ffe9744 00000000
3fffff20: 4010694d 3fff11f4 3ffe8e70 01cbaa26
3fffff30: 00000000 003708e5 3ffe95d0 40220f96
3fffff40: 4022145a 00000008 60000600 4020f9c1
3fffff50: 00000000 00000000 4022151f 3ffe9684
3fffff60: 3ffe8e70 003724b8 3ffe8e70 4020101c
3fffff70: 40213d05 3ffe9684 3ffe8e70 01cb826a
3fffff80: 40213d4a 3fffdab0 00000000 3fffdcb0
3fffff90: 3ffe8e90 3fffdad0 3ffeed54 40204edf
3fffffa0: 40000f49 3ffe9980 3fffdab0 40000f49
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(1,6)

ets Jan 8 2013,rst cause:4, boot mode:(1,6)

wdt reset

Can't Import Library

Every time I try to import the .zip, I recieve the following error: "The library "Adafruit_VS1053_Library cannot be used. Library names must contain only basic letters and numbers. (ASCII only and no spaces, and it cannot start with a number)" Why isn't it working?

Strange error occurs once and again while using Music Maker

Hello everybody!

I'm developing a build in which I need to play an .mp3 file in the ESP32-based Feather HUZZAH32 board.
In order to get that, I decided to use the Adafruit Music Maker FeatherWing (without Amp) board, and Adafruit VS1053 library.

I started with the example recomended in official site. So, after connecting all the pins of both boards, I uploaded the VS1053 library's example "feather_player" without any modification. However, I get the error below:

`Adafruit VS1053 Feather Test
VS1053 found
SD OK!
track002.wav 5299354
track001.wav 5299346
Playing full track 001
Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (dF⸮?)
Core 1 register dump:
PC : 0x40084583 PS : 0x00050036 A0 : 0x3ffb097c A1 : 0x3ffb08bc
A2 : 0x00000029 A3 : 0x3ffbe110 A4 : 0x400845eb A5 : 0xc0000000
A6 : 0x3ffb097c A7 : 0x3ffbdc1c A8 : 0x000000f9 A9 : 0x4008459f
A10 : 0x80000000 A11 : 0x3ffbdf58 A12 : 0x3ffbdf5c A13 : 0x3ffbdf2c
A14 : 0x00008000 A15 : 0x3ffbdc1c SAR : 0x00000001 EXCCAUSE: 0x00000001
EXCVADDR: 0x00008000 LBEG : 0x40087151 LEND : 0x40087161 LCOUNT : 0xfffffffa

Backtrace:0x40084580:0x3ffb08bc |<-CORRUPTED

ELF file SHA256: 0000000000000000

Rebooting...
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (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:1
load:0x3fff0030,len:1184
load:0x40078000,len:13160
load:0x40080400,len:3036
entry 0x400805e4`

This text is repeated once and again without any change. The only sound you can hear is the one that is generated at start of the sketch.
You can see that the error doesn't start when reading the uSD card: it appears when starts playing a file. I don't know if it is a library's problem, but I post it just in case.

I have tried checking conections, changing the HUZZAH32 board (I got two of them), changing the uSD card, changing audio files format, making all code and conection changes that appears on the official troubleshooting page... But none of them worked. Even more, none of the characters of the error changed.

Could somenone explain what should I do? Why does the error occur?

Thank you very much for help!

Iñigo

pausePlaying function has issue with else statement causing issue with stopped

The pausePlaying function has an issue where the else statement would set playingMusic to true despite the currentTrack has finished if you call pausePlaying with false.
This causes the call to the function stopped to return false despite the fact that the currentTrack has
stopped because playingMusic was flipped to true despite that not being true.

This is my fix. I tried to commit to the git but I don't have the permissions:

void Adafruit_VS1053_FilePlayer::pausePlaying(boolean pause) {
if (pause)
playingMusic = false;
else {
// Added this because
// calling pausePlaying with false would
// caused the call to stopped to return
// false despite the fact that the track
// has indeed stopped playing.
// Could add else{ playingMusic = false; }
// but it seems unnecessary.
if (currentTrack)
{
playingMusic = true;
}
feedBuffer();
}
}

Using SDfat on RP2040 (earlephilhower core)

Using the sdfat option with
#define PREFER_SDFAT_LIBRARY 1
causes many compiler errors.
I think it's the same as
https://github.com/adafruit/Adafruit_VS1053_Library/issues/88

 In file included from C:\Users\test\AppData\Local\Temp\.arduinoIDE-unsaved202359-3360-1cplq83.wffl\player_simple\player_simple.ino:3:
c:\Users\test\Documents\Arduino\libraries\Adafruit_VS1053_Library/Adafruit_VS1053.h:341:3: error: 'File' does not name a type; did you mean 'SdFile'?
  341 |   File currentTrack;             //!< File that is currently playing
      |   ^~~~
      |   SdFile
c:\Users\test\Documents\Arduino\libraries\Adafruit_VS1053_Library/Adafruit_VS1053.h:359:31: error: 'File' has not been declared
  359 |   unsigned long mp3_ID3Jumper(File mp3);
      |                               ^~~~
In file included from C:\Users\test\AppData\Local\Temp\.arduinoIDE-unsaved202359-3360-1cplq83.wffl\player_simple\player_simple.ino:5:
C:\Users\test\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.2.2\libraries\SD\src/SD.h:232:16: error: conflicting declaration 'SDClass SD'
  232 | extern SDClass SD;
      |                ^~
In file included from C:\Users\test\AppData\Local\Temp\.arduinoIDE-unsaved202359-3360-1cplq83.wffl\player_simple\player_simple.ino:3:
c:\Users\test\Documents\Arduino\libraries\Adafruit_VS1053_Library/Adafruit_VS1053.h:24:14: note: previous declaration as 'SdFat SD'
   24 | extern SdFat SD;
      |              ^~
C:\Users\test\AppData\Local\Temp\.arduinoIDE-unsaved202359-3360-1cplq83.wffl\player_simple\player_simple.ino: In function 'void setup()':
C:\Users\test\AppData\Local\Temp\.arduinoIDE-unsaved202359-3360-1cplq83.wffl\player_simple\player_simple.ino:49:25: error: could not convert 'FatVolume::open(const char*, oflag_t)(((const char*)"/"), 0)' from 'File32' to 'fs::File'
   49 |   printDirectory(SD.open("/"), 0);
      |                  ~~~~~~~^~~~~
      |                         |
      |                         File32
Multiple libraries were found for "SD.h"
  Used: C:\Users\test\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.2.2\libraries\SD
  Not used: C:\Users\test\AppData\Local\Arduino15\libraries\SD
exit status 1

Compilation error: could not convert 'FatVolume::open(const char*, oflag_t)(((const char*)"/"), 0)' from 'File32' to 'fs::File 

Support for __AVR_ATmega256RFR2__

VS1053 Library does not have support for ATmega256RFR2. This is Atmel's processor with LightWeight Mesh (LWM) capability. My Votsh WAVES project uses the RFR2 and the VS1053 library. Discussion on this issues is at https://forums.adafruit.com/viewtopic.php?f=22&t=63182.

Solution is to add RFR2 to Adafruit_VS1053.cpp after line 68:

#elif defined(__AVR_ATmega256RFR2__)
  4, 0,
  5, 1,

I want to make a push request but don't know how - I get an unauthorized error using the Atlassian Sourcetree client on my Mac.

-Frank Cohen, CEO, Votsh.com

Playback stops (but not fully) when changing volume too quickly

  • Arduino board: Adafruit Feather RP2040 rev D board
  • Arduino IDE version (found in Arduino -> About Arduino menu): 2.2.1
    Date: 2023-08-31T13:53:43.373Z

I'm using a Rev D Music Maker FeatherWing. I noticed this issue when adjusting the volume via a potentiometer, but I was able to reproduce it with just the Feather and FeatherWing by varying the volume as a function of elapsed time. With 1-2 ms of delay inside of loop(), the playback reliably stops somewhat randomly. With higher values of delay, the pausing is less frequent but still reproducible.

An odd detail is that playingMusic still returns true, and if I trigger a pause and then play with pausePlaying(true) and pausePlaying(false), the music picks up where it left off.

Per musicPlayer.sciRead(VS1053_REG_VOLUME), the volume levels are being set correctly on the MusicMaker.

[Adafruit Forum Thread]

Full sample code:

#include <Adafruit_VS1053.h>
#include <SD.h>

// Correct pins via
// https://flashgamer.com/blog/comments/using-feather-rp2040-with-adafruits-music-maker-featherwing

// These are the pins used
#define VS1053_RESET -1  // VS1053 reset pin (not used!)

// Feather RP2040 - MusicMaker FeatherWing
#define VS1053_CS 8    // VS1053 chip select pin (output)
#define VS1053_DCS 10  // VS1053 Data/command select pin (output)
#define CARDCS 7       // Card chip select pin
#define VS1053_DREQ 9  // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer =
  Adafruit_VS1053_FilePlayer(VS1053_RESET, VS1053_CS, VS1053_DCS, VS1053_DREQ, CARDCS);

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    delay(1);
  }

  if (musicPlayer.begin()) {  // initialise the music player
    Serial.println(F("VS1053 found"));
  } else {
    Serial.print(F("Couldn't find VS1053. Do you have the right pins defined?"));
  }

  if (!SD.begin(CARDCS)) {
    Serial.println(F("SD failed, or not present"));
    while (1)
      ;  // don't do anything more
  }
  Serial.println(F("SD OK!"));

  SD.open("/Music");

  // If DREQ is on an interrupt pin we can do background
  // audio playing. In this case, #if defined(__AVR_ATmega32U4__) will be false.
  if (musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT)) {  // DREQ int
    Serial.println(F("Able to use interrupt"));
  } else {
    Serial.println(F("Can't use interrupt"));
  }

  musicPlayer.setVolume(30, 30);

  musicPlayer.startPlayingFile("0012 Hush_Little_Baby.mp3"); // replace with a file you have on the SD card in the /Music folder
  delay(3000);
  Serial.println(F("Starting loop"));
}

void loop() {
  auto seconds = (float)millis() / 1000.0;
  auto normalizedVolume = sin(seconds * 10);
  auto volume = floatMap(normalizedVolume, -1, 1, 45, 5); // larger numbers are quieter
  // Serial.println(volume); // uncomment if you want to see what we're setting the volume to
  musicPlayer.setVolume(volume, volume);
  auto readVolume = musicPlayer.sciRead(VS1053_REG_VOLUME);
  Serial.print(F("Set: "));
  Serial.print(volume);
  Serial.print(F(", get: "));
  Serial.print(readVolume >> 8);
  Serial.print(F(", "));
  Serial.println(readVolume & 0xFF);
  delay(1); // 1 or 2 reproduces reliably, anything higher reproduces more sporadically
}

/// Float version of https://www.arduino.cc/reference/en/language/functions/math/map/
float floatMap(float x, float in_min, float in_max, float out_min, float out_max) {
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

Audio used (place in /Music folder on SD card):

0012 Hush_Little_Baby.mp3.zip

how to use the applyPatch() function?

  • Arduino board: Arduino Uno, with vs1053 codec breakout (https://www.adafruit.com/product/1381)

  • Arduino IDE version: 1.8.19

  • List the steps to reproduce the problem below: looking for how to use applyPatch() function.

How do you use the applyPatch() function?
Is there any example code out there?

I need to use the patch called "vs1053b-patches-pitch.plg" from https://www.vlsi.fi/en/support/software/vs10xxpatches.html

The loadPlugin() function doesn't work for this, because it seems to be for loading SPI boot images, not .plg files.

Issue with Ogg Recording Example on VS1053 Breakout Board

Problem Description

I'm currently facing challenges with the Ogg recording example on the breakout board utilizing the VS1053 chip. My recorded files consistently exhibit a recurring issue. Specifically, there are missing words in the recordings.

Steps Taken

Set recording pin to GND.
Speak into the microphone.
Remove the record pin from GND.
Wait for a brief period.
Disconnect the Arduino Nano.
Insert the SD card into the computer to listen to the recording.
Attempted Solutions
I've experimented with various approaches, including:

Trying different SD card libraries.

Adjusting buffer sizes to potentially address the missing words issue.
However, none of these attempts have resolved the problem.

Request for Assistance

I'm reaching out to the community for guidance. Has anyone successfully used this breakout board for recording? If so, were there specific modifications or adjustments made to ensure reliable recording without missing words? Any insights or suggestions would be greatly appreciated.

Thank you for your assistance!

Unable to compile "player_simple" on Arduino Zero board

using the latest 1.6.6 Hourly Build IDE, I'm unable to compile this sketch for Arduino Zero board.
Copile errors hereunder :

Arduino : 1.6.6 Hourly Build 2015/06/26 03:43 (Windows 7), Carte : "Arduino Zero (Programming Port)"

Les options de compilation ont été modifiées, tout sera recompilé

D:\Arduino165+\arduino-nightly\libraries\Adafruit_VS1053_Library-master\Adafruit_VS1053.cpp: In member function 'void Adafruit_VS1053_FilePlayer::feedBuffer()':
D:\Arduino165+\arduino-nightly\libraries\Adafruit_VS1053_Library-master\Adafruit_VS1053.cpp:249:14: error: 'SREG' was not declared in this scope
sregsave = SREG;
^
D:\Arduino165+\arduino-nightly\libraries\Adafruit_VS1053_Library-master\Adafruit_VS1053.cpp:250:7: error: 'cli' was not declared in this scope
cli();
^
D:\Arduino165+\arduino-nightly\libraries\Adafruit_VS1053_Library-master\Adafruit_VS1053.cpp: In constructor 'Adafruit_VS1053::Adafruit_VS1053(int8_t, int8_t, int8_t, int8_t, int8_t, int8_t, int8_t)':
D:\Arduino165+\arduino-nightly\libraries\Adafruit_VS1053_Library-master\Adafruit_VS1053.cpp:312:14: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int_}' to 'PortReg_ {aka volatile unsigned char_}' in assignment
clkportreg = portOutputRegister(digitalPinToPort(clk));
^
D:\Arduino165+\arduino-nightly\libraries\Adafruit_VS1053_Library-master\Adafruit_VS1053.cpp:314:15: error: cannot convert 'volatile uint32_t
{aka volatile long unsigned int_}' to 'PortReg_ {aka volatile unsigned char_}' in assignment
misoportreg = portInputRegister(digitalPinToPort(miso));
^
D:\Arduino165+\arduino-nightly\libraries\Adafruit_VS1053_Library-master\Adafruit_VS1053.cpp:316:15: error: cannot convert 'volatile uint32_t
{aka volatile long unsigned int_}' to 'PortReg_ {aka volatile unsigned char*}' in assignment
mosiportreg = portOutputRegister(digitalPinToPort(_mosi));
^
Erreur lors de la compilation.

Ce rapport contiendrait plus d'informations si l'option
"Montrer les informations de sortie pendant la compilation"
était activée dans Fichier > Préférences.

Crashes on ESP32 when using interrupts

  • Arduino board: WeMos (not really) ESP32 R2, basically generic ESP32
  • Arduino IDE version: 1.8.5

The interrupt-based playback does not work on ESP32, calling the SD library from within an interrupt handler seems to cause an almost immediate crash. The exception stack trace is as follows:

0x400812f5: lock_acquire_generic at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/newlib/./locks.c line 141
0x40087754: invoke_abort at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/./panic.c line 648
0x4008792f: abort at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/./panic.c line 648
0x400812f5: lock_acquire_generic at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/newlib/./locks.c line 141
0x40081415: _lock_acquire_recursive at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/newlib/./locks.c line 169
0x400da302: _fread_r at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/fread.c line 194 (discriminator 2)
0x400da3c9: fread at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/fread.c line 301
0x400d280b: VFSFileImpl::read(unsigned char*, unsigned int) at c:\users\dancl\documents\arduino\hardware\espressif\esp32\tools\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\5.2.0\bits/shared_ptr_base.h line 127 (discriminator 1)
0x400ec6e7: fs::File::read(unsigned char*, unsigned int) at C:\Users\dancl\Documents\Arduino\hardware\espressif\esp32\libraries\FS\src/FS.cpp line 258
0x400d1314: Adafruit_VS1053_FilePlayer::feedBuffer_noLock() at C:\Users\dancl\Documents\Arduino\libraries\Adafruit_VS1053_Library/Adafruit_VS1053.cpp line 737 (discriminator 1)
0x400d1355: Adafruit_VS1053_FilePlayer::feedBuffer() at C:\Users\dancl\Documents\Arduino\libraries\Adafruit_VS1053_Library/Adafruit_VS1053.cpp line 737 (discriminator 1)
0x400d1368: feeder() at C:\Users\dancl\Documents\Arduino\libraries\Adafruit_VS1053_Library/Adafruit_VS1053.cpp line 737 (discriminator 1)
0x40080ddd: __onPinInterrupt at C:\Users\dancl\Documents\Arduino\hardware\espressif\esp32\cores\esp32/esp32-hal-gpio.c line 211
0x400817d9: _xt_lowint1 at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/./xtensa_vectors.S line 1105
0x400dbc63: esp_vApplicationIdleHook at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/./freertos_hooks.c line 85

I've done a quick test where the interrupt handler sets a flag, letting the main loop know to populate the buffer and that works fine. I'm pretty sure I can set up a solution using a separate task to just feed the buffer as and when with maybe a larger memory buffer to cater for the extra latency. Of course this will be super ESP32 specific and couldn't be integrated back into the library.

Fails to compile due to conflicting File classes for Arduino Yun w/ Bridge library

Any time I try to compile a sketch that uses both this lib and the Arduio Yun Bridge library, I get a stack of errors (full output below).

I think this is actually an Arduino bug (arduino/Arduino#1942) but I'm hoping that maybe we can put a workaround into this library, at least until the root issue is resolved.

I'm happy to put in some work, but I'm not sure what the best way to handle this is. Do you think something like freetronics/FTOLED@7f4476f is reasonable?

Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::write(unsigned char)'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::flush()'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::write(unsigned char const*, unsigned int)'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::operator bool()'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::seek(unsigned long)'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::position()'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::read()'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::peek()'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::available()'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::read(void*, unsigned int)'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::size()'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::close()'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::name()'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::isDirectory()'
SD/File.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/File.cpp:57: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::openNextFile(unsigned char)'
SD/SD.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/SD.cpp:567: first defined here
Bridge/FileIO.cpp.o: In function `File::write(unsigned char)':
/Applications/Arduino-1.6.3.app/Contents/Java/libraries/Bridge/src/Bridge.h:52: multiple definition of `File::rewindDirectory()'
SD/SD.cpp.o:/Applications/Arduino-1.6.3.app/Contents/Java/libraries/SD/src/SD.cpp:234: first defined here
collect2: error: ld returned 1 exit status
Error compiling.

Not really a issue but..

How do you send a string to the library to play of the SD?
I can't find a way to pass a string variable. It would be handy for making playlists using the found MP3 names.
Thanks :)

Does not work on ESP32

The VS1053 library does not work with ESP32's.

Steps to reproduce:

  • Open the "player_simple.ino" example after installing the library
  • Set pins for BREAKOUT_RESET 9, BREAKOUT_CS 10, BREAKOUT_CS 6, CARDCS 4, DREQ 3
  • Connect according to the above
  • Compile & upload

This will cause a hardware crash on the ESP32, causing it to reboot at a regular interval. Changing from this constructor:

Adafruit_VS1053_FilePlayer(BREAKOUT_RESET, BREAKOUT_CS, BREAKOUT_DCS, DREQ, CARDCS);

... to the software SPI version:

Adafruit_VS1053_FilePlayer(MOSI, MISO, SCK, BREAKOUT_RESET, BREAKOUT_CS, BREAKOUT_DCS, DREQ, CARDCS);

... does stop the crashing, but the device still does not play audio files. Printing out MOSI, MISO and SCK lists the correct pins (35, 37, 36) so it does not make much sense that calling this makes a difference (but it does).

This library contains working code (as a workaround), but I'd at least update the Adafruit guide for the VS1053 products and point out that this library does not work with ESP32 for now..

ESP8266/NodeMCU: SPI clock speed FIX

Hi,
I was having glitching problems recording OGG audio with ESP8266 (NodeMCU) due to low SPI clock speed.
I've simply fixed it changing the lines (in Adafruit_VS1053.cpp) from:
#define VS1053_CONTROL_SPI_SETTING SPISettings(250000, MSBFIRST, SPI_MODE0) #define VS1053_DATA_SPI_SETTING SPISettings(8000000, MSBFIRST, SPI_MODE0)
to:
#if defined(ESP8266) #define VS1053_CONTROL_SPI_SETTING SPISettings(1000000, MSBFIRST, SPI_MODE0) #define VS1053_DATA_SPI_SETTING SPISettings(20000000, MSBFIRST, SPI_MODE0) #else #define VS1053_CONTROL_SPI_SETTING SPISettings(250000, MSBFIRST, SPI_MODE0) #define VS1053_DATA_SPI_SETTING SPISettings(8000000, MSBFIRST, SPI_MODE0) #endif
setting speed to 1MHz/20MHz. As I can hear now, no glitches anymore!

Millis() function is extremely inaccurate when playing audio on Feather M0

  • Arduino board: Feather M0 basic proto + Adafruit Music Maker Feather Wing
  • Arduino IDE version: 1.8.5
  • Problem: The millis function is very inaccurate when playing an audio file. I have a sketch which uses the millis function to blink a led once every 3 seconds, the led is on for only 300 mS. When the library is playing music the 300 mS time goes to 429 mS (that’s almost 150 %). The file is 320 kb/s MPEG Audio Layer ½, dual channel mono, 44100 Hz, 32 bits.

The millis function is also used on my program to keep track of time using Unix time (not only to blink leds), so it´s desirable to keep timings as accurate as possible.

I know this file is high bitrate, but we´re developing a prototype for a third party. It should be able to handle high bitrate files, because the final user might not be able to tell if an MP3 file is 128 or 320 kbps.

The problem seems to be related to how the code handles the DREQ interrupt, as this function takes several milliseconds to execute while the data is transferred from the SD card and then to the VS1053. In the mean time the Systick might not be handled correctly.

Possible solutions that I thought:

  • Raise the priority of the interrupt used for millis() so it can nest in the DREQ interrupt (not sure about the side effects of this and if it is even possible because of how NVIC is initialized, involves messing with the Arduino core).
  • Not use interrupts at all and handle all the data buffer feeding on the main loop.

Has anybody else experienced this problem, is there a workaround for this?

Thank you in advance.

Error in compilation for Arduino Uno WiFi Rev2

Hi !
I'm getting an error when compiling for Uno WiFi Rev2 (i've tried ESP8266 ans Uno and it was OK)
Here is the compile error:

Adafruit_VS1053.cpp:48:5: error: 'OCR0A' was not declared in this scope
     OCR0A = 0xAF;
     ^~~~~
Adafruit_VS1053.cpp:48:5: note: suggested alternative: 'O_CREAT'
     OCR0A = 0xAF;
     ^~~~~
     O_CREAT
Adafruit_VS1053.cpp:49:5: error: 'TIMSK0' was not declared in this scope
     TIMSK0 |= _BV(OCIE0A);
     ^~~~~~
Adafruit_VS1053.cpp:49:5: note: suggested alternative: 'TIMERA0'
     TIMSK0 |= _BV(OCIE0A);
     ^~~~~~
     TIMERA0
In file included from arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
                 from arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\pgmspace.h:90,
                 from Arduino15\packages\arduino\hardware\megaavr\1.8.5\cores\arduino/api/String.h:30,
                 from Arduino15\packages\arduino\hardware\megaavr\1.8.5\cores\arduino/api/Print.h:24,
                 from Arduino15\packages\arduino\hardware\megaavr\1.8.5\cores\arduino/api/Stream.h:25,
                 from Arduino15\packages\arduino\hardware\megaavr\1.8.5\cores\arduino/api/Client.h:22,
                 from Arduino15\packages\arduino\hardware\megaavr\1.8.5\cores\arduino/api/ArduinoAPI.h:29,
                 from Arduino15\packages\arduino\hardware\megaavr\1.8.5\cores\arduino/Arduino.h:23,
                 from Arduino\libraries\Adafruit_VS1053_Library/Adafruit_VS1053.h:18,
                 from Adafruit_VS1053.cpp:15:
Adafruit_VS1053.cpp:49:19: error: 'OCIE0A' was not declared in this scope
     TIMSK0 |= _BV(OCIE0A);

  • Arduino board: Arduino Uno WiFi Rev2
  • Arduino IDE version: 1.8.10
  • List the steps to reproduce the problem below:
    • I'm using player_example from Example directory and compile it

Increase SPI clock?

Would it be possible/sensible to increase the SPI clock settings for, both, access to SD card and VS1053b? The SD card should be good up to 25 Mhz, and the VS1053b should be happy with 5 Mhz (internal clock of 36.864 Mhz / 7, according to the datasheet). I'm having some issues here with high-bitrate files clogging the bus ... Alternatively, this could perhaps be handled with user-defined parameters through an overloaded constructor? Happy to send a PR if you're interested. Cheerio :-)

Distorted *.wav files

Arduino Board: MEGA2560
IDE Version: 1.8.5

I've connected the VS1053 and started playing audio.
MP3 files work great, but WAV files produce distortion.

The shield datasheet says it is able to support wav files so I am lead to believe the problem is from this library?

Conflict with IR/RFID interrupts

A handful of people using this library have experienced issues reading IR or RFID values when music is playing the background. The forum topic linked below goes into greater detail and a workaround was provided.

The workaround involves pausing the music, delaying for 10ms, reading from IR/RFID then resume playing. The pause-read-unpause happens so quickly that the playback is unaffected. Can a change be made to the library to avoid doing this?

void loop() {
musicPlayer.pausePlaying(true);
delay(10);

if (irrecv.decode(&results)) {
musicPlayer.pausePlaying(false);
Serial.println(results.value, HEX);

   // do something with the result

   irrecv.resume(); // Receive the next value

}

musicPlayer.pausePlaying(false);
return;
}

http://forums.adafruit.com/viewtopic.php?f=8&t=61912&p=313612#p313612

_cardCS not set

Hey,
In the FilePlayer constructors the pin on _cardCS is set high, however i cannot see anywhere _cardCS is being set and believe it is supposed to be just the local variable cs instead.
On my board the value of _cardCS is defaulting to 64 on power on and is causing a crash.
Thanks, Mitchell

SPI Max Speed Issues on M0

Value of 8Mhz not supported (no sound) on M0 chip. Reduced to 4Mhz for reliable audio.

Line 41 of Adafruit_VS1053.cpp:
#define VS1053_DATA_SPI_SETTING SPISettings(4000000, MSBFIRST, SPI_MODE0)

  • Arduino board: Feather M0/Generic M0

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.6/1.9

Possible Code Modifications for Adafruit_VS1053 Files

  • Arduino board: Adafruit VS1053B (https://www.adafruit.com/product/1381)
  • Arduino IDE version: 1.8.19
  • Code modifications by whh - Feb 2024
  • I was looking for an audio board to work with an AVR128DB28 MCU running
  • under Spence Konde's DxCore (https://github.com/SpenceKonde/DxCore) with
  • IR Remote support via TinyIRReceiver (Arduino-IRremote) as the basis for
  • my next projects. I looked over the Adafruit VS1053B (product 1381), the
  • various documentation Adafruit provided, how to hook it up, evaluated my
  • MCU, etc., and chose to give it a try.
  • I ended up downloading the Adafruit_VS1053.h and .cpp files from github,
  • found I also needed the Adafruit_SPIDevice.h and .cpp files, put the files
  • into my local directory (and modified includes to access the local files,
  • and tried to get things working. EVENTUALLY - I starting hearing audio
  • out of an Adafruit 3.7W amp to a set of speakers. But I could never get
  • a full file to play.
  • I went through the VS1053 code to understand what was going on and put
  • debug prints here and there. I found the interrupts were happening quite
  • rapidly and feedBuffer_noLock could take 16 ms or more. But everything I
  • tried never allowed me to have audio and IR Remote working together. So
  • I chose a different approach.
  • I made an exec() function pattered after the interrupt handler that would
  • call a runBuffer() function pattered after feedBuffer_noLock. The exec()
  • function would be called in void loop() of an .ino sketch and defines in
  • Adafruit_VS1053.h file would separate interrupt code from exec code. I had
  • wanted to put the define just before the include in the .ino file but it
  • would not pass through and be recognized in the Adafruit_VS1053.h header.
  • So long story short, using the exec() function, I can play mp3 audio files
  • from the SD Card while at the same time processing IR Remote signals via
  • IRRemote TinyIRReceiver. I can start a specific audio file (e.g. buttons
  • 1 thru 9), change the volume up or down, mute or unmute the volume, or
  • stop playing WITHOUT any interruption or degradation in playback. All
  • while only clocking my MCU at 8 MHz. (Oh yea, I also have a fair amount
  • of debug content being output while all of this is going on!)
  • I have gone back and tried the interrupt method but even with setting
  • the MCU clock to the highest frequency of 24 MHz, it will not finish
  • playing a mp3 file. I even changed the attachInterrupt parameter from
  • CHANGE to RISING. The only way I can get all I want running to run is
  • to use the exec() function.
  • Ok, so what am I doing. I am giving back to Adafruit. Comments have
  • been added to the Adafruit_VS1053.h and .cpp files I have been working
  • on. I have also tried to put my initials (e.g. whh) where I have made
  • changes. I hope I can zip these files up and submit them to github so
  • you can look them over and choose to do what you would like to with
  • the code. Maybe one day there is a new code version with instructions
  • of how to use either interrupts or the exec() function. Worst go to
  • worst, I now have working code for me. Now as soon as more VS1053
  • boards become available, I will be able to use them.
  • Warren H. Holt (whh) - 17feb2024

Adafruit_VS1053_Mods_Feb_2024.zip

"Adafruit_VS1053.cpp" problem with "feather_player" exemple

Arduino board: Adafruit ESP32 Feather + Music Maker FeatherWing

Arduino IDE version : 1.8.9

Hi, There is a message error when I try to upload the "feather_player" sketch.

Here is the message error :

`/Users/romain/Documents/Arduino/libraries/Adafruit_VS1053/Adafruit_VS1053.cpp: In member function 'long unsigned int Adafruit_VS1053_FilePlayer::mp3_ID3Jumper(fs::File)':
/Users/romain/Documents/Arduino/libraries/Adafruit_VS1053/Adafruit_VS1053.cpp:186:25: error: invalid conversion from 'char*' to 'uint8_t* {aka unsigned char*}' [-fpermissive]
if (mp3.read(tag,3)) {

                     ^

In file included from /Users/romain/Documents/Arduino/hardware/espressif/esp32/libraries/SD/src/SD.h:17:0,
from /Users/romain/Documents/Arduino/libraries/Adafruit_VS1053/Adafruit_VS1053.h:34,
from /Users/romain/Documents/Arduino/libraries/Adafruit_VS1053/Adafruit_VS1053.cpp:15:
/Users/romain/Documents/Arduino/hardware/espressif/esp32/libraries/FS/src/FS.h:60:12: note: initializing argument 1 of 'size_t fs::File::read(uint8_t*, size_t)'
size_t read(uint8_t* buf, size_t size);
^`

Any issue ?
Thanks,

Romain

Doesn't work with all memory cards

I have these memory cards:

image

Also, I tried different libraries. This and this. Memory cards of 1GB and 256MB do not work on both libraries. At the same time, SdFat initializes these memory cards and works successfully with them, which suggests that the problem is in the VS1053 library itself. Any ideas on how to make everything work?

Code for SdFat version:

#include <SPI.h>
#include <SdFat.h>
#include <vs1053_SdFat.h>

SdFat sd;
vs1053 MP3player;

void setup() {
  Serial.begin(9600);

  sd.begin(SdSpiConfig(9, SPI_HALF_SPEED));

  MP3player.begin();
  MP3player.setVolume(10, 10);
  MP3player.playMP3("001.mp3");
}

void loop() {
  delay(1000);
}

Code for this library from player_simple.ino example.

feather_midi isn't compiling?

  • Arduino board: Arduino Uno

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

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):
    I did follow the first step and solder the closed jumper and all of the other solder joints are intact. However, when I compiled the feather_midi and uploaded it to my Arduino, it gave me these error messages:
    `Arduino: 1.6.3 (Mac OS X), Board: "Arduino/Genuino Uno"

feather_midi.ino: In function 'void setup()':
feather_midi.ino:40:13: error: 'delay' was not declared in this scope
feather_midi.ino:42:3: error: 'Serial' was not declared in this scope
feather_midi.ino:46:3: error: 'VS1053_MIDI' was not declared in this scope
feather_midi.ino:48:43: error: 'midiSetChannelBank' was not declared in this scope
feather_midi.ino:50:30: error: 'midiSetChannelVolume' was not declared in this scope
feather_midi.ino:52:42: error: 'midiSetInstrument' was not declared in this scope
feather_midi.ino: In function 'void loop()':
feather_midi.ino:56:8: error: 'uint8_t' was not declared in this scope
feather_midi.ino:56:22: error: 'i' was not declared in this scope
feather_midi.ino:57:25: error: 'midiNoteOn' was not declared in this scope
feather_midi.ino:58:14: error: 'delay' was not declared in this scope
feather_midi.ino:59:26: error: 'midiNoteOff' was not declared in this scope
feather_midi.ino:62:13: error: 'delay' was not declared in this scope
feather_midi.ino: At global scope:
feather_midi.ino:65:24: error: variable or field 'midiSetInstrument' declared void
feather_midi.ino:65:24: error: 'uint8_t' was not declared in this scope
feather_midi.ino:65:38: error: 'uint8_t' was not declared in this scope
feather_midi.ino:77:27: error: variable or field 'midiSetChannelVolume' declared void
feather_midi.ino:77:27: error: 'uint8_t' was not declared in this scope
feather_midi.ino:77:41: error: 'uint8_t' was not declared in this scope
feather_midi.ino:86:25: error: variable or field 'midiSetChannelBank' declared void
feather_midi.ino:86:25: error: 'uint8_t' was not declared in this scope
feather_midi.ino:86:39: error: 'uint8_t' was not declared in this scope
feather_midi.ino:95:17: error: variable or field 'midiNoteOn' declared void
feather_midi.ino:95:17: error: 'uint8_t' was not declared in this scope
feather_midi.ino:95:31: error: 'uint8_t' was not declared in this scope
feather_midi.ino:95:42: error: 'uint8_t' was not declared in this scope
feather_midi.ino:105:18: error: variable or field 'midiNoteOff' declared void
feather_midi.ino:105:18: error: 'uint8_t' was not declared in this scope
feather_midi.ino:105:32: error: 'uint8_t' was not declared in this scope
feather_midi.ino:105:43: error: 'uint8_t' was not declared in this scope
Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
`

When I compile and upload the player_miditest, it seems to work fine, so I'm a little confused why this one doesn't work.

No sound .

My player worked fine when I used it for the first time. But now it does not give out any sound.
I tried the player_simple example. here are my observations.(I changed the CS pin of SD card to Pin 34 of Arduino mega).

1)player initializes
2) it lists all files on the SD-card.
3) It stops at playing track-2 for some time (which roughly matches the time of the audio files).

note : It does not seems to be the freeze issue as in #4 as the player does not stop.

record_ogg example does not support multiple recordings without reset

The record_ogg.ino example does not seem to support recording more than one .ogg file without hard-resetting the board in between recordings. The first file (RECORD00.ogg) is recorded fine and plays back in Audacity etc., of subsequent recordings only the first 1024 bytes make it to the SD card.

Steps to reproduce:

  • Open record_ogg.ino, change the following to the music maker shield pins:

    // define the pins used
    #define RESET -1 // VS1053 reset pin (output)
    #define CS 7 // VS1053 chip select pin (output)
    #define DCS 6 // VS1053 Data/command select pin (output)
    #define CARDCS 4 // Card chip select pin
    #define DREQ 3 // VS1053 Data request, ideally an Interrupt pin

  • Load record_ogg.ino to the Uno

  • Press the REC_BUTTON to do multiple recordings

  • Inspect recordings on PC

If the Arduino is reset in between recordings, this issue does not occur. The plugin datasheet states that the plugin does need to be reloaded between recordings (e.g., Sec 2.3.5, point 6), so maybe the only way around it is to do complete board resets between recordings.

Drawback: It takes around 6 seconds to reload the plugin, which delays the start of subsequent recordings from when the button is pressed.

(Music Maker board on Uno, IDE v1.8.9)

Problem with begin()

Hello,

I have a problem with the begin() method.
The problem is that begin() method fail a lot of time before work correctly.
What could be the problem?

Thanks

Simeon

player eventually freezes

The feedBuffer() method relies on DREQ for determining when it is okay to grab more bytes from the SD card, but according to the datasheet this is not sufficient, as DREQ can change for other reasons besides "ready for data".

In my sketch I noticed that repeatedly calling startPlayingFile() will eventually cause the Arduino to freeze, and when it does the DREQ pin remains low.

Doing a softReset() of the VS1053 prevents the freezing, but that is not ideal.

setVolume ranges?

For this library's void Adafruit_VS1053::setVolume(uint8_t left, uint8_t right) { method - what are the possible range of values? In the sample app you have:

 // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(10, 10);

but no mention of whether this is a small value (10) or big value.

I'm assuming 0-255, but I can't tell from looking at the sample or any comments in the source.

custom SPI pins not working on ESP32

trying to use this with a custom set of spi pins but it dosnt work on an esp32. if i change the board pin definitons for the spi pins then it works.

musicPlayer.useInterrupt broken since 1.0.3

Using a Pro Micro or Lenoardo (32U4) and Arduino 1.8.3, the player_interrupts.ino example fails to finish track playback using the Interrupt method. After a certain amount of time, DREQ just goes HIGH and stays high, playback stops.
With 1.0.2 or earlier, this does not happen.

Cant compile record_ogg

record_ogg:173: error: '_BV' was not declared in this scope
if (! (musicPlayer.sciRead(VS1053_SCI_AICTRL3) & _BV(2))) {

  • Arduino board: m0 WiFi Feather(3061) w/ Music Maker FeatherWing (3357)

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

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):
    File->examples->Adafruit VS1053 Library-> record_ogg
    Verify/Compile (ctrl-R)

Please fix sdfat

When using with Adafruit's sdfat library, you get errors and it will refuse to compile.

Missing Include Guard?

In the latest release (downloaded 17 June 2013) I had to add an include guard in the header file to get the library to compile.

Fix:
add:

[

ifndef Adafruit_VS1053_h

define Adafruit_VS1053_h

...

endif /* Adafruit_VS1053_h */

]

to Adafruit_VS1053.h

feedBuffer_noLock not adapted to fast processor

Hello dear Adafruit

I purchased a Feather Huzzah 32 with a ESP32 on it, and a Adafruit Music Maker FeatherWing - MP3 OGG WAV MIDI Synth Player (PID: 3357).
I used the V1053 library and it didn't work. In fact only the first bytes of the data is played for a fraction of a second.
Looking into the code in the feedBuffer_noLock I noticed that if readyForData() returns 0 everything stops, and it seems that the data is fed too fast. After 110 times of writing 32 bytes, readyForData() returns 0 . The datasheet of the chip explains that when that happens the code should just wait for the buffer to be ready again and continue.

I have tentatively changed the code to this

void Adafruit_VS1053_FilePlayer::feedBuffer_noLock(void) {
  if ((! playingMusic) // paused or stopped
      || (! currentTrack)
      || (! readyForData())) {
    return; // paused or stopped
  }

  int cnt = 0;
  // Feed the hungry buffer! :)
  while (playingMusic/*readyForData()*/) {
    // Read some audio data from the SD card file
    int bytesread = currentTrack.read(mp3buffer, VS1053_DATABUFFERLEN);

    if (bytesread == 0) {
      // must be at the end of the file, wrap it up!
      playingMusic = false;
      currentTrack.close();
      break;
    }

    while(!readyForData()){
      //wait for the buffer to be ready to receive more data
    }
    playData(mp3buffer, bytesread);
  }
}

It keeps reading the data the until playingMusic becomes false.
But it will wait for readyForData() to be 1 before calling playData()

Hopefully it can be an improvement to the library for controllers like ESP32.
I am very new to whole this so if you see a problem in my code or my thinking it's very welcome.

Thanks

By the way Adafruit, you are so awesome !

Support for differential Output

I was trying to make the differential Output work by loading the current patch for the VS1053 and using the following settings afterwards:

  // Enable Mono Output
  musicPlayer.sciWrite(VS1053_REG_WRAMADDR, 0x1e09);
  musicPlayer.sciWrite(VS1053_REG_WRAM, 0x0001);

  // Enable differential output
  uint16_t mode = VS1053_MODE_SM_DIFF | VS1053_MODE_SM_SDINEW;
  musicPlayer.sciWrite(VS1053_REG_MODE, mode);

Unfortunately this didn't work and took me quite a while to realize that startPlayingFile is doing

  // reset playback
  sciWrite(VS1053_REG_MODE, VS1053_MODE_SM_LINE1 | VS1053_MODE_SM_SDINEW);

Is there a reason for this? IMHO startPlayingFile shouldn't mess with the MODE register.

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.