Skip to content

Instantly share code, notes, and snippets.

@chriscorwin
Forked from bitmvr/dtmf--mary-had-a-little-lamb.js
Created January 9, 2019 14:20
Show Gist options
  • Save chriscorwin/890b6ac4cf0cd26b406406ff866f666d to your computer and use it in GitHub Desktop.
Save chriscorwin/890b6ac4cf0cd26b406406ff866f666d to your computer and use it in GitHub Desktop.
MHALL
// Navigate to http://onlinetonegenerator.com/dtmf.html
// Open DevTools - Console
// Paste the Code
// Press Enter
// Provide the number of milliseconds the default tone should hold for
let short = 250;
let long = short * 2;
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
let release = async function(duration){
await sleep(duration);
stop();
}
let three = async function(duration = short) {
dialTone(697.0, 1477.0);
await release(duration);
}
let two = async function(duration = short) {
dialTone(697.0, 1336.0);
await release(duration);
}
let one = async function(duration = short) {
dialTone(697.0, 1209.0);
await release(duration);
}
let nine = async function(duration = short) {
dialTone(852.0, 1477.0);
await release(duration);
}
async function play() {
await three();
await two();
await one();
await two();
await three();
await three();
await three(long);
await two();
await two();
await two(long);
await nine();
await nine();
await nine(long);
await three();
await two();
await one();
await two();
await three();
await three();
await three();
await three();
await two();
await two();
await three();
await two();
await one();
}
play();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment