The riff as a function: each fretted note is answered by the open B string, the two opening figures play twice, and the descent runs six times. It plays the same notes as the notes page, tone for tone.
1# Thunderstruck - Angus Young and Malcolm Young (AC/DC, The Razors Edge, 1990) - https://lab.glossema.dev/play/thunderstruck/code2# It plays the notes of https://lab.glossema.dev/play/thunderstruck, tone for tone.3# The guitar riff that opens the record, one octave above the recording, at 112 ms a sixteenth.4# One guitar, one note at a time: a fretted line on the B string, and the open B string5# between every two of its notes, so that one line is heard as two voices.6# The two opening figures play twice, two bars each; then the descent, one phrase of two bars, six times.7# The last B is held as the arrangement's ending, where the record's riff runs on.89{10# Hz for each pitch: the riff one octave above the record, and the low B of the ending11:localpitch{"B3"=247;"B4"=494;"D#5"=622;"E5"=659;"F#5"=740;"G5"=784;"G#5"=831;"A5"=880;"B5"=988}1213# The riff: each fretted note fills its sixteenth, and the open B answers it, cut short.14# A bar holds eight fretted notes; a figure repeats until its bars are full.15:localriffdo={16:forpassfrom=1 to=((8 *$bars)/[:len$notes])do={17:foreachnotein=$notesdo={18:beepfrequency=($pitch->$note)length=107ms19:delay 112ms20:beepfrequency=($pitch->"B4")length=85ms21:delay 112ms22 }23 }24 }2526# The fretted notes of each part: G natural in the E and G figure, G sharp in the descent27:localopenDF{"D#5";"F#5"}28:localopenEG{"E5";"G5"}29:localdescent{"B5";"A5";"G#5";"A5";"G#5";"F#5";"G#5";"E5";"F#5";"D#5";"E5";"D#5";"E5";"D#5";"E5";"D#5"}3031:put"Intro"32# The pickup: the open B alone33:beepfrequency=($pitch->"B4")length=85ms34:delay 112ms35# D sharp and F sharp for two bars, E and G for two, all four bars twice36:forpassfrom=1 to=2 do={37 $riff notes=$openDF bars=2 pitch=$pitch38 $riff notes=$openEG bars=2 pitch=$pitch39 }4041:put"The descent"42# One phrase of two bars, from the top B down to D sharp, six times43:forpassfrom=1 to=6 do={44 $riff notes=$descent bars=2 pitch=$pitch45 }4647# The arrival: a bass B, then the top B that would open a seventh descent, held48:beepfrequency=($pitch->"B3")length=30ms49:delay 35ms50:beepfrequency=($pitch->"B5")length=1500ms51:delay 1500ms52}
One command sounds one tone: :beep frequency=<hertz> length=<time>; the beeper plays one note at a time.
:delay is the clock. A beep starts the tone and returns at once, so every note is a beep followed by a delay of the same length and a small gap.
Most tunes here are written out note by note, a beep and a delay each; some also come as code, with loops, tables and functions, that plays the very same notes. Download any of these and run it in a terminal.