I have a problem with the example PlayWavfromsdcard sketch and all I have added is put
play.wav (c.wav");
delay (4000);
wav.stop();
delay (4000);
and commented out everything else in the loop to get it to play the first 4
seconds of the file over and over again as a test with a 4 second pause.
This all seems to work OK but I get a glitch at the start of play each time,
about 186 milliseconds into the sound. I thought a simple play.wav command
would give me a clean start of play.? The sound plays for 4 secs and pauses
for 4 seconds OK and repeats.
I have attached copies of mp3 recordings of it from audacity. The line jack on the
audio shield was connected to line in on PC for the recording. The sound
file on the SDcard for teensy to play is only a squarewave files I had
generated in audacity and saved it to sdcard. This sound file loops in audacity without any glitches even between the end and the beginning when played by "hold shift and click Play in audacity"
I also attach the code from the example sketch which I have modified to give various combinations of play and stop and all give me the glitch...sounds like a beep beep at the start of play.
Testfile1usb.mp3 is the sound recorded from PlayRepeatAudioshield1.ino and has the first play in the setup and from then on repeated plays and stops in the loop. The Teensy3.1 and audioshield are powered from the USB port of PC when recording. You can see on the first play what I think is digital noise from the setup then then a few odd square waves the the sound squarewaves and then a glitch at approx 186 milliseconds later. For the repeated plays we dont see any digital setup noise, it just starts to play with a glitch at 186 milliseconds.
The Testfile1pwr.mp3 is a recording of same sketch but with the teensy3.1 and shield powered by a powerpack plugged into the teensy usb socket, and only the audio out jack from the shield connected to the PC soundcard linein. This gives a clean sound, no digital noise, but still the glitch at 186 milliseconds.
Testfile2usb.mp3 and Testfile2pwr is similar except I have put a delay is setup to separate the setup noises from the play loop. You can see the difference in the sketch PlayRepeatAudioshield2.ino. Still get the glitch at 186 milliseconds.
I just wonder is others getting this problem and has anyone got a solution. Please.
This is sketch PlayRepeatAudioshield1.ino......
This is sketch PlayRepeatAudioshield2.ino
play.wav (c.wav");
delay (4000);
wav.stop();
delay (4000);
and commented out everything else in the loop to get it to play the first 4
seconds of the file over and over again as a test with a 4 second pause.
This all seems to work OK but I get a glitch at the start of play each time,
about 186 milliseconds into the sound. I thought a simple play.wav command
would give me a clean start of play.? The sound plays for 4 secs and pauses
for 4 seconds OK and repeats.
I have attached copies of mp3 recordings of it from audacity. The line jack on the
audio shield was connected to line in on PC for the recording. The sound
file on the SDcard for teensy to play is only a squarewave files I had
generated in audacity and saved it to sdcard. This sound file loops in audacity without any glitches even between the end and the beginning when played by "hold shift and click Play in audacity"
I also attach the code from the example sketch which I have modified to give various combinations of play and stop and all give me the glitch...sounds like a beep beep at the start of play.
Testfile1usb.mp3 is the sound recorded from PlayRepeatAudioshield1.ino and has the first play in the setup and from then on repeated plays and stops in the loop. The Teensy3.1 and audioshield are powered from the USB port of PC when recording. You can see on the first play what I think is digital noise from the setup then then a few odd square waves the the sound squarewaves and then a glitch at approx 186 milliseconds later. For the repeated plays we dont see any digital setup noise, it just starts to play with a glitch at 186 milliseconds.
The Testfile1pwr.mp3 is a recording of same sketch but with the teensy3.1 and shield powered by a powerpack plugged into the teensy usb socket, and only the audio out jack from the shield connected to the PC soundcard linein. This gives a clean sound, no digital noise, but still the glitch at 186 milliseconds.
Testfile2usb.mp3 and Testfile2pwr is similar except I have put a delay is setup to separate the setup noises from the play loop. You can see the difference in the sketch PlayRepeatAudioshield2.ino. Still get the glitch at 186 milliseconds.
I just wonder is others getting this problem and has anyone got a solution. Please.
This is sketch PlayRepeatAudioshield1.ino......
Code:
#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>
// Create the Audio components. These should be created in the
// order data flows, inputs/sources -> processing -> outputs
//
AudioPlaySdWav wav;
AudioOutputI2S dac;
// Create Audio connections between the components
//
AudioConnection c1(wav, 0, dac, 0);
AudioConnection c2(wav, 1, dac, 1);
// Create an object to control the audio shield.
//
AudioControlSGTL5000 audioShield;
void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(5); // memory allocation
audioShield.enable();
audioShield.volume(40); // set volume at 40
SPI.setMOSI(7);
SPI.setSCK(14);
if (SD.begin(10)) {
// wav.play("01_16M.WAV");
wav.play("C.WAV");
}
}
void loop() {
// float vol = analogRead(15);
// vol = vol / 10.24;
// audioShield.volume(vol);
// delay(20);
delay(4000); // play for 4 seconds
wav.stop();
delay(4000); // stop for 4 seconds
wav.play("C.WAV");
}
This is sketch PlayRepeatAudioshield2.ino
Code:
#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>
// Create the Audio components. These should be created in the
// order data flows, inputs/sources -> processing -> outputs
//
AudioPlaySdWav wav;
AudioOutputI2S dac;
// Create Audio connections between the components
//
AudioConnection c1(wav, 0, dac, 0);
AudioConnection c2(wav, 1, dac, 1);
// Create an object to control the audio shield.
//
AudioControlSGTL5000 audioShield;
void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(5); // memory allocation
audioShield.enable();
audioShield.volume(40); // set volume at 40
SPI.setMOSI(7);
SPI.setSCK(14);
if (SD.begin(10)) {
// wav.play("01_16M.WAV");
// wav.play("C.WAV");
}
delay(1000);
}
void loop() {
// float vol = analogRead(15);
// vol = vol / 10.24;
// audioShield.volume(vol);
// delay(20);
wav.play("C.WAV");
delay(4000); // play for 4 seconds
wav.stop();
delay(4000); // stop for 4 seconds
// wav.play("C.WAV");
}