Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/HelloChatterbox/OpenTone
send data by audio encoded in DTMF tones
https://github.com/HelloChatterbox/OpenTone
Last synced: 3 months ago
JSON representation
send data by audio encoded in DTMF tones
- Host: GitHub
- URL: https://github.com/HelloChatterbox/OpenTone
- Owner: HelloChatterbox
- Created: 2020-03-31T21:59:17.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-04-23T03:26:18.000Z (over 4 years ago)
- Last Synced: 2024-05-10T00:11:34.316Z (6 months ago)
- Language: Python
- Size: 150 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# OpenTone
DTMF encoding/decoding
## Install
```bash
pip install opentone
```## Usage
Here is a clone of [GoogleTone](https://chrome.google.com/webstore/detail/google-tone/nnckehldicaciogcbchegobnafnjkcne?hl=en)
```python
from opentone import ToneGenerator, ToneDecoder
import pyshorteners as pyshortdef tiny_link(url):
tinyurl = pyshort.Shortener().tinyurl.short(url)
# The consant prefix in the TinyURL is standard and can be
# removed altogether, and added in the receiving station
URL = "http://tinyurl.com/"
url = tinyurl[len(URL):]
return urlurl = "https://hellochatterbox.com"
url = tiny_link(url)
wave_file = "chatterbox_encoded.wav"
tone_gen = ToneGenerator()
tone_gen.encode_to_wave(url, wave_file)decoder = ToneDecoder()
decoded_url = decoder.decode_wave(wave_file)assert decoded_url == url
print("http://tinyurl.com/" + decoded_url)
```NOTE: Input wave files should be 8khz mono
convert files with
```bash
ffmpeg -i some_file.mp3 -acodec pcm_s16le -ac 1 -ar 8000 out.wav
```