1 Reply
      Latest reply on Dec 2, 2019 8:51 PM by sjmills
      sjmills Level 1 Level 1 (0 points)

        I've managed to get an engine set up to play a sine wave at a given frequency and amplitude. Now I need to play a sequence of notes using that tone. The sequence will always be the same, so I could read it from a midi file. I found sound sample code to load and play a midi file, but it's not working. When I call the AVAudioSequencer's prepareToPlay method, it throws an exception, saying there's no AU connected to the track. I can't figure out how to make that connection.

         

        Perhaps the midi file won't work for this. I quickly tapped some notes into a track in GarageBand, saved it as a loop, then converted the loop to midi with a tool a found online.

         

        Any hints or good sample code for doing this? Is there a not-too-complicated way to punch in the midi events programatically instead of loading it from midi?