AZSlow3 / FluidSynthVST

VST3 wrapper for FluidSynth
GNU General Public License v3.0
35 stars 1 forks source link

Limited to 96kHz #6

Open AtmanActive opened 4 months ago

AtmanActive commented 4 months ago

Sounds badly pitched at any other sample rate (for example: 192kHz). Obviously hard-coded for 48kHz.

AZSlow3 commented 4 months ago

Do you mean fonts with other sample rates or host sample rate?

In the first case check that current version of FluidSynth works correctly with such font. If it is, I can compile with current version. If not, nothing I can do. This project is just a wrapper.

In the second, please write which DAW you use. I run it with 44.1 and tried with oversampling in REAPER, no problem.

Also note that creating samples with rates over 48kHz make no sense. Higher rates are supported by DAWs for other reasons...

AtmanActive commented 4 months ago

Host sample rate.

I'll investigate and let you know.

I have two windows machines on my desk, both equipped with RME HDSPe AIO and connected via S/PDIF. One machine (workstation) is clocking sample rate at 48kHz, while the other machine (studio) is clocking at 192kHz. RME enables both machines to send/receive audio from each other with 1:4 (or 4:1) sample rate conversion, so to each other, they sound perfect. Both machines are running the latest Reaper x64. When playing on the workstation (48kHz), FluidSynthVST sounds perfect, but, when running on the studio machine (192kHz), it sounds ridiculously high pitched and out of tune. Tested with all the famous General MIDI SF2 files. I believe that most, if not all SF2 files are built with 44.1kHz samples. That's simply the sign of the times they were built in. Nevertheless, they do sound correctly when played back at 48kHz in FluidSynthVST but not when played at 192kHz.

Thanks.

AZSlow3 commented 4 months ago

I will test with Windows + RME + 192kHz at the evening, let see if I can reproduce.

AZSlow3 commented 4 months ago

It really does not work with 192kHz and that comes from FluidSynth. They limit to 96kHz: see https://github.com/FluidSynth/fluidsynth/issues/623

You can patch FluidSynth (replace "96000" in the source) and it will work then.

BTW 44.1kHz is the sign of the time when people was thinking what make sense... Most people are unable to perceive anything above 15kHz. In practice the limit is even lower. 44.1 was set to cover theoretical human's limit. 48 and 96 are useful to match different standard and technically reduce latency. Everything higher is just to compensate logical bugs in digital signal processing (when algorithms are mathematically produce higher frequencies and plug-in author does not account for that). "High-end" people have noticed that distortions inducted by higher frequencies in audible range can be sold as "better sound", with great success in that approach (they even manage to sell "32bit DACs" for phones, even so technically there is no DACs for audio which can meaningfully convert more then 20bits and corresponding chips producers write that in the specification). We all want to believe ;)

AtmanActive commented 4 months ago

Hey!

Thanks for testing!

The problem with judging about these things is that not all people are made the same and that has been scientifically proven many times.

Some people can recognize frequencies up to 10 kHz, others up to 20 kHz, believe it or not there are people that can actually recognize audio frequencies up to 50 kilohertz and these cases have been well documented [0]. And also, you bet, everything in between.

The same goes for eye to brain neural link frame rate where it has been scientifically proven that some people can recognize up to mere 30 frames per second while some athletes can actually recognize up to 100 frames per second [1]. That explains why there are monitors sold today, with, for example, 240 Hz refresh rates.

This debate will go on forever and ever simply because people that can't recognize it are suspicious of the people that can. It makes them feel inferior and nobody likes that feeling.

After all, "640 kilobytes should be enough for everyone", right. :-)

[0] Rupert Neve Interview

[1] Trinity College Dublin

AZSlow3 commented 4 months ago

You have referenced one of examples how they do that :) If with some interview it is possible to sell something to "Hi-End" people (in addition to primary customers), why not?

Most people can notice difference between 70 and 140 Hz picture changes (and many have headache from anything below 70... early CRT monitors with 60 was a nightmare for me, watching videos on notebook and visiting kino are still problematic...), biological limit here is several kHz. 192kHz vs 96kHz in sound is more like comparing 2000Hz monitor update rate with 1000Hz :)

