Tutorial: Design of tunes
For the two classes of construct (iteration and selection) there are four basic points of interest (POI) that require auralisation:
CAITLIN uses a major scale chord to represent the Boolean value True and a minor scale chord to represent the Boolean value False.
As all constructs may have large bodies (many, or time consuming statements inside them) then they may last for long periods of time. Therefore, to each construct has been added a background note (called a drone, as on the bagpipes) which plays continuously as long as the program is executing that construct. If several constructs are nested inside each other (e.g, a FOR loop within an IF…THEN…ELSE) then one drone for each construct will be heard.
A selection (e.g. IF…THEN) poses a question and then answers it. This is represented by a rising scale signifying entry to the selection construct (which when played sounds like a question being asked-just as we upwardly raise our voices when asking questions) and a descending scale denoting exit (showing that the question has been answered).
We need to know when the loop returns to its starting point (that is, when it iterates) and when its controlling condition is tested. For the REPEAT and WHILE loops a simple major/minor chord is used when the loop condition is tested; this would be heard immediately after entry to the WHILE loop, but after the iterated statements of the REPEAT loop. Each time one of these chord devices is heard we know that the loop has reached its decision point. The null WHILE loop (where the controlling condition is False upon entry) would thus be heard as a sequence of: entry tune followed by minor chord for condition evaluation followed by the exit tune.
The FOR loops use a counter which takes incremental steps from a starting value to an end value. To denote this stepping up (or down) of the counter the pitch of the drone (background note) in the FOR loop is changed up to the next note of the scale (or down for the FOR…DOWNTO) for each repetition.
This idea of variations on a theme ensures that all selections sound like each other but can be distinguished by their individual mutations of the class motif.
To help distinguish at the outset whether an auralisation represents an iteration or a selection we have used a device which we call auditory parentheses. Just as parentheses in writing serve to bracket in a sentence a related thought which is not part of the main text (for instance, here is an example), auditory parentheses provide sounds at the beginning and ending of constructs which serve to open and close the construct. For instance, we could transcribe a telephone conversation between Rosie and Jim by enclosing all of Rosie's words in round brackets and all of Jim's in square brackets. The different shaped brackets would identify who was speaking and where their speech began and ended. For example…
Rosie dials Jim's number. Telephone rings three times and is answered. [Hello?] (Hello Jim, it's me, Rosie.) [Oh, hi Rosie, it's nice to hear from you]. 3-second pause. (Sorry for the silence, I was yawning. Well, goodbye.) [Good bye.] Rosie replaces the handset.
In the same way, we have used a pair of sounds to mark the opening and closing of a selection construct and another pair of sounds to mark out iterations.
Currently only the constructs have associated signature tunes. All other statements (e.g. assignments, procedure calls etc.) are represented simply by a single percussive sound. There is one 'hit' per statement and all non-construct statements are sounded at the rate of one-per-beat.