Go Down

Topic: New library for PWM playback from SD cards: SimpleSDAudio (Read 109089 times) previous topic - next topic

robsmok

how to build class
play next, previous file
Please help :)

THX

robsmok

hmm
#include <SimpleSDAudio.h>
not working with
#include <SD.h>
:(

Tuttut

Hm, *looking into crystal ball*, try starting with the examples provided by the library. Use Arduino IDE V1.0.x instead of beta versions in case of build trouble.

skoubri

Great project!!! i will try it!

i am just looking not very much for quality but if possible gapless play of parts of the file or between files... don't know if possible. Want to use atmega328 or 2560

thanks!!

Tuttut

Gap-less playback from SD is always a challenge. Even the .play() function might be fast enough, at least the .setFile() function will always do a lot of searching through the FAT filesystem. First try to play the same file again and again using a loop like:

Code: [Select]

while(1) {
   if(SdPlay.isStopped()) SdPlay.play();
}


If this works ok for you, you might youself patch the library in a way that the information that is retrieved by setFile is stored somewhere in RAM and used for quicker change of the file to playback. But this might be not the right starting-project for beginners...

skoubri


Gap-less playback from SD is always a challenge. Even the .play() function might be fast enough, at least the .setFile() function will always do a lot of searching through the FAT filesystem. First try to play the same file again and again using a loop like:

Code: [Select]

while(1) {
   if(SdPlay.isStopped()) SdPlay.play();
}


If this works ok for you, you might youself patch the library in a way that the information that is retrieved by setFile is stored somewhere in RAM and used for quicker change of the file to playback. But this might be not the right starting-project for beginners...


Thank you SO MUCH for the quick answer and the tip too! ... I'll check it and come back with results..

skoubri

#201
Feb 14, 2014, 05:32 pm Last Edit: Feb 16, 2014, 09:49 am by skoubri Reason: 1
Hi again.. used the code below

Code: [Select]
while (S < 1000) {
   S=(pulseIn(13,HIGH,20000);
   if (millis()-t > 999){p=1;t=millis();
   if (p == 1) {
     SdPlay.setFile("START.AFM");
     SdPlay.play();p=0;t=millis();}

and my loop played perfect!!.. BUT now i noticed another problem with pulseIn as i am reading a PWM input to change sounds...

any tips if i can do that? is this an interrupt problem or because changes of the timers? is there anyway to measure PWM while playing sound?

Moko

Is there a way to adjust the volume?
I have a home automation including a clock with my arduino mega, and  would decrease the sound (westminster gong) in the night and set it to normal (it's loud enough) at the day.
Currently i must disable the sound in the night :(
thanks

Tuttut

Hi,
actually there is no such a feature. But usually SD cards have plenty of space - so just prepare one set of files with a lower volume (using a wav editor like Audacity) and switch between them.

Moko


Hi,
actually there is no such a feature. But usually SD cards have plenty of space - so just prepare one set of files with a lower volume (using a wav editor like Audacity) and switch between them.



Good idea. Done. Works.
Thanks...

fx3200

its possible make this with this library? http://onixarts.pl/blog/2014/01/arduino-soundcard

SWinter

SimpleSDAudio patch for Atmega128 with MegaCore bootloader (file SimpleSDAudioDef.h)

Marco97

Hi, I've noticed that if the percentage of memory for global variables is >= 40% the SD Card doesn't initialize anymore! But if the percentage is 39% or less all works perfectly. What's the problem? I tried library version 1.3 and 1.2

Marco97


MarkT

Edit/New: I updated the library (ported the core output part to hand-optimized ASM) and now also 16 Bit audio output (even in stereo) is possible (combining two PWM outputs using 2 resistors, known as 256R-R-network).

You know about sigma-delta noise-shaping?  Its not too hard to get high resolution out of a single 8 bit PWM
channel using it.  Basically you shift the quantization noise up in frequency out of the audio band - its
closely related to dithering in 8 bit graphics.

How do you handle upsampling to 62.5kHz BTW?

For best results with sigma delta noise-shaping I'd suggest using 6 bit PWM so you can run PWM at 250kHz,
gives a lot more space to push the noise into, and its much easier to filter too.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up