Skip to content

Instantly share code, notes, and snippets.

@zapplebee
Created November 5, 2020 02:52
Show Gist options
  • Save zapplebee/0af00e6cc88682d128fcc768d5368354 to your computer and use it in GitHub Desktop.
Save zapplebee/0af00e6cc88682d128fcc768d5368354 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
const child_process = require("child_process");
const NOTES = {
A: 440.0,
As: 466.1638,
Bf: 466.1638,
B: 493.8833,
C: 523.2511,
Cs: 554.3653,
Df: 554.3653,
D: 587.3295,
Ds: 622.254,
Ef: 622.254,
E: 659.2551,
F: 698.4565,
Fs: 739.9888,
Gf: 739.9888,
G: 783.9909,
Gs: 830.6094,
Af: 830.6094,
};
function chime(freq, duration) {
child_process.execSync(
`ffplay -f lavfi -i "sine=frequency=${freq}:duration=${duration}" -autoexit -nodisp -loglevel quiet`
);
}
function play() {
chime(NOTES.C, 0.1);
chime(NOTES.A, 0.1);
chime(NOTES.D, 0.1);
}
play()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment