diff --git a/src/AudioGeneratorRTTTL.cpp b/src/AudioGeneratorRTTTL.cpp index 1845949b..b45254b8 100644 --- a/src/AudioGeneratorRTTTL.cpp +++ b/src/AudioGeneratorRTTTL.cpp @@ -51,16 +51,6 @@ bool AudioGeneratorRTTTL::isRunning() return running; } -// Can't do pure square wave, the I2S DACs don't like being fed them -static int16_t period[64] PROGMEM = { - 250, 500, 1000, 2000, 4000, 8000, 16000, 32000, 32000, 31000, 32000, 31000, - 32000, 31000, 32000, 31000, 32000, 31000, 32000, 32100, 32000, 31000, 32000, - 31000, 32000, 32000, 16000, 8000, 4000, 2000, 1000, 500, - -250, -500, -1000, -2000, -4000, -8000, -16000, -32000, -32000, -31000, - -32000, -31000, -32000, -31000, -32000, -31000, -32000, -31000, -32000, - -32100, -32000, -31000, -32000, -31000, -32000, -32000, -16000, -8000, - -4000, -2000, -1000, -500 }; - bool AudioGeneratorRTTTL::loop() { if (!running) goto done; // Nothing to do here! @@ -84,8 +74,7 @@ bool AudioGeneratorRTTTL::loop() while (samplesSent < ttlSamples) { int samplesSentFP10 = samplesSent << 10; int rem = samplesSentFP10 % ttlSamplesPerWaveFP10; - rem = (64 * rem) / ttlSamplesPerWaveFP10; - int16_t val = pgm_read_word(&period[rem]); + int16_t val = (rem > ttlSamplesPerWaveFP10/2) ? 8192:-8192; int16_t s[2] = { val, val }; if (!output->ConsumeSample(s)) goto done; samplesSent++;