The DijonStock Digital Home Recording Support Forum

*** USER REGISTRATION DISABLED! FOR ACCESS TO THE BOARD, MAIL TO registration AT dijonstock DOT com. THANK YOU ***
It is currently Tue Mar 19, 2024 4:30 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 42 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Mon Mar 16, 2009 8:23 pm 
Offline
Robbie The Botkiller
User avatar

Joined: Sat Jun 19, 2004 12:46 pm
Posts: 5610
Location: Netherlands
Favourite food: Ria's cheesecake
Machine type: AW16G
Sound is variation in air pressure causing air displacement which can be detected by our ears. We can also measure the sound by a sound detector which we call a microphone. It'll change the air displacement into analogue electric signals. So, over time the output voltage of the mic changes.

Recording is measuring this voltage level periodically and storing it so the sound can be reproduced later.

However there are two major problems.

1) How fast is the level changing? In other words, what should the measuring rate be without missing something relevant in between two measurements?

2) How accurate should a measurement be?

Ad. 1) We can hear up to about 20 KHz. That means we can hear up to 20.000 waves per second. Given the fact that every wave has a minimum and a maximum, we have to measure both and therefore the measuring (taking a sample of the level) should take place at least twice for every wave resulting in a sampling frequency of about 40 KHz. However, this is based on a theory that in practice turns out to be too simple, to get an accurate frequency response you need more than twice the highest sound frequency - you need at least 5 times the highest frequency. Sticking to that theory will reproduce 20 KHz sounds, but not nearly as accurate as they should be.

When you see a sound wave as a graph, sampling frequency is horizontal smoothness. The higher the value, the better the reproduced frequency characteristics.

Ad. 2) Our ear has a dynamic range of about 90 dB within the same signal. On separated signals it is much higher, but if we're listening to natural sounds, when listening to two sounds at the same time you will not hear the softer sound when it is more than 90 dB apart from the louder sound. So, we should be able to have a dynamic range of 90 dB to have a sound at least appear natural. Theoretically, 16 bit is right about enough for that. However, recording music with soft and loud passages and keeping the natural sound is impossible; the loudest sound should still fit in the 16 bits, leaving considerably less bits for softer passages, resulting in unnatural sounds. Filtering does help, but that is tricking, and a trick is what it is... a trick. So, you would need more bits to be able to get a more precise measurement.

When you see a sound wave as a graph, bit depth is vertical smoothness. The more bits, the more accurate each measurement is, the less noise caused by quantization errors (rounding off to the nearest discrete value is making errors).

So, there's lot of room for discussion. Is 44.000 samples per second quick enough? Is 16 bit (giving 65536 discrete levels) accurate enough? Or should we go to 24 bit (16 million levels) or even 32 bit (4 billion levels)?

On sound systems that are not particularly high-end you might not know the difference. Problem is that if you encounter these problems for the first time you probably don't know what to listen for. How do variations in sampling frequency sound? How do variations in bit depth sound? Once you're aware of this, you may want to compare CD sound (16 bit 44 KHz) to DVD sound (24 bit, 48 KHz).

Let's start with a full CD clip. It is 16 bit, 44 KHz, 20 seconds long.

Note: these are all wav files, so no compressed MP3's. They are relatively big files.

My advice is to listen in the same order they are posted. It is in my opinion the best way to discover the difference.

First, we'll gradually turn back the sampling frequency. So we'll be killing the horizontal smoothness.



Clip 44 Khz 16 bit 3,5 MB
Sounds great, huh? It's my favourite band.


Clip 22 Khz 16 bit 444 KB
On a first listen, there's not much difference, but a good comparison might uncover a slight but audible difference in very crisp sounds, like crashes and cymbals. In the middle of the sound sample, quantization errors pop up. It sounds a bit like clipping.


Clip 11 Khz 16 bit 225 KB
Here, the difference is clearly notable. The highest frequencies (above +/- 6 KHz) are gone. Listen closely to the 3rd and 4th second: you'll also be able to hear quantization errors. If the sample rate is lower, the signal has changed more since the last sample, hence a bigger error.


