Custom Instruments and Soundfonts

Discussion in 'Gear and Items' started by Spooky, Dec 14, 2013.

  1. Spooky

    Spooky Scruffy Nerf-Herder

    Not sure how exactly the instruments work but I had an idea. Why not let us use midi soundfonts (.sf2) to make custom instruments.
     
  2. ChristBorn

    ChristBorn Big Damn Hero

    I'm guessing because what they're using isn't a normal SF2 to start with. If you find a microphone, listen to it. It's way different than any midi instrument I've ever heard. Though I agree that custom instruments are a thing that needs to happen, and will via modding.
     
  3. Prowin

    Prowin Void-Bound Voyager

    Actually, the way they've implemented the musical instruments isn't too dissimilar to soundfonts. If you go to Starbound/assest/sfx/instruments you can look at all the audio files.
    Each instrument (other than the microphones) uses 8 .ogg audio files, labeled a0 to a7 (an 8 octave range). The game then pitch bends each of those 'A' notes up or down to the pitch that you're trying to play.
    Microphones are arranged the same way, except that there are 10 vocalizations for each note (I assume the game picks them randomly).

    There is also a tuning.config file for each instrument, which looks like it maps each of the audio files to a midi note number (-20), a keyboard input (maybe?) and a frequency (which I assume is how it pitches notes accurately). It looks like the tuning file theoretically supports fully sampled instruments, if you were to map an audio file for every note, however it would almost certainly cause lag issues.

    Creating a custom instrument is as "simple" as either replacing the games audio files, or creating a new instrument that follows the same syntax.
     
  4. Prowin

    Prowin Void-Bound Voyager

    It also looks like the drum kit 'might' be using standard General MIDI drum mapping. I'll have to test it further to confirm.
     
  5. ChristBorn

    ChristBorn Big Damn Hero

    Sounds like custom instruments are already pretty easy. It further sounds like an SF2 file would just make things MORE complicated for people trying to make, say, a fart tuba, baby t-rex xylophone, barking dog sax, or a laughing baby oboe. Just thinking of the modders here.
     
  6. Vahkiti

    Vahkiti Poptop Tamer

    Did you ever find out if this was indeed the case? I ask because it seems that when I import songs with drums, the mapping is way off, therefor, making an actual soundfont out of the Starboud samples might be beneficial in altering the music to fit the game before import.
     
  7. Prowin

    Prowin Void-Bound Voyager

    Some IRL stuff got in the way of further testing (as well as the last character wipe). But I just did a quick listen, and it 'sounds' like everything is in the correct order. In fact, if you listen to the individual samples in assets/sfx/instruments/drumkit the labels of each file directly corresponds to the correct General Midi notes (using the General Midi Level 2 mapping).

    However within the tuning.config file for the drumkit is this worrying comment:
    //basic piano key index (+20)
    Which I assume means that the midi numbers listed for each sound file are increased by 20, making the lowest note in the file 41, and the highest 128, instead of 21-108.
    So if it isn't working properly with regular drums, you could try transposing the score up by 20 semi-tones.
    IRL stuff is preventing me from testing it myself at the moment, so let me know how it goes.
     

Share This Page