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

Thread: Teensy LC to play WAV files through Prop Shield LC? I'm guessing No.

  1. #1

    Teensy LC to play WAV files through Prop Shield LC? I'm guessing No.

    Can the Teensy LC be used to play WAV files stored on the Prop Shield LC? Now that I have it all soldered together I'm now guessing the answer is NO.

    I was hoping to use a Teensy LC within a handheld prop to chase some LEDs and play a couple of WAV sound files off of the built-in flash memory on a Prop Shield LC using its audio amplifier. I got a test WAV clip copied to the Teensy LC using TeensyTransfer, but when I try to compile the code for a WAV player I get a ton of error messages. Further research on the Teensy LC announcement thread indicates that it can't handle the audio libraries required. 90% of all of this is way beyond my comprehension, so there's no way I'd be able to hack anything to do that from scratch.

    I guess I assumed that because the Teensy LC had a built-in DAC like its fancier siblings it could handle what I assumed to be simple audio playback. On further examination I see that the Teensy LC is NOT listed as being compatible with the audio tools. Oh, well, maybe I can use this LC for something else. I have a 3.2 kicking around I can use if I can figure out how to unsolder the Prop Shield LC from the Teensy LC. It might be easier to simply order another Prop Shield LC.

    Just curious. In simple terms, what could one do with the DAC built into the Teensy LC?

    Best.

    Shawn Marshall

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    15,943
    Teensy LC can't run the normal Teensy Audio Library, but I did port this one from Arduino Zero. It works well on LC, but it's limited to just playing 1 WAV file (same as on Arduino Zero).

    https://github.com/PaulStoffregen/AudioZero

  3. #3
    Thanks for the quick reply, Paul. When you say your sketch can play one WAV file I assume that means one total (stored on the Prop Shield), not one and then another depending on what button I push? I need to play TWO different WAV files for this stupid PKE Meter thing I've been working on forever.

    Best.

    Shawn

  4. #4
    Moderator MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,548
    Quote Originally Posted by WShawn View Post
    Thanks for the quick reply, Paul. When you say your sketch can play one WAV file I assume that means one total (stored on the Prop Shield), not one and then another depending on what button I push? I need to play TWO different WAV files for this stupid PKE Meter thing I've been working on forever.

    Best.

    Shawn
    From the example, it looks like the the LC can play one file. When the file is done, it can then play another file (or the same file as in the sketch). I believe what Paul means, you can't play two separate WAV files at the same time like you can with the Audio library and a 3.2/3.5/3.6.

  5. #5
    Thanks for the reply, Mike. What you describe sounds like it could work for my purposes since I only want to play one file at a time. Basically this prop has two touch switches. When one is pressed and held one WAV file would play. When released that file would stop playing. When the other button is pressed the other WAV file plays, stopping when the button is released.

    Assuming this could work I'll have to ask some friends who are much better coders than I am to help with the sketch. Is it just a matter of opening up and playing the particular sound file I want based on the button input? I wonder if there's a way to stop playback if I need it stop before the file is finished, or a way to make it start again as long as I'm holding down the button to loop it?

    Or it might be easier to just spend $10 to get a new Prop Shield LC to solder to the Teensy 3.2 I have kicking around. That would allow me to continue to cobble together the WAV player sketches I'm a little familiar with. I can modify existing sketches to a certain extent, but I don't know how to code them from scratch.

    Best.

    Shawn

  6. #6
    Moderator MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,548
    Quote Originally Posted by WShawn View Post
    Thanks for the reply, Mike. What you describe sounds like it could work for my purposes since I only want to play one file at a time. Basically this prop has two touch switches. When one is pressed and held one WAV file would play. When released that file would stop playing. When the other button is pressed the other WAV file plays, stopping when the button is released.
    Paul's code as written is synchronous. I.e. it will not return from play until the song is finished. So, you won't be able to detect a button press with digitalRead.

    Another alternative is to get one of the cheap amplifiers floating around ebay/amazon, and use that instead of the prop shield.

    I just bought these stereo amplifiers for my 3.5. I haven't had a chance to use them yet, so I can't say how well they work:


    Before getting the prop shield, I have bought the Adafruit amplifier, and used it:

  7. #7
    Thanks again for the reply.

    I had been using one of the Adafruit amps and playing my sounds as samples, and it worked fine, but I like the way the Teensy Prop shield neatly fits onto the Teensy, plus it has the flash memory to store my sound files. It will let me play much longer sounds than the very short samples I created to fit into the Teensy 3.2 memory.

    $10 ain't going to break my bank. Or I can try unsoldering the shield and attaching it to my 3.2. My old Radio Shack solder sucking tool isn't working too well these days, though.

    Best.

    Shawn

  8. #8
    Moderator MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,548
    Quote Originally Posted by WShawn View Post
    Thanks again for the reply.

    I had been using one of the Adafruit amps and playing my sounds as samples, and it worked fine, but I like the way the Teensy Prop shield neatly fits onto the Teensy, plus it has the flash memory to store my sound files. It will let me play much longer sounds than the very short samples I created to fit into the Teensy 3.2 memory.

    $10 ain't going to break my bank. Or I can try unsoldering the shield and attaching it to my 3.2. My old Radio Shack solder sucking tool isn't working too well these days, though.

    Best.

    Shawn
    Yep, the prop shield rocks. I find myself adding the prop shield either for its sound amp and/or voltage level shifter for neopixel/ws2812/apa102/dotstar LEDs.

    In terms of de-soldering, some days I seem to be doing more un-soldering than soldering. I picked up this velleman electric desoldering pump (VTDESOL3U) at my local Microcenter, and it helps (sometimes I find it easier to use the wire braid, and sometimes I use the Velleman). IMHO, it does have a serious design flaw in that there is no on/off switch on the unit, and there is no LED to indicate it is plugged in. So I use a power strip to turn it on and off.

  9. #9
    Moderator KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,146
    Thank Michael,

    I have been using an old fashion solder sucker, but that looks a lot easier to completely unsolder something. I ordered it through Amazon as there are no local Microcenter stores in our state. It was slightly more expensive on Amazon, but I have free shipping.

  10. #10
    I went ahead and ordered and have received another Prop Shield LC. In my previous setup with the Teensy LC I soldered the Prop Shield LC to every pin, along with the DAC connection on the end.

    With this new Prop Shield and the Teensy 3.2 I have kicking around I'm wondering whether it's overkill to solder every pin. I want to use the Prop Shield LC to store my two WAV audio clips and act as an audio amplifier. As far as I can tell that would mean connecting the following pins from the Teensy to the Prop Shield LC:

    MOSI 11
    MISO 12
    SCK 13
    MEM_CS 6
    AMP_EN 5
    AudioIN DAC
    5Vpower Vin
    GND GND

    I'm really not clear on what all the SPI connections are used for, so I'm just guessing I need to solder them all up.

    Thanks.

    Shawn

  11. #11
    Moderator MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,548
    Quote Originally Posted by WShawn View Post
    I went ahead and ordered and have received another Prop Shield LC. In my previous setup with the Teensy LC I soldered the Prop Shield LC to every pin, along with the DAC connection on the end.

    With this new Prop Shield and the Teensy 3.2 I have kicking around I'm wondering whether it's overkill to solder every pin. I want to use the Prop Shield LC to store my two WAV audio clips and act as an audio amplifier. As far as I can tell that would mean connecting the following pins from the Teensy to the Prop Shield LC:

    MOSI 11
    MISO 12
    SCK 13
    MEM_CS 6
    AMP_EN 5
    AudioIN DAC
    5Vpower Vin
    GND GND

    I'm really not clear on what all the SPI connections are used for, so I'm just guessing I need to solder them all up.

    Thanks.

    Shawn
    I believe you need the following pins as well:
    • 3.3v pin.
    • Analog ground pin (between 3.3v and VIN). This is used for the speaker output.
    • SDA/SCL (pins 18/19). While the LC shield doesn't have the motion sensor i2c chips, the board does provide pull-up resistors for i2c, so you wouldn't need to add them.
    • LED_CS (pin 7). This is used to enable level shifting 11 and 13 to VIN (you don't want both MEM_CS and LED_CS set at the same time).


    The SPI pins (MOSI, MISO, SCK, and MEM_CS) are used to access the 8 Mbyte flash memory drive that is on both prop shields.

    Another way to do it is to put stacking headers on either the Teensy (assuming your Teensy doesn't have headers installed), or on the prop shield. That way you can remove it (note, you would need to connect the DAC pin separately).

  12. #12
    Thanks for the reply. I'll just solder them all up as I did before. It sounds like the combination of a Teensy 3.2 and a Prop Shield LC can handle my needs, so I shouldn't have to worry about desoldering them. I found some info on Sparkfun that describes the theories behind the various SPI connections. I'll have to do some more studying to try to understand how the sketch code works to trigger the appropriate sound clip when a certain button is activated (touchRead).

    Best.

    Shawn

Posting Permissions

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