Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: Teensy LC +Prop Shield LC + AudioZero

  1. #1
    Junior Member
    Join Date
    May 2018
    Posts
    4

    Teensy LC +Prop Shield LC + AudioZero

    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.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,932
    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.

  3. #3
    Junior Member
    Join Date
    May 2018
    Posts
    4
    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/Teen...romSerialFlash

    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.

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,388
    Bing search gave link to a sample from Frank B:: Play-RAW-from-Serial-Flash

    … YMMV with T_LC

  5. #5
    I submitted a pull request to add the ability to play from serial flash. Works with Teensy LC and Prop Shield.

  6. #6
    Junior Member
    Join Date
    May 2018
    Posts
    4
    Quote Originally Posted by MickeyDelp View Post
    I submitted a pull request to add the ability to play from serial flash. Works with Teensy LC and Prop Shield.
    Can you share the code on how you did that?

  7. #7
    You can see the code in the pull request on github (https://github.com/PaulStoffregen/Au...o/pull/1/files).
    The play method takes a File as a parameter. I just duplicated that method and changed the data type to a SerialFlashFile without changing the rest of the code in the method. I also created a sample program (also in the pull request).

  8. #8
    Junior Member
    Join Date
    May 2018
    Posts
    4
    Thank you for that

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •