This was my second program after "Hello Word" so I have gone for the simplest possible approach, also with teaching other beginners in mind. The code is running at the fastest possible rate as I have added no time delays. I agree that this is not ideal but the mbed does not seem to spend much time wandering off and processing other stuff so the timing seems good enough. The evidence is that it really works. If there were timing problems, the phasing frequencies would shift up and down and this was not noticeable.
I wonder if the ADC and DAC always take the same time to complete a conversion.
The only other mbed audio processing code I have found was an echo effect. That code was similar to mine.
I'd be delighted if a more experienced mbed user could post a better solution here. Reading other posts, it looks as though there are several hardware level tricks that could be used.
I want to try out a few simple DSP effects on audio like adding or multiplying two audio inputs and returning the result as an audio output. If the DC offset is not removed, this can't possibly work, especially with the multiplying example. Has anyone got a simple work-around for this problem?
I have already produced a phasing effect by adding audio to a slightly delayed copy of the same signal with the delay varying a little. I fixed the DC offset by subtracting 32768 from the summed signals. I don't like this because the 32768 was a guess.
Is there a better answer?