测试已测试 | ✗ |
Lang语言 | SwiftSwift |
许可 | MIT |
发布最新发布 | 2018年1月 |
SwiftSwift版本 | 3.0 |
SPM支持SPM | ✗ |
由Cem Olcay、Aurelius Prochazka维护。
依赖 | |
AudioKit | >= 0 |
MusicTheorySwift | >= 0 |
MIDI Sequencer,向其他应用程序发送MIDI事件。
基于iOS和macOS的AudioKit的AKSequencer
构建。
只需专注于音符,即可创建智能MIDI旋律乐器。
pod 'MIDISequencer'
MIDISequencer在AudioKit
的AKSequencer
上构建,并使用MusicTheory
库创建专注于音符的序列,支持多轨道。
MIDISequencer
实例。let sequencer = MIDISequencer(name: "Awesome Sequencer")
MIDISequencerTrack
并将其添加到序列器的轨道中。let track = MIDISequencerTrack(
name: "Track 1",
midiChannel: 1)
sequencer.tracks.append(track)
sequencer.tempo = Tempo(
timeSignature: TimeSignature(
beats: 4,
noteValue: .quarter),
bpm: 80)
MIDISequencerStep
添加到轨道的steps
中track.steps = [
MIDISequencerStep(
note: Note(type: .c, octave: 4),
noteValue: NoteValue(type: .quarter),
velocity: .standard(100)),
MIDISequencerStep(
note: Note(type: .d, octave: 4),
noteValue: NoteValue(type: .quarter),
velocity: .standard(100)),
MIDISequencerStep(
note: Note(type: .e, octave: 4),
noteValue: NoteValue(type: .quarter),
velocity: .standard(100)),
MIDISequencerStep(
note: Note(type: .f, octave: 4),
noteValue: NoteValue(type: .quarter),
velocity: .standard(100)),
]
sequencer.addTrack(track: track1)
MIDISequencerStep(
chord: Chord(type: .maj, key: .c),
octave: 4,
noteValue: NoteValue(type: .quarter),
velocity: .standard(60))
MIDISequencerStep(
notes: [Note(type: .c, octave: 4), Note(type: .d, octave: 4)],
octave: 4,
noteValue: NoteValue(type: .quarter),
velocity: .standard(60))
MIDISequencerStep(
notes: Chord(type: .maj, key: .c).notes(octave: 4) + [Note(type: .c, octave: 4), Note(type: .d, octave: 4)],
noteValue: NoteValue(type: .quarter),
velocity: .standard(60))
MIDISequencerArpeggiator
将和弦、任何八度范围内的音阶中的任何音符创建成琶音步骤。let arpeggiator = MIDISequencerArpeggiator(
scale: Scale(type: .blues, key: .a),
arpeggio: .random,
octaves: [4, 5])
let melody = MIDISequencerTrack(
name: "Melody",
midiChannel: 3,
steps: arpeggiator.steps(noteValue: NoteValue(type: .quarter), velocity: .random(min: 80, max: 120)))
sequencer.addTrack(track: melody)
将isMuted
属性设置为true
以静音任何MIDISequencerStep
。
调用play()
或playAsync()
中的一个函数来播放序列。
state = .loading
sequancer.playAsync(completion: {
self.state = .playing
})
stop()
停止播放。sequencer.stop()
查看完整文档
在我的应用程序ChordBud中使用此库,查看它!