Good article about sample rates

Link to good samples/soundfonts at http://wiki.linuxaudio.org/wiki/free_audio_data

Moderators: MattKingUSA, khz

Eino
Established Member
Posts: 107
Joined: Mon Dec 23, 2013 2:22 pm
Location: Music City USA
Contact:

Re: Good article about sample rates

Post by Eino »

All I look for is quality in sound, I have a flac file of a singer in a studio sitting on a stool, with a guitar singing.
I can hear every movement she makes, along with how her fingers rub the strings.
In the mp3 file format, I don't hear any of that. Same recording just different file formats.
But the flac music is a huge file, compared to the mp3, and the mp3 was set at a variable bit rate.
This is the biggest reason, I only use mp3 for music streams on-line, rather than listening.
Dam, I'm reading this, and realizing I'm getting off the subject.
It could still be the difference in sample rates, between formats also..
I would share them with you, but I would be breaking my agreement with the studio, and copyrights.
The only reason I have them, I was the backup playing the piano in a few songs.
But what do I know, I'm more of an artist than than a recording technician, and I do some recording for myself.
"Music is everybody's possession. It's only publishers who think that people own it. "
John Lennon

https://soundcloud.com/eino1953
ssj71
Established Member
Posts: 1294
Joined: Tue Sep 25, 2012 6:36 pm
Has thanked: 1 time

Re: Good article about sample rates

Post by ssj71 »

nbd wrote:
raboof wrote:because converting from 88.2kHz to 44.1kHz is mostly a matter of just skipping every second sample
Doing this would be a bad idea if you truly care about the quality. You could easily test this by doing a simple 'skip' and then using a lib like libsamplerate and listen the differences. Throwing away 50% of the information without using it will have an impact.
Not trying to say this is wrong, but I think its good to have such a thread as this be clear on some rather misunderstood principles. This statement is generally true in practical applications but there are certain instances where this would not be true.

Skipping every other sample only throws away information if there is harmonic content above the new lower nyquist frequency. So, using raboof's example of an 88.2Khz signal, there are special cases:

IF you have NO frequency content above 22.05Khz (the new nyquist) you can throw every other sample away without loss of ANY information. In other words you can perfectly reconstruct the original signal.

IF you have no USEFUL content above 22.05Khz (i.e. the only high frequency content is noise) then you must filter out that content with a low pass filter or else it will alias. Once filtered so that there is no longer any frequency content above 22.05Khz you can throw away every other sample without losing ANY of your USEFUL content (the non-useful noise got removed by your filter).

IF you upsample (with a perfect anti-imaging filter) from a 44.1Khz signal to a 88.2Khz signal you still have no frequency content above 22.05Khz. You can therefore throw away every other sample without consequence to your original signal.

Practically, the anti-aliasing and anti-imaging filters necessary for perfect conversions aren't possible for a real time signal, but we get away with good enough that you'll never notice. As noted in the article the threshold of human hearing is typically lower than 20Khz which indicates that any content above 22.05Khz isn't useful and can be filtered out without consequence, but common processes (i.e. modulation) generate content in these higher ranges. If these modulated signals aren't sampled at a high enough frequency, that generated high frequency content will immediately be aliased back down to the audible range and sound bad. So the real degradation in quality caused by a simplistic throw every other sample away from an 88.2Khz signal is purely caused by aliased signals in the upper range, not in the loss of information in the upper range (though it is indeed lost since its mixed unrecoverably into the lower frequencies) or some inferiority of the sampling rate. An appropriate anti-aliasing filter in a down-sampling implementation will yield a signal with identical sound to the human as the 88.2Khz signal.

Hope that was informative and not rant/rude sounding.
_ssj71

music: https://soundcloud.com/ssj71
My plugins are Infamous! http://ssj71.github.io/infamousPlugins
I just want to get back to making music!
Eino
Established Member
Posts: 107
Joined: Mon Dec 23, 2013 2:22 pm
Location: Music City USA
Contact:

Re: Good article about sample rates

Post by Eino »

Hope that was informative and not rant/rude sounding.
Well said not a rant/or rude.
"Music is everybody's possession. It's only publishers who think that people own it. "
John Lennon

https://soundcloud.com/eino1953
User avatar
raboof
Established Member
Posts: 1855
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Has thanked: 50 times
Been thanked: 74 times
Contact:

Re: Good article about sample rates

Post by raboof »

