PDA

View Full Version : Audio library and SdFat Library



darioconcilio
04-30-2016, 02:28 PM
Can Audio Library use SdFat library?

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

MichaelMeissner
04-30-2016, 03:29 PM
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.

WMXZ
04-30-2016, 03:35 PM
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\examples \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.

darioconcilio
04-30-2016, 09:06 PM
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\examples \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.......

PaulStoffregen
05-01-2016, 01:59 PM
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.

darioconcilio
05-02-2016, 08:56 AM
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/tutorial-how-to-use-sd-card-with-arduino,
how can I keep this?

PaulStoffregen
05-02-2016, 10:57 AM
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.

darioconcilio
05-02-2016, 11:02 AM
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!

paqwa
10-17-2017, 11:59 PM
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

paqwa
10-18-2017, 01:52 AM
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?

defragster
10-18-2017, 08:49 AM
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

v_zhukov
10-18-2017, 05:00 PM
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?