# dtmf-detection-stream

> This is a simple node.js DTMF detection stream.

Latest version **1.18.1** (published 2026-06-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install dtmf-detection-stream
pnpm add dtmf-detection-stream
yarn add dtmf-detection-stream
bun add dtmf-detection-stream
```

## Health

**Score 45/100 (D)** — status: active.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.18.1 |
| Published | 2026-06-02 |
| First published | 2020-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | MayamaTakeshi |
| Maintainers | mayama |

## Links

- npm: https://www.npmjs.com/package/dtmf-detection-stream
- Repository: https://github.com/MayamaTakeshi/dtmf-detection-stream
- Homepage: https://github.com/MayamaTakeshi/dtmf-detection-stream#readme
- Issues: https://github.com/MayamaTakeshi/dtmf-detection-stream/issues
- npm.io page: https://npm.io/package/dtmf-detection-stream

## Recent versions

- 1.18.1 (latest) — 2026-06-02
- 1.18.0 — 2024-06-06
- 1.17.0 — 2024-05-08
- 1.16.2 — 2024-04-21
- 1.16.1 — 2024-04-18
- 1.16.0 — 2024-04-17
- 1.15.0 — 2024-04-17
- 1.14.1 — 2024-04-16
- 1.14.0 — 2024-04-14
- 1.13.0 — 2024-04-14
- 1.12.0 — 2024-04-10
- 1.11.0 — 2024-04-09
- 1.10.1 — 2024-04-06
- 1.10.0 — 2024-04-06
- 1.9.2 — 2024-04-04
- … 12 more at https://npm.io/package/dtmf-detection-stream/versions

## README

# dtmf-detection-stream

This is a simple node.js DTMF detection stream.

## Installation 

```
npm i dtmf-detection-stream
```

## Sample usage

```
const { ToneStream } = require('tone-stream')
const Speaker = require('speaker')
const DtmfDetectionStream = require('dtmf-detection-stream')

const format = {
  sampleRate: 8000,
  bitDepth: 16,
  channels: 1,
}

const ts = new ToneStream(format)
ts.add([800, 's']) // silence
ts.add([800, 'DTMF:1'])
ts.add([800, 's']) // silence
ts.add([800, 'DTMF:2'])
ts.add([800, 's']) // silence
ts.add([800, 'DTMF:3'])
ts.add([800, 's']) // silence

const dds = new DtmfDetectionStream({format})

dds.on('dtmf', data => {
  console.log('Got dtmf:', data)
})

dds.on('speech', data => {
  console.log('Got speech:', data)
  process.exit(0)     
})

ts.on('data', data => {
  dds.write(data)
})

const speaker = new Speaker(format)
ts.pipe(speaker)

```
Output:

```
$ node mytest.js 
Got dtmf: { digit: '1', timestamp: 0.207 }
Got dtmf: { digit: '2', timestamp: 0.4025 }
Got dtmf: { digit: '3', timestamp: 0.6095 }
Got speech: { transcript: '123', timestamp: 0.6095 }

```

## Events

The DtmfDetectionStream emits two kinds of events:
  - 'dtmf': single digit as soon as it is detected (notified upon signal extintion).
  - 'speech': aggregated digits after 500 milliseconds with no more digits being detected. So it will be like someone is using DTMF to talk (this will permit to treat dtmf-detection-stream as a speech-recog-stream and use it with mrcp_server and ws_speech_server).

## More Examples

See [here](https://github.com/MayamaTakeshi/dtmf-detection-stream/tree/master/examples).

---
_Source: https://npm.io/package/dtmf-detection-stream · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
