TestsTested | ✗ |
LangLanguage | Objective C++Objective C++ |
License | BSD 3.0 |
ReleasedLast Release | Jun 2016 |
Maintained by Hirohito Kato.
Audio synthesizer & sequencer engine for iOS. It enables you to create a rhythmbox/drum-machine app easily.
import HKLSynthesizer
(if you use Objective-C, import AudioEngineIF.h)let engine_ = AudioEngineIF()
start()
starts synthesizerstop()
stops runningtempo
property sets its bpmnumSteps
property decides the total steps of sequencersounds
property sets the sound file for each track.setStepSequence()
sets a note on/off sequence for the specified track.setAmpGain()
sets an amp gain for the specified track.setPanPosition()
sets a panning position for the specified track.The class API is as follows:
@protocol AudioEngineIFProtocol;
@interface AudioEngineIF : NSObject
/**
* bpm
*/
@property (nonatomic, assign) double tempo;
/**
* number of steps in a track
*/
@property (nonatomic, assign) NSInteger numSteps;
/**
* Sound files. The number of sounds must be equal to the number of tracks
*/
@property (nonatomic, copy) NSArray<NSString*>* _Nullable sounds;
/**
* Set sequence for the specified track.
*
* The sequence contains NSNumber<bool> values. The size must be equal to numSteps property.
*
* @param sequence array of bool values. true means note on.
* @param trackNo track number
*/
- (void)setStepSequence:(NSArray<NSNumber *>* _Nonnull)sequence ofTrack:(NSInteger)trackNo;
/**
* Set amplifier gain(0.0-2.0) for the specified track
*
* @param ampGain 0.0(mute)…1.0(original)…2.0(x2.0)
* @param trackNo track number
*/
- (void)setAmpGain:(double)ampGain ofTrack:(NSInteger)trackNo;
/**
* Set pan position(-1.0…1.0) for the specified track.
*
* @param position -1.0(left)…0.0(center)…1.0(right)
* @param trackNo track number
*/
- (void)setPanPosition:(double)position ofTrack:(NSInteger)trackNo;
/**
* Start a sequencer
*/
- (void)start;
/**
* Stop a sequencer
*/
- (void)stop;
/**
* Delegate object conforms to AudioEngineIFProtocol
*/
@property (nonatomic, weak) id<AudioEngineIFProtocol> delegate;
@end
@protocol AudioEngineIFProtocol <NSObject>
@required
/**
* Tells the delegate that the sequencer has triggered at the step(time)
*
* @param engine the audio engine that the tracks are triggered
* @param tracks tracks that the note is ON
* @param stepNo step number
* @param absoluteTime time for triggered
*/
- (void)audioEngine:(AudioEngineIF * _Nonnull)engine didTriggeredTracks:(NSArray<NSNumber *>* _Nonnull) tracks step:(int)stepNo atTime:(uint64_t)absoluteTime;
@end
The sample shows 4 track & N steps sequencer.
New BSD License
This library uses the sample program of KORG WIST SDK as audio engine.