Clip 8 Khz 16 bit 164 KB
Upper frequencies (cymbals and crashes, and also the crispness of the snare) are completely gone. This is less than AM radio quality. The vocals miss the S and F and are becoming harder to understand.


Clip 4 Khz 16 bit 84 KB
This is so bad that even the midrange is blurred. Only the lowest frequencies are still a bit accurate. You can hardly recognise the singer, let alone the lyrics.


Clip 2 Khz 16 bit 42 KB
The only thing left are the lowest frequencies.



Now, lets go for the vertical smoothness.

OK, lets get back to CD quality and loosen our ear drums a bit.
Clip 44 Khz 16 bit 3,5 MB
This is what a CD quality reproduction is supposed to sound like.


Clip 44 Khz 8 bit 1,7 MB
The frequency response is not touched. The sound quality is still acceptable, but this has to be credited to the sound engineers, they compressed the album to death. So, the dynamic range is now about 45 dB, but it's constantly close to 0 dB anyway.


Clip 44 Khz 4 bit 0,9 MB
Now we changed 65536 levels back to 16. Here, the sound signal is brought back to only 16 discrete levels! That makes the quantization errors massive. You can also hear some instruments suddenly appear because they start under the threshold of one of those levels, and then suddenly cross it. Frequency response is untouched - cymbals and crashes are still audible once they cross certain sound levels.



I'll add some sine waves later - they make clear what biasing effect is.

_________________

Don't judge the coffee by its cup.
The proof of the cheese is in the eating


Top
 Profile  
 
PostPosted: Wed Mar 18, 2009 4:56 pm 
Offline
Robbie The Botkiller
User avatar

Joined: Sat Jun 19, 2004 12:46 pm
Posts: 5610
Location: Netherlands
Favourite food: Ria's cheesecake
Machine type: AW16G
Here's some explanation about the biasing effect. It is a phenomenon that takes place at any sampling rate of the recording of any freqency. However if the sampling frequency is a bigger multitude of the frequency of the sound that is actually recorded, the biasing effect is so small it becomes inaudible. And that is what we want.




440 Hz and 880 Hz tone sampled at 44 Khz
Here is a test tone, recorded in CD specifications: 44 KHz. The tone itself is a repetition of two seconds of 440 Hz, two seconds of 880 Hz.
The sampling frequency 100x and 50x the wave frequency. That is a big multitude, so the biasing effect isn't audible.



440 Hz and 880 Hz tone sampled at 22 Khz
The same waves at a lower sampling frequency. The ratio's are now 1:50 and 1:25. The 440 Hz tone is still good, but you can clearly hear quantization errors in the 880 Hz tone/



440 Hz and 880 Hz tone sampled at 11 Khz
The same waves at an even lower sampling frequency. Quantization errors are clearly audible. The output of the DA converter that changes the bit stream into an analogue signal should be connected to a filter that filters out anything higher than half the sampling frequency. That way, you'd filter out the quantization errors. The result would be much boomy, though.



440 Hz and 880 Hz tone sampled at 8 Khz
The same waves sampled at 8 KHz. Now the biasing effect starts to be audible. You'll hear some extra frequencies appear. They are quite high - the difference between the wave frequency and the sample frequency. Ugly, huh.



440 Hz and 880 Hz tone sampled at 4 Khz
The same wave at an even lower sampling frequency: 4 KHz. The 440 Hz shows a clear biasing effect. The 880 Hz changes into utter rubbish.



440 Hz and 880 Hz tone sampled at 2 Khz
This is so bad it'll hurt not only your ears but also your general well being.



Now let's make a little calculation to see what we're actually doing.

