Skip to content

zsaraf/SoundGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

SoundGen

Easy to use interface for playing midi notes using Sound Font (extension sf2) in iOS.

To use:

Make sure you have added the AudioToolbox.framework to your project.

  1. Pick a sf2 (soundfont 2.0) file that you like from online and add it into your project. Make sure that you add it to the bundle resources in Build Phases -> Copy Bundle Resources.

  2. Then make an NSURL from the file and initialize the SoundGen class with it and a patch number:

NSURL *presetURL = [[NSURL alloc] initFileURLWithPath:[[NSBundle mainBundle] 
                                      pathForResource:@"SoundFontFile" ofType:@"sf2"]];
SoundGen *soundGen = [[SoundGen alloc] initWithSoundFontURL:presetURL patchNumber:5];

After this you can always reset your patch number or soundfont URL with:

[soundGen setSoundFontURL:newURL]

or

[soundGen setPatchNumber:patchNumber]

3 . Then to play/stop a midi note:

[soundGen playMidiNote:note velocity:velocity]
[soundGen stopPlayingMidiNote:note]

Cheers. I will try and comment and add sample project in the future!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published