arielelkin/Sequencer

语言: Objective-C

git: https://github.com/arielelkin/Sequencer

示例使用The Amazing Audio Engine的音序器插件
Example use of the sequencer plugin for The Amazing Audio Engine
README.md (中文)

示例使用The Amazing Audio Engine的音序器插件。

有关Swift实现,请参阅SwiftySequencer。

使用

克隆此存储库,将pod“TheAmazingAudioEngine”添加到您的pod文件或手动添加The Amazing Audio Engine。

在这个例子中,我们将每季度音符发出声音:

//Add an audio file to your Xcode project and get its `NSURL` :
NSURL *woodblockSoundURL = [[NSBundle mainBundle] URLForResource:@"woodblock" withExtension:@"caf"];

//Next, specify when the sound should play in relation to the whole sequence, 
//by adding instances of AESequencerBeat to your AESequencerChannelSequence. 
//The onset property of an AESequencerBeat should be between 0  and 1. 
AESequencerChannelSequence *woodblockSoundSequence = [AESequencerChannelSequence new];
[woodblockSoundSequence addBeat:[AESequencerBeat beatWithOnset:0]];
[woodblockSoundSequence addBeat:[AESequencerBeat beatWithOnset:0.25]];
[woodblockSoundSequence addBeat:[AESequencerBeat beatWithOnset:0.50]];
[woodblockSoundSequence addBeat:[AESequencerBeat beatWithOnset:0.75]];

//Then, create a AESequencerChannel that will play the sequence:
woodBlockSoundChannel = [AESequencerChannel sequencerChannelWithAudioFileAt:woodblockSoundURL
                                                            audioController:audioController
                                                               withSequence:woodblockSoundSequence
                                                numberOfFullBeatsPerMeasure:4
                                                                      atBPM:120];

//Add the channel to the `AEAudioController`:
[audioController addChannels:@[woodBlockSoundChannel]];

//Tell it to start playing:
woodBlockSoundChannel.sequenceIsPlaying = true;

快乐的排序!

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

Sequencer

Example use of the sequencer plugin for The Amazing Audio Engine.

See SwiftySequencer for a Swift implementation.

Use

Clone this repository, add pod 'TheAmazingAudioEngine' to your pod file or manually add The Amazing Audio Engine.

In this example we will play a sound every quarter note:

//Add an audio file to your Xcode project and get its `NSURL` :
NSURL *woodblockSoundURL = [[NSBundle mainBundle] URLForResource:@"woodblock" withExtension:@"caf"];

//Next, specify when the sound should play in relation to the whole sequence, 
//by adding instances of AESequencerBeat to your AESequencerChannelSequence. 
//The onset property of an AESequencerBeat should be between 0  and 1. 
AESequencerChannelSequence *woodblockSoundSequence = [AESequencerChannelSequence new];
[woodblockSoundSequence addBeat:[AESequencerBeat beatWithOnset:0]];
[woodblockSoundSequence addBeat:[AESequencerBeat beatWithOnset:0.25]];
[woodblockSoundSequence addBeat:[AESequencerBeat beatWithOnset:0.50]];
[woodblockSoundSequence addBeat:[AESequencerBeat beatWithOnset:0.75]];

//Then, create a AESequencerChannel that will play the sequence:
woodBlockSoundChannel = [AESequencerChannel sequencerChannelWithAudioFileAt:woodblockSoundURL
                                                            audioController:audioController
                                                               withSequence:woodblockSoundSequence
                                                numberOfFullBeatsPerMeasure:4
                                                                      atBPM:120];

//Add the channel to the `AEAudioController`:
[audioController addChannels:@[woodBlockSoundChannel]];

//Tell it to start playing:
woodBlockSoundChannel.sequenceIsPlaying = true;

Happy sequencing!