The biasing effect becomes audible when an 880 Hz tone is reproduced using an 8 KHz sampling frequency. That is a 1:9 ratio between signal and carrier. On a CD, the carrier is 44 KHz. To have the same ratio, a signal should be 44000/9 = 4900 Hz, let's say 5 KHz. So, at 5 KHz, the reproduction of a CD is not accurate anymore. For that, we'd need to go as high as 20.000 Hz (our ears) times 9 = 180 KHz.

Is it that bad? Not really. Analogue filtering, oversampling and a few other tricks will make it better. But these are not miracles. As of a ratio of 5 (8 - 9 KHz) the reproduction of a frequency falls back.

The biasing effect can also be explained visually. I'll make a few pics.

_________________

Don't judge the coffee by its cup.
The proof of the cheese is in the eating


Top
 Profile  
 
PostPosted: Wed Mar 18, 2009 6:41 pm 
Offline
Robbie The Botkiller
User avatar

Joined: Sat Jun 19, 2004 12:46 pm
Posts: 5610
Location: Netherlands
Favourite food: Ria's cheesecake
Machine type: AW16G
A visual representation of the sound reproduction will show what goes wrong.

The samples shown here are all 0,0675 seconds long. That's about 1/15 of a second.


Image
This is a 440 Hz wave, sampled at 44 KHz. Every single wave (for instance from top to top) consists of about 100 samples. The bottleneck is the resolution of the picture. Besides that, it looks like a smooth sine wave.



Image
This is an 880 Hz sine wave. Besides the resolution of the pic, great wave. Still about 50 samples per wave, which gives a good reproduction.



Image
This is the same 440 Hz wave as in the first picture, but sampled at only 2 KHz. You'll see that most of the tops are clipped and there are sharp edges which, if remaining unfiltered, lead to awful higher harmonics. Every sharp edge is constructed by a range of higher harmonic sinus waves, all added together. This introduces sounds that were never recorded and never intended.

Looking at a wave, sampled by CD specs (44 KHz) at the same ratio (1:4,5), it must be 9700 Hz (so, less than 10 KHz). This is a frequency that should still be recorded accurately, but you see what it leads to - rubbish.



Image
This is the same 880 Hz wave as in the second picture, but sampled at only 2 KHz. You'll see that not only the tops are clipped, but periodically the tops completely disappear. This new period is introduced by an audible sound of the same frequency. This is the same what happens with sounds recorded on CD that have a frequency in the range of 9 - 20 KHz. Even more rubbish.


.

You see that to prevent these phenomena you need a much higher sampling frequency than the CD specification. Instead of twice the recorded sound (20 KHz x 2 = 40 KHz) you'll need at least 5 (20 KHz x 5 = 100 KHz). That would lead us to the standard of 96 KHz. And even then you'll see what happens with a 1:5 ratio: look at the third picture (which has the same ratio: 440Hz sampled at 2 KHz).

Analogue filtering and oversampling will help, but prevention is clearly better than curing.

I hope this little article contributes to a better understanding of sample frequency.

_________________

Don't judge the coffee by its cup.
The proof of the cheese is in the eating


Top
 Profile  
 
PostPosted: Wed Mar 18, 2009 7:53 pm 
Offline
Marker Magician
User avatar

Joined: Tue Aug 01, 2006 4:20 pm
Posts: 4013
Machine type: AW2400
Thanks Robbie!

_________________
Byron


Top
 Profile  
 
PostPosted: Wed Mar 18, 2009 10:36 pm 
Offline
Mr. Electonica Dude
User avatar

Joined: Wed Jul 14, 2004 1:48 am
Posts: 11452
Location: Godly Taxas
Favourite food: Frog Legs
Machine type: AW4416
thanks Rob

Good stuff !

_________________
THE MUSIC IS DOWN IN HERE
____________________________________________________

Good judgment comes from experience, and a lot of that comes from bad judgment.


Top
 Profile  
 
PostPosted: Wed Mar 18, 2009 11:17 pm 
Offline
Robbie The Botkiller
User avatar