nbd wrote:
raboof wrote:because converting from 88.2kHz to 44.1kHz is mostly a matter of just skipping every second sample
Doing this would be a bad idea if you truly care about the quality. You could easily test this by doing a simple 'skip' and then using a lib like libsamplerate and listen the differences. Throwing away 50% of the information without using it will have an impact.
It does ;). Attached are a 44.1kHz original, downsampled 'naively' and using 2 different libsamplerate algorithms to 11025Hz. The difference is indeed huge ;).
Attachments
BIS1536-001-flac_24_fragment_naive_11025Hz.wav
naively just take every 4th sample
(629.46 KiB) Downloaded 47 times
BIS1536-001-flac_24_fragment_44100Hz_best_sinc_interpolated_to_11025Hz.wav
libsamplerate best sinc
(629.47 KiB) Downloaded 52 times
BIS1536-001-flac_24_fragment_44100Hz_linear_interpolated_to_11025Hz.wav
libsamplerate linear
(629.47 KiB) Downloaded 45 times
BIS1536-001-flac_24_fragment_original_44100Hz.wav
original
(2.46 MiB) Downloaded 49 times
Eino
Established Member
Posts: 107
Joined: Mon Dec 23, 2013 2:22 pm
Location: Music City USA
Contact:

Re: Good article about sample rates

Post by Eino »

Eino wrote:All I look for is quality in sound, I have a flac file of a singer in a studio sitting on a stool, with a guitar singing.
I can hear every movement she makes, along with how her fingers rub the strings.
In the mp3 file format, I don't hear any of that. Same recording just different file formats.
But the flac music is a huge file, compared to the mp3, and the mp3 was set at a variable bit rate.
This is the biggest reason, I only use mp3 for music streams on-line, rather than listening.
Dam, I'm reading this, and realizing I'm getting off the subject.
It could still be the difference in sample rates, between formats also..
I would share them with you, but I would be breaking my agreement with the studio, and copyrights.
The only reason I have them, I was the backup playing the piano in a few songs.
But what do I know, I'm more of an artist than than a recording technician, and I do some recording for myself.
raboof, This was my point also between audio formats and losses. I already know the differences, but I listened to your files anyway.. I noticed that you loose the piano earlier during the fade, and little changes that make a difference in quality. But it may be just my ear tho. I'm using 7.1 surround sound on this computer. I did not try it with the headphones yet.

Code: Select all

inxi -A 
Audio:     Card Creative Labs SB Audigy driver: snd_emu10k1 
           Sound: ALSA v: k3.7.0-10.dmz.1-liquorix-amd64
edit: It is the same with the headphones, just quality is more noticeable tho.
Last edited by Eino on Mon May 12, 2014 10:30 pm, edited 1 time in total.
"Music is everybody's possession. It's only publishers who think that people own it. "
John Lennon

https://soundcloud.com/eino1953
ssj71
Established Member
Posts: 1294
Joined: Tue Sep 25, 2012 6:36 pm
Has thanked: 1 time

Re: Good article about sample rates

Post by ssj71 »

raboof wrote:4.1kHz original, downsampled 'naively' and using 2 different libsamplerate algorithms to 11025Hz
I'm 100% for experimentation and exploration. This was a good test to show how different downsampling techniques effects the sound. Naturally all the downsampled clips sound a little "closed off" because at 11.025kHz it cannot produce any frequencies over 5.5125kHz. But the point is the difference between the "naive" sample that has no accounting for aliasing, and the sinc-interpolated which has high quality band-limiting filters applied to the source to remove those frequencies that would alias. The result is that good downsampling sounds more clear (at least to me it does) as it has more headroom than the clip with a bunch of aliased noise that isn't especially audible, but it does make a difference. So apply this principle to an 88.2kHz signal where you can't hear the stuff over 20kHz anyway and you see that the downsampling implementation is a big deal.

I'm probably stating the obvious, but its fun to talk about this stuff.
_ssj71

music: https://soundcloud.com/ssj71
My plugins are Infamous! http://ssj71.github.io/infamousPlugins
I just want to get back to making music!
User avatar
raboof
Established Member
Posts: 1855
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Has thanked: 50 times
Been thanked: 74 times
Contact:

Re: Good article about sample rates

Post by raboof »

ssj71 wrote:The result is that good downsampling sounds more clear (at least to me it does) as it has more headroom than the clip with a bunch of aliased noise that isn't especially audible, but it does make a difference.
Oh yes! Actually there's a huge 'crunch' noise in the middle of the fragment in both the 'naive' and in the linear libsamplerate result - it was surprising to me the difference was so big.

Even the difference between the 'linear' and the 'naive' approach surprised me: the sound produced by my 'naive' script sounds way 'narrower' to my ears. I wonder if I had a bug in my script that introduced some error, but I'm not sure I'll find the time to revisit it.
I'm probably stating the obvious, but its fun to talk about this stuff.
Yeah, and the thing is, testing obvious things can still lead to surprising results ;)
tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Good article about sample rates

Post by tramp »

I use almost ever libzita-resampler for all re-sampling tasks. It gives me the best results.
http://kokkinizita.linuxaudio.org/linux ... mpler.html
On the road again.
Post Reply