Skip to main content

Python 3 Blue Box DTMF Tone Generator

PyPI - Version GitHub Actions Workflow Status PyPI - Downloads PyPI - License

Modernized python bluebox DTMF tone generator / dialer.

BlueBox Phreaking

How it works

In essence, this is a simple utility that creates dual tone multi-frequency sine waves (50/50 mixed, but that can easily be adjusted). What does this mean? Well you know the sounds that you hear if you have the touchpad tones turned on when you dial a number in your phone? That's what this is. It's able to generate the tones that correspond to the number and output it to an audio device or a python list (for example).

This tool has a CLI interface which allows you to send a sequence of codes via stdin, pipes, files, as an argument, or in an interactive mode.

Why?

Well, initially this was a fun little python 3 project from 2015, but I thought it would be nice to make it modern and extensible, essentially showcasing it as a framework, but this doesn't have to be limited to DTMF / MF, in theory with ease you could turn this into something that reads in code sequences (str) and outputs waves. Also due to issue #3 https://github.com/zeyus/Python3BlueBox/issues/3 it was clear that there were some bugs, so what better way to deal with it than adding tests and a way to decouple things!

Installation

PyPI

pip install mfbluebox

Development

With uv (recommended):

git clone https://github.com/zeyus/Python3BlueBox.git
cd Python3BlueBox
uv sync --all-extras

With pip:

git clone https://github.com/zeyus/Python3BlueBox.git
cd Python3BlueBox
pip install -e ".[dev]"

Requirements

  • Python 3.10+ (tested on 3.10 - 3.14, CI on 3.11 - 3.14)
  • PortAudio (for audio playback)

Usage

CLI

With uv (in development):

uv run python -m bluebox -h

With pip/system Python:

python -m bluebox -h

Output:

usage: python3 -m bluebox [-h] [-l LENGTH] [-p PAUSE] [-a AMPLITUDE] [-s SAMPLE_RATE] [-m MF]
                          [-d] [-b BACKEND] [-o OUTPUT] [-r PAD_PAUSE_DURATION] [-f FILE]
                          [-P PIPE] [-S] [-i] [-v]
                          [sequence]

Generate tone sequences.

positional arguments:
  sequence              The sequence of tones to generate.

options:
  -h, --help            show this help message and exit
  -l, --length LENGTH   The length of each tone in milliseconds.
  -p, --pause PAUSE     The length of the pause between tones in milliseconds.
  -a, --amplitude AMPLITUDE
                        The combined amplitude of the waveforms.
  -s, --sample-rate SAMPLE_RATE
                        The sample rate of the waveforms.
  -m, --mf MF           The MF to use e.g. dtmf, mf.
  -d, --debug           Enable debug logging.
  -b, --backend BACKEND
                        The backend to use for playing the waveforms (pyaudio, wav, dummy).
  -o, --output OUTPUT   Output file path (required for wav backend).
  -r, --pad-pause-duration PAD_PAUSE_DURATION
                        The duration (ms) of the pause before/after sequence.
  -f, --file FILE       The file to read the sequence from.
  -P, --pipe PIPE       Read the sequence from a pipe.
  -S, --stdin           Read the sequence from stdin.
  -i, --interactive     Enter interactive mode.
  -v, --version         show program's version number and exit

Examples

Interactive mode:

uv run python -m bluebox -i
# or with system Python:
python -m bluebox -i

Play a sequence:

uv run python -m bluebox 123456789
# or with system Python:
python -m bluebox 123456789

Write a wav file:

uv run python -m bluebox -b wav -o sequence.wav 1234567890
# or with system python:
python -m bluebox -b wav -o sequence.wav 1234567890

API

You mainly need an BaseMF subclass instance and a Sequencer instance.

from bluebox import DTMF
from bluebox.box import Sequencer

mf = DTMF()
seq = Sequencer(mf = mf)

seq('12345')

Development

Development of different MF implementations and audio backends is extremely easy now. Just create a new class that inherits from the MF class, and register it. Same thing for audio backends.

Currently there are two MF implementations (DTMF and MF), and two audio backends (PyAudio and Dummy).

If you want to contribute, make a fork, and a branch. Please make any PR against develop.

Metadata

Release files for mfbluebox 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mfbluebox 0.3.0
File Size Uploaded
mfbluebox-0.3.0.tar.gz 227.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mfbluebox 0.3.0
File Interpreter ABI Platform
mfbluebox-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 244.9 kB

Release files / mfbluebox-0.3.0.tar.gz

Download URL mfbluebox-0.3.0.tar.gz
Size 227.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fc9ebd5b31b629c289d872263b86535cd1fdc3bd1396f851c32a6885acd63bd4
BLAKE2b-256 checksum
How to use checksums
9176cac38acac2d18b4876f200ea8da7399f134b95355662929a46b1a5ede003
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mfbluebox-0.3.0-py3-none-any.whl

Download URL mfbluebox-0.3.0-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b36e054853cb865cce00cc0ed723e09bb965b4a9031212073489946c924affd2
BLAKE2b-256 checksum
How to use checksums
eac80e3eccbd44102cb939e7c4cdd2efe84644c0d72fc1b361dd9a5ffe677359
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page