Joined: Sat Jun 19, 2004 12:46 pm
Posts: 5610
Location: Netherlands
Favourite food: Ria's cheesecake
Machine type: AW16G
You're welcome. Combining my love for music and love for theoretical mathematics releases massive amounts of dopamine in my basal ganglia. :)

I'd like to add a part about MP3's because looking at a re-wav-ed MP3 clears up a lot about psycho-acoustics. However I'll have to find out some more about it - lots of stuff on that subject that I'm unaware of.

I should add more pics to the former part, to show what happens if the sampling frequency and the wave frequency share a common denominator (or slightly off, like 99.9%). Your ears won't like it.

Also, I mention edges in the reproduced wave. Artificial sounds, like synthesizer, use them a lot: saw tooth waves, square waves, triangle waves. They are built by adding an array of sine waves with higher harmonics. A graph would make clear how. Let me see how I could do that. If the sampling frequency is not high enough for these higher harmonics, these wave shapes are the first to perish.

_________________

Don't judge the coffee by its cup.
The proof of the cheese is in the eating


Top
 Profile  
 
PostPosted: Thu Mar 19, 2009 1:54 am 
Offline
Mr. Electonica Dude
User avatar

Joined: Wed Jul 14, 2004 1:48 am
Posts: 11452
Location: Godly Taxas
Favourite food: Frog Legs
Machine type: AW4416
OK you big hunk of Einstein.......riddle me this. I have a program that changes bit depths and audio formats. I pretty much understand what happens when you change a .wav file to a .MP3. It allows me to change MP3 back to .wav . Never done it because I figured the fidelity loss from the MP3 conversion was not going to be restored by converting it back to .wav .

Gary and I have been working with MP3 files some and it's handier to exchange the smaller MP3 files until he needs a .wav file to work with for his mixdown .

Just kinda wondering what would happen going from MP3 to Wav. Sonar doesn't really care which format it is as far as project loading so MP3 is OK with me for bed tracks unless I am mastering here.

msg

_________________
THE MUSIC IS DOWN IN HERE
____________________________________________________

Good judgment comes from experience, and a lot of that comes from bad judgment.


Top
 Profile  
 
PostPosted: Thu Mar 19, 2009 8:59 am 
Offline
Robbie The Botkiller
User avatar

Joined: Sat Jun 19, 2004 12:46 pm
Posts: 5610
Location: Netherlands
Favourite food: Ria's cheesecake
Machine type: AW16G
MP3 filters out a lot of information. So if someone gives you an MP3, you'll be missing a lot of info. Going back to wav will still sound the same as MP3 - missing a lot of information.

_________________

Don't judge the coffee by its cup.
The proof of the cheese is in the eating


Top
 Profile  
 
PostPosted: Thu Mar 19, 2009 4:19 pm 
Offline
Spaminator Extraordinaire
User avatar

Joined: Tue Jun 22, 2004 10:58 pm
Posts: 8713
Favourite food: sushi
Machine type: AW2400
Robbie wrote:
MP3 filters out a lot of information. So if someone gives you an MP3, you'll be missing a lot of info. Going back to wav will still sound the same as MP3 - missing a lot of information.


When I burn a cd of a mix and move it to my computer to tool around with wav file on Adobe Audition, I save the wav, make changes, resave and later create a mp3. That way I have both. However in Geno's case where the file has been manipulated via mp3 you're gonna lose quality. Even if you you saved it at a higer bit rate of say 320kbps/44100hz, you certainly will still lose info, but maybe not as much.

As Randy mentioned in another thread, the best thing to do is transport the wav file back and forth using something like yousendit.com. I believe you can send 1 or 2 gig for free. Then when completed, you can do your mp3 rendering.

_________________
GSMUSIC: Hey RZ, Im not no upper class american, the gear I own is what I have special to me. My car sucks, my house sucks, my nieghborhood sucks. Does yours RZ? Does it?

rz-land


Top
 Profile  
 
PostPosted: Thu Mar 19, 2009 4:32 pm 
Offline
Mr. Electonica Dude
User avatar

