I'm using a Teensy 4.0 with the Audio Adaptor Board, using the Line Out on the Audio Adaptor, to play some sounds I converted from .wav to .cpp using wav2sketch.
If I loop through just two of the sounds, they're nice and clean (cleandrums.zip below), but as soon as I uncomment line 47 in my sketch, which plays a third drum sound, now all three samples have noise introduced while they're playing (dirtydrums.zip below).
To be clear, I'm not talking about the line noise heard during the silence in between drum sounds. I'm talking about the distortion-type noise you hear towards the end of each drum sound in dirtydrums.wav (most noticeable right after the kick drum sound).
I've tried adjusting all sorts of variables, but I can't seem to achieve the clean sound heard in cleandrums.wav as soon as I try to play a third sound. Here's my sketch:
Any ideas?
If I loop through just two of the sounds, they're nice and clean (cleandrums.zip below), but as soon as I uncomment line 47 in my sketch, which plays a third drum sound, now all three samples have noise introduced while they're playing (dirtydrums.zip below).
To be clear, I'm not talking about the line noise heard during the silence in between drum sounds. I'm talking about the distortion-type noise you hear towards the end of each drum sound in dirtydrums.wav (most noticeable right after the kick drum sound).
I've tried adjusting all sorts of variables, but I can't seem to achieve the clean sound heard in cleandrums.wav as soon as I try to play a third sound. Here's my sketch:
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioPlayMemory playMem1; //xy=265.33332824707026,108.66666158040363
AudioPlayMemory playMem2; //xy=271.9999809265137,178.6666555404663
AudioMixer4 mixer1; //xy=615.3333282470702,180.33332824707028
AudioOutputI2S i2s1; //xy=978.6666615804035,175.33332824707028
AudioConnection patchCord1(playMem1, 0, mixer1, 0);
AudioConnection patchCord2(playMem2, 0, mixer1, 1);
AudioConnection patchCord3(mixer1, 0, i2s1, 0);
AudioConnection patchCord4(mixer1, 0, i2s1, 1);
// GUItool: end automatically generated code
// WAV files converted to code by wav2sketch
#include "AudioSampleSnare.h" // http://www.freesound.org/people/KEVOY/sounds/82583/
#include "AudioSampleHihat.h" // http://www.freesound.org/people/mhc/sounds/102790/
#include "AudioSampleKick.h" // http://www.freesound.org/people/DWSD/sounds/171104/
// 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(10);
// turn on the output
audioShield.enable();
}
void loop() {
playMem1.play(AudioSampleKick);
delay(2000);
playMem2.play(AudioSampleSnare);
delay(2000);
playMem2.play(AudioSampleHihat); // All I have to do is remove this line, and the previous two sounds are clean
delay(2000);
}
Any ideas?