An open API service indexing awesome lists of open source software.

https://github.com/hallicopter/go-dtmf

Decode DTMF audio in go.
https://github.com/hallicopter/go-dtmf

dtmf dtmf-decoder

Last synced: 2 months ago
JSON representation

Decode DTMF audio in go.

Awesome Lists containing this project

README

          

# go-dtmf, the simplest way to decode DTMF audio in golang.

This library provides two high level API to decode [DTMF](https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling) audio or byte slice.
It uses the Goertzel algorithm.

### Examples
The example can be run from the examples folder.

``go run examples/dtmf_file.go``

## Docs

### dtmf
import "go-dtmf/dtmf"

### Usage

### func DecodeDTMFFromBytes

```go
func DecodeDTMFFromBytes(audioBytes []byte, rate float64, wiggleRoom int) (string, error)
```
DecodeDTMFFromBytes This decodes the audio bytes and saves the value in
DTMF.DecodedValue The wiggleRoom value is recommended to be between 5-15. For
shorter, sharper, faster DTMF audios, a wiggleRoom of 5 would be good. For
longer, more continuous DTMF audios, a higher wiggleRoom will prevent false
repeats.

### func DecodeDTMFFromFile

```go
func DecodeDTMFFromFile(filepath string, rate float64, wiggleRoom int) (string, error)
```
DecodeDTMFFromFile Expects raw audio as the input, gives the decoded DTMF string
as output. The wiggleRoom value is recommended to be between 5-15. For shorter,
sharper, faster DTMF audios, a wiggleRoom of 5 would be good. For longer, more
continuous DTMF audios, a higher wiggleRoom will prevent false repeats.

## Credits
It was initially built on [goertzel](https://github.com/CyCoreSystems/goertzel) by CyCoreSystems, but has been since ported to use a modified version of [go-dsp](https://github.com/samuel/go-dsp).
The underlying principle remains unchanged.