Joined: Wed Jul 14, 2004 1:48 am
Posts: 11452
Location: Godly Taxas
Favourite food: Frog Legs
Machine type: AW4416
Thats kinda what I thought. Thanks for confirming it.

_________________
THE MUSIC IS DOWN IN HERE
____________________________________________________

Good judgment comes from experience, and a lot of that comes from bad judgment.


Top
 Profile  
 
PostPosted: Thu Mar 19, 2009 5:11 pm 
Offline
Website Slayer and Problem Solver
User avatar

Joined: Fri Dec 03, 2004 1:28 am
Posts: 1300
Location: 1/2 Central CA Coast; 1/2 RVing
Machine type: AW1600
I looked at a spectrum analysis of an MP3 file once (vs. the WAV). Very obvious the high freqs are attenuated. Once they are gone, they're gone forever. :)

_________________
Ralph (aka The Head Hog)
"What's Time to a Hog?"
Hog Time Music Website - My Songs on Bandcamp -


Top
 Profile  
 
PostPosted: Fri Mar 20, 2009 8:35 pm 
Offline
Mr. Electonica Dude
User avatar

Joined: Wed Jul 14, 2004 1:48 am
Posts: 11452
Location: Godly Taxas
Favourite food: Frog Legs
Machine type: AW4416
Yep I got around to that this morning. Converted a wav to mp3 , looked at it on the RTA , then converted the mp3 back to a wav and ran it through again.

No difference. I guess I was hoping the magic fairy princess would wave her bit wand and make things better.

Nope , once it's done , it's done.

msg

_________________
THE MUSIC IS DOWN IN HERE
____________________________________________________

Good judgment comes from experience, and a lot of that comes from bad judgment.


Top
 Profile  
 
PostPosted: Fri Mar 20, 2009 10:43 pm 
Offline
Robbie The Botkiller
User avatar

Joined: Sat Jun 19, 2004 12:46 pm
Posts: 5610
Location: Netherlands
Favourite food: Ria's cheesecake
Machine type: AW16G
Yep - the info that was thrown out, won't return.

_________________

Don't judge the coffee by its cup.
The proof of the cheese is in the eating


Top
 Profile  
 
PostPosted: Sat Mar 21, 2009 1:23 am 
Offline
Website Slayer and Problem Solver
User avatar

Joined: Fri Dec 03, 2004 1:28 am
Posts: 1300
Location: 1/2 Central CA Coast; 1/2 RVing
Machine type: AW1600
And that's why they call it "lossy" compression. :)

_________________
Ralph (aka The Head Hog)
"What's Time to a Hog?"
Hog Time Music Website - My Songs on Bandcamp -


Top
 Profile  
 
PostPosted: Wed Apr 01, 2009 7:49 pm 
Offline
DS Techie and Newbie of the Month!
User avatar

Joined: Sun Jun 24, 2007 5:50 pm
Posts: 47
Machine type: AW1600
The sound samples were very interesting, showing the significance of different sample rates.
Does anyone have a similar set of samples to demonstrate the effects of different bit rates.

_________________
Tim Andrews
United Kingdom


Top
 Profile  
 
PostPosted: Wed Apr 01, 2009 9:05 pm 
Offline
Robbie The Botkiller
User avatar

Joined: Sat Jun 19, 2004 12:46 pm
Posts: 5610
Location: Netherlands
Favourite food: Ria's cheesecake
Machine type: AW16G
You mean MP3, right?

I have some, I'll put them up.

_________________

Don't judge the coffee by its cup.
The proof of the cheese is in the eating


Top
 Profile  
 
PostPosted: Wed Apr 01, 2009 9:13 pm 
Offline
Robbie The Botkiller
User avatar

Joined: Sat Jun 19, 2004 12:46 pm
Posts: 5610
Location: Netherlands
Favourite food: Ria's cheesecake
Machine type: AW16G
Ai, they are full sized files/songs. I'll put them up anyhow, I'll change it into clips of a few seconds later. Let me upload them (slooooooooooooooooooooooooooooooow)

