Search code examples
c#.netnaudioaudio-processingdtmf

decode dtmf from array of bytes using C#


I am developing a software that captures outgoing sound (speaker) and identify if there's any dtmf tones. I used NAudio to capture sound into a form of byte array. I want to detect if there's a dtmf tones on those byte array. I already googled it and i haven't found any solution that is close to my problem. Tapiex (or any commercial libraries) is not an option since i preferred an open source solution.


Solution

  • Do a frequency analysis and look for the two peaks indicating the correct key (see Wikipedia for the exact frequencies used; ignore the 1633Hz column for most uses). Make sure the tones last for at least 100ms before you accept them.

    For frequency analysis, see this StackOverflow question.