views:

11

answers:

1

HI, i'm trying to create a repeating dtmf tone so i can play it with AVAudioPlayer. Currently when i loop it in some audio editing software such as audacity there is always a glitch or change in tone at the point where it repeats. Is there some particular length of time i need to create it to avoid this. I initally created a one second dtmf tone in audacity but this does not repeat smoothly.

A: 

It can't repeat smoothly, as much as you try.

You should calculate period of both frequencies, and calculate loop length accordingly.

For example, if you combine 770 and 1336 hz, your smallest sample is of 1000/770= and 1000/1336.

Then, use your sample rate here. Let it be 44100. Your samples would be of length:

1000*44100/770 = 57272 samples

and

1000*44100/1336 = 33009 samples

Least common multiple for that lengths is 1890491448, and in terms of seconds, that would be 42868 seconds.

So, creating a loop and playing it isn't really feasible.

You can either: create sine wave on the fly and mix it, or create sine wave samples for base frequencies, and then mix them or play them simultaneously.

Daniel Mošmondor