_________________

Don't judge the coffee by its cup.
The proof of the cheese is in the eating


Top
 Profile  
 
PostPosted: Wed Apr 01, 2009 9:38 pm 
Offline
Robbie The Botkiller
User avatar

Joined: Sat Jun 19, 2004 12:46 pm
Posts: 5610
Location: Netherlands
Favourite food: Ria's cheesecake
Machine type: AW16G
Got them.

MP3's are based on psycho-acoustics. It filters out what you don't hear. Simply put, the frequency spectrum is divided in a number of ranges and the mp3 file contains information of how much (amplitude) there is of which part of the spectrum.

I'll dig deeper in it because personally I find this heavily interesting.

Here are a few examples of "Dive Into The Sun" by ... :)

Dive 320 kbps 9,7 MB => sounds like a good quality
Dive 160 kbps 4,9 MB => still sounds good. There might be a little distortion in small details.
Dive 128 kbps 3,9 MB => acceptable, but the difference is clear.
Dive 96 kbps 2,9 MB => internet radio quality - considerable lack in quality
Dive 64 kbps 1,9 MB => ouch
Dive 48 kbps 1,4 MB => awful
Dive 32 kbps 1,0 MB => who??

_________________

Don't judge the coffee by its cup.
The proof of the cheese is in the eating


Top
 Profile  
 
PostPosted: Sat Apr 04, 2009 2:46 pm 
Offline
DS Techie and Newbie of the Month!
User avatar

Joined: Sun Jun 24, 2007 5:50 pm
Posts: 47
Machine type: AW1600
Once again, I am grateful for Robbie's clear (and patient) explanations. The set of MP3s were very interesting.
But - I realised that I had asked the wrong question. And I am about to display my ignorance with this followup:

Although 16 bit gives 65536 discrete levels, what happens if, in error, we have our recording levels too low? I assume we use less than the 65k available levels.
Although the final output can be amplified (or 'normalized') to achieve a standard level, I appreciate that won't make the result 'better'.

Is the result of 'low recording levels' the same as 'converting an existing recording to a lower sample rate'?
If it is - then why don't instruments in the background of mix sound ugly or distorted?

_________________
Tim Andrews
United Kingdom


Top
 Profile  
 
PostPosted: Sat Apr 04, 2009 4:43 pm 
Offline
Robbie The Botkiller
User avatar

Joined: Sat Jun 19, 2004 12:46 pm
Posts: 5610
Location: Netherlands
Favourite food: Ria's cheesecake
Machine type: AW16G
tima wrote:
Although 16 bit gives 65536 discrete levels, what happens if, in error, we have our recording levels too low? I assume we use less than the 65k available levels.


Exactly. It's lie having a 10 story building and you won't go higher than the third floor.

tima wrote:
Although the final output can be amplified (or 'normalized') to achieve a standard level, I appreciate that won't make the result 'better'.


Also correct - in the meaning of sound quality. If your amplification was too low, you won't use all 16 bits, you won't use all 65536 levels. The information that stays, is recorded in fewer bits, contains fewer information. The signal stays lower while the steps are constant. So, if you amplify this later by normalizing, you will get your signal to the level where you originally wanted it, but you increased the steps between the levels and you have a less than desireable signal to noise ratio.

It's again like the elevator. You allowed it to go to foor floors only. So, if you want to get to the tenth floor you can only have the elevator stop at ground floor, third floor, sixth floor and tenth floor. Or something like that. Lots of people, after using that elevator, will need to use the stairs to get to the exact floor.


tima wrote:
Is the result of 'low recording levels' the same as 'converting an existing recording to a lower sample rate'?


No, a lower sample rate means less measurements per second. Lower recording levels means using less bits per measurement, but you might as well measure real quick.

I'll try to put it in pics.

_________________

Don't judge the coffee by its cup.
The proof of the cheese is in the eating


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 42 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group