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

Thread: Audio library and SdFat Library

  1. #1
    Member darioconcilio's Avatar
    Join Date
    Feb 2016
    Location
    Varese, Italy
    Posts
    52

    Audio library and SdFat Library

    Can Audio Library use SdFat library?

    This is ink https://github.com/greiman/SdFat

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,851
    The Teensy SD.h implementation includes its own version of SdFat library. The copyright date in SD/utility/SdFat.h is 2009, while the version at github is 2015-03-24. So, it depends on whether your code needs any of the changes or improvements made since 2009 whether it would work.

    If you look at the example WavFilePlay.ino, it uses SD.h to play WAV files on the SD card.

  3. #3
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,764
    Quote Originally Posted by darioconcilio View Post
    Can Audio Library use SdFat library?

    This is ink https://github.com/greiman/SdFat
    asked this way, no. Audio library has only the functions you may find in the Audio System design tool https://www.pjrc.com/teensy/gui/
    If you mean can you write a program that uses audio library AND SdFat, yes. See recorder.ino in Arduino path
    ".....\hardware\teensy\avr\libraries\Audio\example s\Recorder" for an example of using Pauls Sd wrapper of SdFat. To use Greiman's SdFat you maust change include file and adapt to Greiman's API.

  4. #4
    Member darioconcilio's Avatar
    Join Date
    Feb 2016
    Location
    Varese, Italy
    Posts
    52

    Unhappy SD sparkfun without support circuit, SdFat library and Audio library of Teensy.....

    Quote Originally Posted by WMXZ View Post
    asked this way, no. Audio library has only the functions you may find in the Audio System design tool https://www.pjrc.com/teensy/gui/
    If you mean can you write a program that uses audio library AND SdFat, yes. See recorder.ino in Arduino path
    ".....\hardware\teensy\avr\libraries\Audio\example s\Recorder" for an example of using Pauls Sd wrapper of SdFat. To use Greiman's SdFat you maust change include file and adapt to Greiman's API.
    Ok my problem is this: I projected a circuit using https://www.adafruit.com/products/254 and I try to use Audio Library, it's all OK! Great!
    Now I met a problem because my friends are using https://www.sparkfun.com/products/544 and it not uses the same support curcuit, but it needs only simple circuit with some resistence. This solution can be used with SdFat Library (I tryed it, ok!)....and now? Audio library? I'm going crazy.......

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,754
    Why does it require SdFat? That Sparkfun board is just wires to the socket. Should work with the SD lib.

    About your original question, the Audio lib uses SD, not SdFat. If you really must use SdFat, you will need to modify or delete several files in the audio lib.

  6. #6
    Member darioconcilio's Avatar
    Join Date
    Feb 2016
    Location
    Varese, Italy
    Posts
    52
    Quote Originally Posted by PaulStoffregen View Post
    Why does it require SdFat? That Sparkfun board is just wires to the socket. Should work with the SD lib.

    About your original question, the Audio lib uses SD, not SdFat. If you really must use SdFat, you will need to modify or delete several files in the audio lib.
    They used this approach http://garagelab.com/profiles/blogs/...d-with-arduino,
    how can I keep this?

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,754
    This thread doesn't seem to say which Teensy you're using. Presumably it's Teensy 3.2, since you're asking about the audio lib...

    If it's a 3.3V Teensy, like 3.2 or LC, then you do not need those resistors. The signals are already 3.3V. Adding the resistors will reduce the signals too much. Especially Teensy 3.2 is *much* faster than regular Arduino, so the resistors also add too much delay as well as reducing the signals too much.

    If the circuit is already built, just remove the 3.3K resistors (the ones which connect to ground), and replace the 1.8K resistors with wires.

  8. #8
    Member darioconcilio's Avatar
    Join Date
    Feb 2016
    Location
    Varese, Italy
    Posts
    52
    Quote Originally Posted by PaulStoffregen View Post
    This thread doesn't seem to say which Teensy you're using. Presumably it's Teensy 3.2, since you're asking about the audio lib...

    If it's a 3.3V Teensy, like 3.2 or LC, then you do not need those resistors. The signals are already 3.3V. Adding the resistors will reduce the signals too much. Especially Teensy 3.2 is *much* faster than regular Arduino, so the resistors also add too much delay as well as reducing the signals too much.

    If the circuit is already built, just remove the 3.3K resistors (the ones which connect to ground), and replace the 1.8K resistors with wires.
    Extactly, Teensy 3.2, ok I'll try it this evening, thank you for precious support!

  9. #9
    Junior Member
    Join Date
    Jun 2017
    Posts
    12
    Hi Paul/Others,

    I'm aware that this is a relatively old thread but I'm also very curious about whether I could potentially alter your PJRC audio library to utilize Bill Greiman's current SdFat library. I've been using this library for quiet a while now and have a good number of projects written that utilize it with tft's and sd cards. However, I would really like to integrate your audio library into a couple of these also as its excellent.

    However, when attempting to do so, I get the usual compilation errors whereby I can't have SD.h and SdFat.h included due to conflicts. The primary processors I'm using are your Teensy 3.6's but also a couple of your 3.2/3.1's. By the way I really like the 3.6, it's a killer processor with decent memory. Anyway, you hinted above that:

    Quote "If you really must use SdFat, you will need to modify or delete several files in the audio lib."

    I was hoping you could provide some guidance or point me in the right direction on specific aspects that would need to be altered. I've tried navigating through it but it's obviously a large and complex library and I'd like to have an idea of the types of changes required, or if it's just simply too large of a task as I'm not a natural programmer, just a cowboy at it! In reality, the main thing I'd like to get operational is the playing of wav's or mp3 from the builtin-sd card. Almost all my projects access this card using Bill's SdFatSdioEX class.

    Any help or guidance would be much appreciated. Regard, Pat

  10. #10
    Junior Member
    Join Date
    Jun 2017
    Posts
    12
    In addition to my message above, I should also mention that I am just looking to output a mono audio signal using the DAC0 channel on the Teensy 3.6 or Teensy 3.2, it that makes things any easier. I also don't have any requirement to mix or analyse any audio signals so just read from file on sd card and play. Maybe as an alternative you might know of some simpler alternative to using the powerful Teensy Audio library for such limited use?

  11. #11
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,405
    There was a post in recent days regarding this: "If you really must use SdFat, you will need to modify or delete several files in the audio lib."

    Perhaps a web search will bring it out if the forum search fails.

    it involves making a local libraries copy of the audio lib and making the changes

  12. #12
    Junior Member
    Join Date
    Oct 2017
    Posts
    7
    Quote Originally Posted by PaulStoffregen View Post
    About your original question, the Audio lib uses SD, not SdFat. If you really must use SdFat, you will need to modify or delete several files in the audio lib.
    Hello!

    Thanks for such an outstanding product as Teensy!!

    I have the same problem with using SdFat library with Teensy. I need to play a MIDI file along with WAV using your Audio Library. As stated the Audio Library uses modified version of SD library for better performance but MD_MIDIFile Library (https://github.com/MajicDesigns/MD_MIDIFile) uses SdFat library for SD card access. Can I use both libraries in the same project without conflicts? What files do I need to modify or delete in the audio lib? And will it reduce the reading performance when playing multiple wav files?

Posting Permissions

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