Guitar Hero Checklist

Introduction

To learn how to write ring buffer code, how to write Kotlin classes, and to learn about digital audio.

GuitarString

The assignment specification does not specify, so you are free to choose whichever convention you find most convenient. You may include the starting point but exclude the ending point of an interval. For example, s.substring(i,j) returns the substring of the string s beginning at index i and ending at index j-1 inclusive. Or you may include both endpoints of an interval. For example, s.substring(i..j) returns the substring of the string s beginning at index i and ending at index j inclusive.

Use Float.roundToInt() from kotlin.math.

Make sure the init block of your GuitarString code contains the line

   out.addSignal(this)

This line connects the signals of the GuitarString object to Minim’s lineout.

GuitarHero

Be sure that the graphic drawing window has focus by clicking in it. Then, type the keystrokes.

If keyboard is a String and key is a character, then keyboard.indexOf(key) returns the integer index of the first occurrence of the character key in the string keyboard, or –1 if it does not occur. You can read about it in the Java String documentation page

As usual, we may deduct style points for using an unnamed constant, especially if you use it more than once. We recommend using the name out.sampleRate() for 44,100 and CONCERT_A for 440.0 and the expression keyboard.length for 37. However, you do not need to name all of the constants in the formula 2 (i − 24) / 12.

Optional: Enrichment

Here are some concrete ideas for synthesizing other instruments. Some come from the paper of Karplus and Strong.

Here is some cool stuff that is closely related.