Beep syntax

Any phrases enclosed in square brackets [] will be interpreted as 'beep syntax', a small language to play sounds and melodies. Beep syntax can be embeded directly into the prompt, in combination with spoken text. Example:

To practice, a bot in our Discord channel will respond to !beep commands to generate an audio file.

You can also download the C source code beep.c and compile with

gcc beep.c -lm

Examples:

Twinkle Twinkle
: indicates duration. c:2 means two beats.
c3 means c in 3rd octave (~130hz)
c4 is middle c (~261 hz)
g4:2 means g in 4th octave held for 2 beats
[c4 c g g a5 a g4:2 f f e e d d c:2]
# for sharp, & for flat. c#4 is c sharp right above middle c.
Can also use numbers to indicate frequency in Hertz.
[c c# d e& e:3 440:3  100 200 300 400 500 600 700 800 900 1000 1100]
Nested bracket structure for durations. Every item within bracket has equal duration. Total length of the bracket is 1, can be adjusted with :x notation. (c e g):0.5 is a triplet over 0.5 second duration
(c e g a):0.5 is four notes over 0.5 second duration
(c e (g a) (b c)):0.5 is quarter, quarter, eigth, eigth, eigth, eigth all over a 0.5 duration.
[ (c (d e) f (g a) c):2 ((c e g) (g e c)):1 c ]
Brackets can be repeated. (c d e f):0.5*4 plays 'c d e f' four times in succession, each iteration is 0.5 seconds duration, for a total duration of 2 seconds.
[ (c d e f):0.5*4 ]