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

Thread: Audio shield crashes when switching songs/files

  1. #1
    Junior Member
    Join Date
    Jan 2019
    Posts
    9

    Audio shield crashes when switching songs/files

    Hello!

    I am having trouble with a project I have been working on for a while now. The idea is basically to mimic an analog radio, but instead of tuning to different 'stations', this radio will simply switch between .raw audio files as you 'tune' the radio. There are two audio files playing simultaneously, one static and one is the 'station'. Tuning is controlled with an analog 10-turn potentiometer. As the radio is tuned to a 'station', the matching station's audio file is meant to start, the volume of the 'static' will go down, and the volume of the 'station' will come up. (See me code attached below)

    The problem I am having is that the audio often times does not play properly. Sometimes, it crashes completely and you hear a loud, constant buzzing (a video demonstrating this is here: https://drive.google.com/open?id=19D...Zk1mHLjIPrHxpo) through the speakers that doesn't not stop until you shut down the Teensy. Other times, a 'station' simply will not play when the radio is 'tuned' to that station. This behavior is unpredictable. Sometimes, if you 'tune' to another station and then return to the station that was not working before, it will play. Other times, it won't play no matter what.

    As you can see in the code, I've tried adding some delays, which does help somewhat with the crashing/buzzing but does not help at all with the stations not playing when they are supposed to. I have tried this with multiple SD cards (two different SanDisk class 10's, one cheapo off-brand which claims to also be class 10. All are 32 gb).

    Anyone have any ideas what the issue might be? Has anyone experienced this crashing/buzzing with audio files before? Is it that I'm trying to send commands to the SD card reader too quickly or something?

    Thank you to anyone who can help!
    Attached Files Attached Files

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,857
    Try editing SD_t3.h to turn on the experimental SD card optimizations.

    Also search for "Radio Music Thing Modular", which is an open source modular synth product which does something pretty similar to what you're describing. Maybe looking at their code can give you some ideas?

  3. #3
    Junior Member
    Join Date
    Jan 2019
    Posts
    9
    I believe using turning on SD optimization has fixed the issue! At least as far as I can tell so far. Thank you again, Paul!

Posting Permissions

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