Enhancing the virtual keyboard

Our Keyboard script allows us to play an audio source like an instrument. In order to demonstrate a couple of other scripting concepts with audio sources, let's add a couple of features to our script by following the following exercise:

  1. The first set of features that we will add is the ability to record a session and then play the audio back. This may sound like an incredibly complex task, but it is something we can accomplish with just a few more lines of code.
  2. Open back up MonoDevelop or your favorite script editor and add the following lines just after the declaration of the transpose variable, as shown here:
public int transpose = 0; //after this line private List<int> notes = new List<int>(); private ...

Get Game Audio Development with Unity 5.X now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.