Hi. I have this sketch, it's the sample player from the examples;
It plays the file when I press the button, at the same time the sample is played, a led is turned on. Thing is, there's like 7-10ms delay between the led output and sample. The sample is delayed, I don't know if it's the time it takes to access the flash memory. If that's the reason, could I store the sample into ram? Assuming ram is faster... I really need the led output to be in sync with the sample, that led output acts as a trigger for modular synths...
thanks

Code:
#include "AudioSampleSnare.h" // http://www.freesound.org/people/KEVOY/sounds/82583/
#include "AudioSampleTomtom.h" // http://www.freesound.org/people/zgump/sounds/86334/
#include "AudioSampleHihat.h" // http://www.freesound.org/people/mhc/sounds/102790/
#include "AudioSampleKick.h" // http://www.freesound.org/people/DWSD/sounds/171104/
#include "AudioSampleGong.h" // http://www.freesound.org/people/juskiddink/sounds/86773/
#include "AudioSampleCashregister.h" // http://www.freesound.org/people/kiddpark/sounds/201159/
#include <Bounce.h>
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
Bounce button2 = Bounce(3, 15);
// GUItool: begin automatically generated code
AudioPlayMemory playMem1; //xy=250,561
AudioOutputAnalog dac1; //xy=396,551
AudioConnection patchCord1(playMem1, dac1);
// GUItool: end automatically generated code
void setup() {
pinMode(3, INPUT_PULLUP);
AudioMemory(10);
pinMode(17, OUTPUT);
Serial.begin(9600);
}
void loop() {
button2.update();
if (button2.fallingEdge()) {
playMem1.play(AudioSampleKick);
digitalWriteFast(17, HIGH);
}
else if (button2.risingEdge()) {
digitalWriteFast(17, LOW);
}
}
thanks
