Maximilian
Maximilian

Reputation: 1117

Audiokit: (V5) Sequencer cannot play notes simultaneously at the same position in a track

I have used Audiokit's both AKAppleSequencer and AKSequencer for 2 years now. This is my first iteration getting used to the new V5 version of the library. For whatever reason, I cannot get more than a single note to play simultaneously.

Below is a very simple example of what I am trying to do:

public func setupSequencerForInterval(note1: MIDINoteNumber, note2: MIDINoteNumber) {

        sequencer.clear()
        sequencer = Sequencer(targetNode: sampler)
        sequencer.tempo = 120
        sequencer.loopEnabled = false
        sequencer.length = 12.0

        sequencer.add(noteNumber: note1, velocity: 127, channel: 1, position: 0.0, duration: 4.0, trackIndex: 0)
        sequencer.add(noteNumber: note2, velocity: 127, channel: 1, position: 4.0, duration: 4.0, trackIndex: 0)
        sequencer.add(noteNumber: note1, velocity: 127, channel: 1, position: 8.0, duration: 4.0, trackIndex: 0)
        sequencer.add(noteNumber: note2, velocity: 127, channel: 1, position: 8.0, duration: 4.0, trackIndex: 0)

    }

Here is what it sounds like

A sequence of 3 whole notes: 1st whole note on note1, 2nd whole note on note2, 3rd whole note both note1 and note2 playing together.

I have tested my sampler to make sure it was not monophonic, and it can play notes polyphonically.

Stranger yet, if I change the last line of (adding the note 2 whole note at the same position as note 1 at position 8.0) to a position of anything greater than 8.0, the effect of polyphony occurs. You can hear that here, a value of 8.01 was used for position on the last sequencer.add call

Is this intended behavior? Is Sequencer not supposed to play multiple notes at the same position? Any guidance would be greatly appreciated, thank you!

Upvotes: 2

Views: 201

Answers (1)

Maximilian
Maximilian

Reputation: 1117

According to the AudioKit team, this is not intended behavior and is being looked into: https://github.com/AudioKit/AudioKit/issues/2409

Upvotes: 1

Related Questions