This is one of the libraries that took quite a bit of effort to port to Teensy 3.x. You're probably at the beginning of a long journey.
First, do yourself a favor and grab the latest code from Adafruit's github repo. As you can see on line 21, the missing _BV was added to support Arduino Due.
Since you're getting _BV undefined, you almost certainly have an old copy, from before April 28, 2015.
The good news is this library has improved quite a lot over the last couple years. Hopefully you won't have to make any fixes like I had to do back in 2014 for race conditions (rare with slow AVR, more frequent with faster ARM processors).
Oh, but look at how the Due port was done. They just omitted the race condition check!
Due is about the same speed at Teensy, but its SPI library is really slow, so maybe this manages to run ok? If you get it mostly working but it crashes occasionally, this race condition is the place to look.
I do have the latest and I find the _BV definition. #ifndef _BV #define _BV(x) (1<<(x)) #endif
I think it is probably crashing somewhere else. When I compile, VS1053 Simple Player example I get this
C:\Users\testuser\Documents\Arduino\libraries\Adafruit_VS1053_Library-master\Adafruit_VS1053.cpp: In member function 'void Adafruit_VS1053_FilePlayer::feedBuffer()':
C:\Users\testuser\Documents\Arduino\libraries\Adafruit_VS1053_Library-master\Adafruit_VS1053.cpp:252:14: error: 'SREG' was not declared in this scope
sregsave = SREG; //(what is the relevant buffer for Zero?)
Well, you could try just the lazy approach of just removing that code, like whoever port to Due. Who knows, maybe you'll get lucky and not have it crash (much) on Zero?
Paul, Ok. Another problem. VS1053 cannot record and play at the same time so better to go with separate controllers. I settled for a workaround. I left the Adafruit VS1053 on Arduino Uno working. Connect the Zero and Uno via I2C and SPI. Now I can control it from Zero and access the SD card. CS is shared between the two controllers using a Bilateral Switch (CD4016). Uno has limited memory so I might have to move to a mega or DUE. I wish Uno had bit more memory...
What are you doing that needs to play and record simultaneously?
This question has come up a couple times with Teensy. I started a complete rewrite of the SD lib, intending to someday make it able to do these sorts of things from interrupt based libs like audio. So far, my optimized SD code only reads. Someday I'll figure out write support... but it's tough when combined with the optimizations.
So I'm curious to understand more why this is needed?
I'm looking for a way to capture the voice and stream to a cloud service and play a stream return from the cloud service. There are overlap situations and didn't want to lose any while playing and recording. A small delay is ok but long delay may sound awkward. Two separate controllers seems to be ok but costs twice as much.
I don't really understand what this "cloud service" really is. I guess I'm just not getting a clear picture of what this project is really about.
You may or may not know about my audio library efforts on Teensy, and honestly I can't say if that would really help you or not (if you were using a Teensy board). But I can tell you I've implemented real-time recording to SD card, and of course also playing. So far, not both of those simultaneously, and I really don't know if the Arduino SD library would be up to the task. I've also been working on a complete redesign of the SD library, meant for these much demanding applications. But that SD lib work is in its infancy, so far it can only read SD cards, but it does allow playing 4 audio streams simultaneously while also opening files, which the normal SD lib can't possibly do.
I guess you could say I'm on a long mission to eventually make all sorts of advanced audio projects not only possible, but much, much easier. I've done a lot on this over the last couple years, as you can see in this video, but I still have a very long way to go. Along the way, I keep discovering more and more things people wish to do with microcontrollers and audio...
Paul, that was a fantastic tutorial. I watch the entire video. Awesome work! This is the sort of the work I was looking for. Greatly appreciated your input.!!!!
The ideal example project for me would be a IP walkie-talkie with your sound analysis modules in between. On one side a human and the other side is the machine (cloud service).
Would this work :> Teensy(excellent) <==> Audio Adaptor((excellent) <==> Wi-Fi module(???) <==> Cloud service
Streaming audio over network protocols (and integrating nicely into the audio lib) is something we've discussed on the Teensy forum. As I recall, Frank B looked into it and concluded most protocols needed buffers bigger than we could do with the 64K internal RAM. I'm hoping to look at this again when we have a Teensy with 256K RAM. That board will also have the fast 4 bit SDIO interface for the SD card, which also should really help.
I'm constantly looking for ways to use these new boards for IOT applications. I look forward to new and improved Teensy with Wi-Fi. Thanks for the valuable feedback.