Play musical notes in Swift Playground : <p>I am trying to play a short musical note sequence with a default sine wave as sound inside a Swift Playground. At a later point I'd like to replace the sound with a <em>Soundfont</em> but at the moment I'd be happy with just producing some sound. </p>

<p>I want this to be a midi like sequence with direct control over the notes, not something purely audio based. The <code>AudioToolbox</code> seems to provide what I am looking for but I have troubles fully understanding its usage. Here's what I am currently trying</p>

<pre><code>import AudioToolbox

// Creating the sequence    

var sequence:MusicSequence = nil
var musicSequence = NewMusicSequence(&amp;sequence)

// Creating a track

var track:MusicTrack = nil
var musicTrack = MusicSequenceNewTrack(sequence, &amp;track)

// Adding notes

var time = MusicTimeStamp(1.0)
for index:UInt8 in 60...72 {
    var note = MIDINoteMessage(channel: 0,
                               note: index,
                               velocity: 64,
                               releaseVelocity: 0,
                               duration: 1.0 )
    musicTrack = MusicTrackNewMIDINoteEvent(track, time, &amp;note)
    time += 1
}

// Creating a player    

var musicPlayer:MusicPlayer = nil
var player = NewMusicPlayer(&amp;musicPlayer)

player = MusicPlayerSetSequence(musicPlayer, sequence)
player = MusicPlayerStart(musicPlayer)
</code></pre>

<p>As you can imagine, there's no sound playing. I appreciate any ideas on how to have that sound sequence playing aloud.</p>
