Teensy LC +Prop Shield LC + AudioZero

Status
Not open for further replies.

GusBiz

New member
Hi guys,

I am trying to play an audio file through the Teensy Prop Shield LC with the Teensy LC.

I have managed to get the .wav file onto the SPI memory chip on the Prop Shield using Teensytransfer.exe.

I got in contact with Paul and he suggested using the AudioZero Library he adapted from the Arduino
Simple Audio Player Library. (see below) since the Teensy LC can't use the Audio Shield Libraries.

https://github.com/PaulStoffregen/AudioZero

However this uses the SD card as its source and I would like to use the memory chip on the Prop shield.

I don't have any experience with these kinds of libraries. How do I do this?

I suspect its with a straight SPI Library but I am not sure how to do this.

Does anyone have any suggestions on how to write the code to replace the "SD.open" function.

I get that it might be as simple as SPI.begin but then to use that Lib to use the file on the memory chip....I get lost.

If anyone has any references I can use or suggestions, I would greatly appreciate it.
 
In this case you're probably better off not using AudioZero at all. It's mostly about SD card access and WAV file parsing.

Probably the simplest way would be to convert your WAV files to RAW. Or just make sure they're mono format and treat them as raw data, accepting that the small WAV header data might play as a click or tiny glitch.

The path to success involves solving small problems first, where you check that each individual thing works, and then put them together. Along the way, you run each test and print stuff to the Arduino Serial Monitor to verify.

The first simple test is to just use analogWrite() to the DAC pins and make sure you can see the voltage change.

Next you'll need to be able to read the data. If using SerialFlash, try opening the file and reading it. Just print the numbers to the serial monitor. Look at the raw data of the file on your PC to make sure the numbers match up. If the data is 16 bit samples, you'll need to make sure you get the bytes in the right order. If the file is stereo, you'll need to skip every other sample.

When you know you've got data and you know you can write to the DAC, create a loop to do these over all the file. You should hear the sound if you've got an amplifier+speaker connected to the DAC. It's almost certainly play at the wrong speed, hopefully much too fast.

After you've got too-fast playing working, the last step is to add delays or use elapsedMicros (simpler) or IntervalTimer (advanced) to control the timing. But the key point is to *not* try to do everything all at once. Do each small step and check it carefully. The path to success for these projects involves making small steps and checking each one carefully, so you can build upon each small success until you've got the whole thing working.
 
Paul,

I had just concluded that about the AudioZero. The error messages I was getting were saying "expecting SD.h" and I was using SerialFlash to communicate with the memory. Which didn't make sense to me considering I hadn't even included the SD Library.

Btw, this is a great post from you. Probably the best post I have gotten from an open public forum. So much more than a few tips. Its an experimentation philosophy and I usually try to do too much in one go.

I am going to use this Lib
https://github.com/FrankBoesing/Teensy-PlayRawFromSerialFlash

There isn't an example sketch but I will find one somewhere.

Thanks again for your reply. Will be back when I get something working.
 
I submitted a pull request to add the ability to play from serial flash. Works with Teensy LC and Prop Shield.
 
Status
Not open for further replies.
Back
Top