Author Topic: soundfont questions  (Read 10 times)


  • Posts: 1
soundfont questions
« on: 19 Mar '18 - 02:50 »
Hi, new member here looking for some insights on creating soundfonts and using them on-the-fly.

I need to write a program that, from a distance, looks like it could be implemented as a MIDI app using a custom soundfont file. The thing is, each time it runs, it needs to generate a new soundfont file and then use it.

Here's an analogy: Imagine a library with 1000s of sound samples. Each time this program is run, it grabs 100 of them somewhat randomly, downloads them, and builds the soundfont file from that collection. When it's done, it doesn't need to preserve the foundfont file or the samples, and they're deleted. This is by design.

What needs to be done is to gather these samples as they're downloaded and stuff them into a soundfont file, mapping them to separate MIDI controller notes. (They're not musical, they're more similar to percussion hits, like sticks, bells, gongs, etc.) This needs to be done by software, not a visual app. The program will be doing the playing later, not someone at a keyboard, so the mappings are irrelevant as long as they work.

Then the program will "compose" several tracks by creating a MIDI score where these samples are played in some order. Actually, there will be several of these, like "scenes", that need to be composed separately, and then played in sequence.

All of this is happening while a pre-recorded audio file is playing for a few minutes. When it finishes, I need to start playing this MIDI score.

The intended result is that the user is listening to it all in real-time, rather than recording it to disk for posterity; however, if it makes more sense to save an audio rendering to disk and THEN playing that, I'm open to that approach as well. (Any opinions as to which approach is better are quite welcome.)

I have a general understanding of MIDI, and what I know is that most notes are short but can be extended by holding down the keys or a sustain pedal.

But if you create your own soundfont, can you create "notes" that go on for several seconds naturally, that play with a simple trigger and ignore sustain?

I'm thinking of something like, say, a gong strike or Tibetan bowl that you want to play until it's pretty much inaudible. No sound efx, no modulators, no sustain, no nothing. Just a really long "note" that has its own natural decay curve that can last for 20-30 seconds or more. Does it work to put sounds like this into a soundfont and trigger them to play? If so, if you add another note after that in the MIDI sequence, will it begin playing when the long one before it finally stops?

(I imagine that if they're in separate tracks, then they can overlap, right? So a long gong or bowl could have a flute, drums, rattles, or other bowls in another track that play over it, no?)

If I'm making sense and this seems doable, does anybody know of any Delphi code I could get hold of to read and write soundfont (.sf2) files, and something that would let me build simple compositions to test them out (programmatically, not using a keyboard of any kind)? 

I'm prototyping this in Windows, but it ultimately needs to work in iOS and Android as well.