You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FluidSynth allows changing the sample interpolation method to balance sound quality vs. CPU usage. This is usually done via FluidSynth's console, using the interp x command, where "x" is one of the following options:
x
Type
Description
0
None
No interpolation: Fastest, but questionable audio quality.
1
Linear
Straight-line interpolation: A bit slower, reasonable audio quality.
4
4th Order
Fourth-order interpolation, good quality, the default.
7
7th Order
Seventh-order interpolation.
In theory, 7th order interpolation should provide the best quality of these options. However, while FluidSynth's 7th order interpolation does provide cleaner interpolation of high frequency content, it also can introduce significant harmonic distortion. This is really noticeable on samples of low-pitched instruments such as electric bass. In these cases, 4th order interpolation provides a superior audio quality.
Load the SoundFont into bank 0 or 1 and play the MIDI file using FluidSynth's different interpolation settings. The MIDI file will play four different tests.
Included in the zip file are audio files of the test using FluidSynth's linear, 4th order, and 7th order resampling methods, as well as BASSMIDI set to linear and sinc interpolation (rendered at 48 KHz using FluidSynth Plugin and BassMidi VSTi). These files are time and volume matched so you can easily compare them in an audio editor. I recommend using Audacity with the waveform view set to "spectrogram".
Test 1: Sine Wave Sweep
The first test plays a descending sine wave sweep across most of the audible frequency range. With the ideal interpolation and sample, you should only see a singular, prominant frequency sweeping down. Here is a spectrogram view comparing BASSMIDI and FluidSynth's interpolation methods (the synthesizer and interpolation method are written at the top of each clip):
The linear interpolation renderings look (and sound) almost identical between BASSMIDI and FluidSynth, with FluidSynth being a slight bit noisier. Both feature significant harmonic distortion that can be seen oscillating up and down in an arch-like pattern.
Comparing the next higher quality interpolation (BASSMIDI's "sinc" and FluidSynth's "4th order"), you can see the harmonic distortion is now barely audible, with BASSMIDI's algorithm once again being a bit cleaner.
Now observe FluidSynth's 7th order interpolation, which has the same harmonic distortion as the linear interpolation examples. This should not be happening with what is supposed to be a superior interpolation method.
Test 2: FM Electric Piano
The second test plays high samples of an FM electric piano moving up and down chromatically. With the ideal interpolation, all frequencies of the note should move together up and down with the notes. Here it is in the spectrogram view:
Of these renderings, only BASSMIDI's sinc interpolation is perfectly clean. All of the other renderings feature varying levels of harmonic distortion. Here, FluidSynth's 7th order interpolation is notably cleaner-sounding than 4th order or linear, but is no match for BASSMIDI's sinc interpolation.
Test 3: Electric Bass
The third test plays an ascending scale of electric bass notes. Here is the spectrogram view:
Here, something strange occurs. Both synthesizers' linear, sinc and 4th order examples sound pretty much the same and are free of artifacts. However, FluidSynth's 7th-order interpolation is creating clear high-frequency distortions which can be seen as horizontal lines sustained through most of the bass notes. These distortions create an audible whine in the sound that is not present using any of the other interpolation methods.
Test 4: Low Quality Timpani Sample
This test attempts to see how an interpolation method handles low-bitrate samples. Low quality interpolation methods will result in audible high-frequency aliasing noise. Here is the spectogram:
Both linear results show the high frequency aliasing noise quite clearly, and this can be heard as a grainy, ringing sound. FluidSynth's 4th order interpolation cuts down on this noise quite a bit, but does not completely eliminate it. BASSMIDI's sinc interpolation completely eliminates the aliasing noise. FluidSynth's 7th-order interpolation seems to have cleaned up most of the aliasing noise, but once again features the same type of high frequency "whine" distortion we saw in the electric bass example.
Expected behavior
A high quality sample interpolation should not be producing these harmonic distortions. Unfortunately, this means that FluidSynth is not currently capable of truly high quality sample playback—at least in terms of what is expected out of a sampler used in professional music production. In many examples, the 7th order resampler sounds worse than 4th order and in some cases even worse than linear.
The text was updated successfully, but these errors were encountered:
I touched this code for 2.4.3 and was a bit worried that it's a regression, but doesn't seem so. However, 2.3.7 also shows some of these ringing artifacts for the sine, but they are much more silent and more similar to bassmidi. Can you confirm? Is that the behavior that would please your ears? If so I would need to investigate what had caused this as I have no clue right off. Here're the renderings: sample interpolation test2.zip
However, 2.3.7 also shows some of these ringing artifacts for the sine, but they are much more silent and more similar to bassmidi. Can you confirm?
Your 2.3.7 render appears to have been rendered with 4th order interpolation, not 7th. It matches my 4th order rendering perfectly, with any differences (mainly in the second test) being attributable to the fact that your renders are at 44.1 KHz and mine are at 48 KHz.
Your 2.3.7 render appears to have been rendered with 4th order interpolation, not 7th.
Oh, indeed. I successfully fooled myself. I can now reproduce this behavior even with 2.0.9. This seems to be a problem in the legacy DSP interpolation code. I don't know where though. I went through the sinc code multiple times and the logic looks fine to me...
FluidSynth version
2.4.3
Describe the bug
FluidSynth allows changing the sample interpolation method to balance sound quality vs. CPU usage. This is usually done via FluidSynth's console, using the
interp x
command, where "x" is one of the following options:In theory, 7th order interpolation should provide the best quality of these options. However, while FluidSynth's 7th order interpolation does provide cleaner interpolation of high frequency content, it also can introduce significant harmonic distortion. This is really noticeable on samples of low-pitched instruments such as electric bass. In these cases, 4th order interpolation provides a superior audio quality.
Steps to reproduce
Included in the zip file are audio files of the test using FluidSynth's linear, 4th order, and 7th order resampling methods, as well as BASSMIDI set to linear and sinc interpolation (rendered at 48 KHz using FluidSynth Plugin and BassMidi VSTi). These files are time and volume matched so you can easily compare them in an audio editor. I recommend using Audacity with the waveform view set to "spectrogram".
Test 1: Sine Wave Sweep
The first test plays a descending sine wave sweep across most of the audible frequency range. With the ideal interpolation and sample, you should only see a singular, prominant frequency sweeping down. Here is a spectrogram view comparing BASSMIDI and FluidSynth's interpolation methods (the synthesizer and interpolation method are written at the top of each clip):
![Image](https://private-user-images.githubusercontent.com/6825789/409827204-9a038af2-bf48-491e-ad2d-a2ba532076d4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MzU5NDksIm5iZiI6MTczODkzNTY0OSwicGF0aCI6Ii82ODI1Nzg5LzQwOTgyNzIwNC05YTAzOGFmMi1iZjQ4LTQ5MWUtYWQyZC1hMmJhNTMyMDc2ZDQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMTM0MDQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZGM5OWM3ZGIyN2EwZjYwM2VhYmEyMTI3NmQzMjUyMDNmOWE5OTQ3YjcyZDJiYmE3ZGZkYzhiMWI3ZWI1MGU2NyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.hvY_Uiorv6AsmwiRvjghedIbkLuj29qC24HJl7VOI7I)
The linear interpolation renderings look (and sound) almost identical between BASSMIDI and FluidSynth, with FluidSynth being a slight bit noisier. Both feature significant harmonic distortion that can be seen oscillating up and down in an arch-like pattern.
Comparing the next higher quality interpolation (BASSMIDI's "sinc" and FluidSynth's "4th order"), you can see the harmonic distortion is now barely audible, with BASSMIDI's algorithm once again being a bit cleaner.
Now observe FluidSynth's 7th order interpolation, which has the same harmonic distortion as the linear interpolation examples. This should not be happening with what is supposed to be a superior interpolation method.
Test 2: FM Electric Piano
The second test plays high samples of an FM electric piano moving up and down chromatically. With the ideal interpolation, all frequencies of the note should move together up and down with the notes. Here it is in the spectrogram view:
![Image](https://private-user-images.githubusercontent.com/6825789/409829998-e956cd67-b218-458f-add9-bdad82c9bb4b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MzU5NDksIm5iZiI6MTczODkzNTY0OSwicGF0aCI6Ii82ODI1Nzg5LzQwOTgyOTk5OC1lOTU2Y2Q2Ny1iMjE4LTQ1OGYtYWRkOS1iZGFkODJjOWJiNGIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMTM0MDQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmUxYzQyODUzNzRmMzQyNjc5YmY5ODg5MDkzZWM1YTk1OTIwNzhhM2U3MTJhODRmZGMxMDI0NzQ5MjdlY2JlYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.lCwnGgOH1STYt-7-sQx5R5IkKHG3gCrKESCELdadQA8)
Of these renderings, only BASSMIDI's sinc interpolation is perfectly clean. All of the other renderings feature varying levels of harmonic distortion. Here, FluidSynth's 7th order interpolation is notably cleaner-sounding than 4th order or linear, but is no match for BASSMIDI's sinc interpolation.
Test 3: Electric Bass
The third test plays an ascending scale of electric bass notes. Here is the spectrogram view:
![Image](https://private-user-images.githubusercontent.com/6825789/409831250-3179f4c8-5eaa-42ef-968b-c9f3e014ae8e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MzU5NDksIm5iZiI6MTczODkzNTY0OSwicGF0aCI6Ii82ODI1Nzg5LzQwOTgzMTI1MC0zMTc5ZjRjOC01ZWFhLTQyZWYtOTY4Yi1jOWYzZTAxNGFlOGUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMTM0MDQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTRlMDZmNDI2NGMxYzliYzljZWZhZWRkMjJlOWY5M2FjZjcxODc4ZGIyYjMyYTA0YTc0ZjYxMDAzMjI5NjJhOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.MI9Yhr5Lh3XOOCSyUWKDqnrQRUB0f02iJmk_9IVFzP8)
Here, something strange occurs. Both synthesizers' linear, sinc and 4th order examples sound pretty much the same and are free of artifacts. However, FluidSynth's 7th-order interpolation is creating clear high-frequency distortions which can be seen as horizontal lines sustained through most of the bass notes. These distortions create an audible whine in the sound that is not present using any of the other interpolation methods.
Test 4: Low Quality Timpani Sample
This test attempts to see how an interpolation method handles low-bitrate samples. Low quality interpolation methods will result in audible high-frequency aliasing noise. Here is the spectogram:
![Image](https://private-user-images.githubusercontent.com/6825789/409832421-fdfa1532-5eaf-4a9c-b00b-32f84d40f892.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MzU5NDksIm5iZiI6MTczODkzNTY0OSwicGF0aCI6Ii82ODI1Nzg5LzQwOTgzMjQyMS1mZGZhMTUzMi01ZWFmLTRhOWMtYjAwYi0zMmY4NGQ0MGY4OTIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMTM0MDQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTZkMGJmYjVlMzhiNzBhNjhkZjQyOTM3NTdiZGQ0Nzg3YmNkOWJiN2EzM2JiMDk3MGNmNDQ0NjI5MWVhYWRmNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.jcz0BnhaXUX1cZ0xzKEISHCia6e9RGbnltbYVoGjvYQ)
Both linear results show the high frequency aliasing noise quite clearly, and this can be heard as a grainy, ringing sound. FluidSynth's 4th order interpolation cuts down on this noise quite a bit, but does not completely eliminate it. BASSMIDI's sinc interpolation completely eliminates the aliasing noise. FluidSynth's 7th-order interpolation seems to have cleaned up most of the aliasing noise, but once again features the same type of high frequency "whine" distortion we saw in the electric bass example.
Expected behavior
A high quality sample interpolation should not be producing these harmonic distortions. Unfortunately, this means that FluidSynth is not currently capable of truly high quality sample playback—at least in terms of what is expected out of a sampler used in professional music production. In many examples, the 7th order resampler sounds worse than 4th order and in some cases even worse than linear.
The text was updated successfully, but these errors were encountered: