I am developing a music app where I would like to playback notes on a staff. I would rather not keep a bunch of prerecorded .wav assets for notes with different lengths since I would also like variable beats per minute. (a half note at 80 bpm is held out longer than a half note at 120 bpm).
It seems like most apps use MIDI to solve this problem, but Unity does not support midi and of the plugins I have found UnitySynth has really bad performance on Android and MIDI Unified is pretty expensive for an indie developer.
I have found this article on procedural audio generation using OnAudioFilterRead
. This method would be great, but the sound that it generates sounds like a telephone dial tone. My resulting sound doesn't have to sound like a piano, but does anyone know how I could make this sound a little more pleasant?
What I need is something similar to MIDI, where I have a "NoteOn" and "NoteOff" interface where I can play a certain pitch for X seconds. Is this possible in Unity without using one of the above methods?