Close

Music Syntax and Guide

A project log for 2018 Hackaday Superconference Badge

Based on the Hackaday Conference in Belgrade, this badge will be a stand-alone, battery powered vintage computer packed with features

Mike SzczysMike Szczys 10/16/2018 at 16:210 Comments

This badge has a built-in speaker and you can compose music for 3 voices using a simple scripting language. Use the BASIC interpreter to access these features with the syntax: 

tune voice1,voice2,voice3,duration

Duration is the number of milliseconds this chord should be held. The voice values use Scientific Pitch Notation (https://hac.io/hGf7) where middle C is 60. Do a C major chord held for 1 second would look like this tune 60,64,67,1000 -- below is a cheat sheet.

PRO TIP: Remember BASIC programs can be saved in any of 16 slots (0..15) using the save/load commands.

As an example, try typing this into your BASIC interpreter (you may want to type memclr before you start, to clear any existing code):

10 tune 0,0,72,131
20 tune 0,0,74,131
30 tune 0,0,77,131
40 tune 0,0,74,131
50 tune 70,74,81,262
60 tune 0,0,0,131
70 tune 70,74,81,393
80 tune 60,76,79,524
90 tune 0,0,0,131
100 tune 0,0,72,131
110 tune 0,0,74,131
120 tune 0,0,77,131
130 tune 0,0,74,131
140 tune 69,72,79,262
150 tune 0,0,0,131
160 tune 69,72,79,393
170 tune 62,69,77,393
180 tune 62,69,76,131
190 tune 62,69,74,655

Discussions