Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Remilia Scarlet

Members
  • Content count

    5070
  • Joined

  • Last visited

About Remilia Scarlet

Recent Profile Visitors

150071 profile views

Single Status Update

See all updates by Remilia Scarlet

  1. Aww yeah, fixed the cubic interpolation bug... by removing it from the oscillator.

    Instead, there's now proper oversampling in CL-MeltySynth/Haematite and midi123.  From 1x (none, the default) to 32x (lol).  The oversampling uses Hermite interpolation to generate the new samples that get placed between the original ones.  I'll add more options for other methods soon.  Yay for finding out about the "Elephant Paper".

     

    There is a downside, though: oversampling takes place when the SoundFont data is loaded.  Since the entire SoundFont is loaded into RAM, that means the entirety of the oversampled data gets stored in RAM.  So the sc-55.sf2 that I always use (I dunno which SC-55 SoundFont it even is anymore, except that it's not trevor0402's) has about 103mb of PCM data at 44.1KHz.  Without oversampling (aka, 1x), this is stored as 103mb in RAM.  Oversampling 2x means that 207mb of PCM resides in RAM.  4x means 412mb is used.  32x... yeah.

    So oversampling is basically a new performance knob you can tweak, where you balance memory usage vs quality.

    But that's not all... SoundFonts usually use 16-bit signed integer for a sample format (and some use 24-bit I think, but I don't support them yet).  You can also tell the library how you want to store the oversampled data, with options for Int16 (original), Float32, and Float64 (which is what it gets converted to during synthesis anyway).  The interpolation functions all spit out 64-bit floating point samples, so converting those back to int16 (the default) incurs a very slight accuracy penalty.  Using one of the two float formats uses more RAM, however.  Without oversampling (aka, 1x) and using float64, my 103mb SC-55 soundfont is stored as 412mb in RAM.  Oversampling 2x means that 824mb of PCM resides in RAM.  4x means 1648mb is used.  32x oversampling + float64 is about 12.9GB.

    Of course, 32x + float64 is just absurd and not practical unless you want to show off :-P  I don't see anything over 4x being useful, but I'll leave them in there because large numbers can be fun.

    Sometime in the future I plan to still implement an option to load only the samples that are actually needed into RAM, but that's a long ways off, because that'll require a lot of planning and restructuring.  That would, however, let you do 32x + float64 without needing a ton of RAM.

    This is effectively another new performance knob you can tweak.  I'm thinking actual end-user programs would just hide these two performance settings behind a generic "quality" setting, where quality 1 means 1x and Int16, while quality 20 (or whatever) would be 32x and Float64.

    The good news?  Almost no CPU impact during playback unless you turn oversampling up over 4x, and then it still isn't that big of a hit.  Loading the SoundFont is a bit slower each time you go up in oversampling, but not by much, and that only has to happen once.

    Anyway, the defaults of 1x and int16 storage, which is just like the original behavior.

     

    https://files.catbox.moe/crf60b.mp4

     

    1. Sectorslayer

      Sectorslayer

      As a web services backend person I have no idea what you're writing about. But as a programmer I love every word.

×