AtmanActive commented 4 months ago

I personally get headaches with anything ABOVE 45 Hz refresh rate. To completely eradicate all motion sickness in modern games, including first person shooters, I have to fine tune the refresh rate and Field of View and luma/chroma to match my brain. And this tuning applies only to me and to my specific situation. Go figure.

For music making, I started with Amiga which was 8-bit and 16 kHz sample rate. Next, Atari Falcon with 16-bit and 44.1 kHz. And then PC with 24-bit and 44.1 kHz. Since day one I struggled with bouncing tracks and rendering them to stems simply because I would always notice that after that process it doesn't sound the same. Only when I finally reached 64-bit/192 kHz, I lost that feeling, and I can now honestly say that no matter how much processing I apply, once it's bounced, the track does sound absolutely the same.

So yes, I agree, the difference between 44 and 192 recording can't be heard straight away but heavy processing in a virtual CPU mixer in a studio environment does benefit a lot from 192 kHz sample rate. It is like moving from a hangar to an open field. A hangar always has a ceiling, while only an open field can give you that open air feeling. That's exactly how I feel about it.

Now, when your studio machine is clocking at 192 kHz, then you simply can't go back and forth changing the sample rate all the time. You need to have it steady so that you can work on a project and to make sure that what you hear is what you get. Many plugins sound different between 48, 96 and 192. In the music creation and mixing process I can't afford that difference, I need to be able to hear the mix consistently with absolutely the same sound each and every time. That's why I need to keep it at 192 at all times. Reaper can resample imported audio at any time. That's not a problem at all. But, unfortunately, Reaper still doesn't have a plug-in under-sampling functionality, only over-sampling functionality, which means that I can't run a plugin at a lower sample rate than the one I'm using. Hence, if I can't run a plug-in at 192 kHz, I have to avoid it.

AZSlow3 commented 4 months ago

Well, as I wrote, it is possible to compile patched for 192kHz FluidSynth and then compile this VST (or CLAP, since REAPER support it and there is such project). Everything is open source.

For the rest. When something is not as expected, it is always good to understand why. Yes, we want to believe we miss over 50kHz frequencies and over 24bit precision. In practice the reasons are (unfortunately... lol) less fascinating.

Fixed point 24bit is bad for intermediate results, it has to be (and fortunately supported since long time) 32bit float (still 24bit precision, but floating). It has 4 bits more then DAC can meaningfully reproduce, so it will take many re-renders till any error will be significant (theoretically audible). 64bit just double required space, filling it with garbage. With fixed point 24bit the situation is different, till final mastering you may have signals far from 0dB and so technically far from 24bit in resolution. But all that is still from "we want to be able to" chapter. At least there is a theoretical possibility (which is easy to prove in synthetic practical test) for "fidelity degradation".

Way more simple to hit, easy to reproduce and possible to audition with $1 equipment is a different problem. You need to check that at no time high frequency is generated or enter something which is unable to work with it, the result is extreme in the digital world but quite significant in analog as well. Especially over 44.1kHz, there must be LPF which you can trust, tuned for the highest frequency the equipment support. Yes, good monitors normally have it, but better use something explicit (and check it works). Note that you can't trust your ears in this case, they are unable to spot the problem. Failing that, the result is not always "digital distortion" but can be a kind of saturation, and we are trained to like the effect. Up to the level when it is "gone" (rendered with LPF) we fill the sound is worse. Note that everything over 20kHz is in 99.9% of cases just bugs, unfortunately many plug-ins (including famous) do that.

And finally even more simple reason... From "I have rendered a track and it sounds different/worse" threads. Rendering can use (and by default use) different from playing processing. That is why in all DAWs there is an option to render "as by playing". In the same category are other rendering options which people oversee (most DAWs have different settings for recording and rendering, also explicit rendering normally show the options while glue/freeze do not). The effect can vary by sample rate and the buffer size, coincidentally convincing "if I render with 1MHz sample rate, the result sounds better".