Page 1 of 2
Resampling lower cuts the audio in half
Posted: Mon Aug 10, 2015 11:03 pm
by edwinn
Win7-32, SP1 and Audacity 2.1.1
I do a lot of capture from audio streams (typically a lecture or discussion) and many times EXPORT the results as 22k or 16k FLAC files, later to export MP3 after editing complete. If I try to export as an 11k FLAC file, the audio is small filesize wise, but it's cut in half. That means the second half is missing.
Why does this happen? does one need to start with a 44k source file? Didn't do enough of these to notice trend.
TIA,
ED
Re: Resampling lower cuts the audio in half
Posted: Mon Aug 10, 2015 11:10 pm
by steve
edwinn wrote:22k or 16k VBR FLAC files
What do you mean?
FLAC does not do VBR.
What do you mean by 16k and 22k?
Re: Resampling lower cuts the audio in half
Posted: Mon Aug 10, 2015 11:32 pm
by DVDdoug
EXPORT the results as 22k or 16k VBR FLAC files, later to export MP3 after editing complete. If I try to export as an 11k FLAC file, the audio is small filesize wise, but it's cut in half. That means the second half is missing.
Are you sure the 2nd half is missing?
If you take a FLAC with a sample rate of 22kHz and downsample it to 11kHz, there's half as many samples and it will be (approximately) half the size.
The same thing will happen with a WAV file.... If you cut the sample rate in half, you have half as many samples so the file is half the size.
This won't happen with lossy formats like MP3 unless you also cut the bitrate (kbps) in half.
FYI - The sample rate (kHz) limits the high audio frequencies in your file. You can only store audio up to half the sample rate. For example, audio CDs at 44.1kHz are limited to audio of 22,050Hz. At a sample rate of 11kHz, audio can't go any higher than 5.5khz, which is about the frequency range of AM radio or telephone.
The "traditional" audio range is 20Hz to 20,000Hz. ...Young people with good hearing can hear to about 20kHz.
Re: Resampling lower cuts the audio in half
Posted: Mon Aug 10, 2015 11:42 pm
by edwinn
DVDdoug wrote:
This won't happen with lossy formats like MP3 unless you also cut the bitrate (kbps) in half.
For audio CDs at 44.1kHz are limited to audio of 22,050Hz. At a sample rate of 11kHz, audio can't go any higher than 5.5khz, which is about the frequency range of AM radio or telephone.
Yes thank you, I'm well aware of that,
Lol and trying for an audio bandwidth of 11 kHz, 8kHz and 5.5 kHz (like the old phone lines) respectively.
Maybe the problem is lowering the bitrate as you describe?
The exported audio.. has the second half missing.
-Ed
Re: Resampling lower cuts the audio in half
Posted: Tue Aug 11, 2015 12:33 am
by DVDdoug
Weird.... I have no idea why the 2nd half is missing... How long are your files (playing time)?
There is a file size limit for WAV (2gB or 4GB depending on which spec you read) but there's no similar limit for FLAC and MP3.
I've made some FLACS and MP3s that were more than 4 hours, and I've never had that problem...
If I try to export as an 11k FLAC file, the audio is small filesize wise, but it's cut in half. That means the second half is missing.
Have you tried exporting directly to MP3, or to WAV?
Re: Resampling lower cuts the audio in half
Posted: Tue Aug 11, 2015 8:59 am
by Gale Andrews
We should also be clear that "11 kHz" and "22 kHz" are non-standard. It's 11025 Hz (11.025 kHz) and 22050 Hz (22.050 kHz).
You can't directly control the FLAC bitrate - that's determined by sample rate, bit depth and number of channels.
Gale
Re: Resampling lower cuts the audio in half
Posted: Sat Aug 15, 2015 12:02 pm
by edwinn
Gale Andrews wrote:We should also be clear that "11 kHz" and "22 kHz" are non-standard.
You can't directly control the FLAC bitrate - that's determined by sample rate, bit depth and number of channels.
Thanks for that.
Admittedly I was confused about what file-type the issue was affecting. It was probably happening with MP3.
Have been saving ALL audios as FLAC lately after installing a new 2T hard drive, mostly because you can edit and 'resave' FLAC with little or no reduction in quality. MP3 is the final export IMHO, like a JPG image.
In my defense, and leading to the confusion,
Winamp 2.64 displays
kbps and
kHz which I see jumping around while a FLAC is playing.
Here's a 2-frame animation of a
FLAC saved at Q=9 (lowest for a voice lecture) with
bitrate varying, and the title in a marquee display.
-Ed
p.s. I'm very seriously thinking of donating to encourage further development of this app..
Re: Resampling lower cuts the audio in half
Posted: Sat Aug 15, 2015 12:14 pm
by edwinn
Gale Andrews wrote:We should also be clear that "11 kHz" and "22 kHz" are non-standard. It's 11025 Hz (11.025 kHz) and 22050 Hz (22.050 kHz).
Yes.. Here is the spectrum of the file displayed in the animation above. Again this App is GREAT.
Log scale
Linear scale
The audio was a Youtube soundtrack rip, and now I see it was probably an 11 kHz (5.5 kHz bandwidth) originally?
Does FLAC generate energy in the 5.5 - 11 kHz range when coding?
What is your explanation of this.. anyone?
Re: Resampling lower cuts the audio in half
Posted: Sat Aug 15, 2015 12:49 pm
by Gale Andrews
edwinn wrote:Gale Andrews wrote:We should also be clear that "11 kHz" and "22 kHz" are non-standard.
You can't directly control the FLAC bitrate - that's determined by sample rate, bit depth and number of channels.
[...]
In my defense, and leading to the confusion, Winamp 2.64 (yep, love that old version) displays
kbps and
kHz which I see jumping around while a FLAC is playing.
Here's a 2-frame animation of a FLAC saved at Q=9 (lowest for a voice lecture) with bitrate variating, and the title in a marquee display.
Only the bit rate is "changing".
Winamp aren't exactly wrong. FLAC does compress much more when there is silence than when there is white noise, which has full bandwidth. For example, 30 seconds of silence encoded as 16-bit mono 22050 Hz FLAC makes a file of about 200 kB size, while 30 seconds of noise at 0.8 amplitude encoded as 16-bit mono 22050 Hz FLAC makes a file of about 1.2 MB size.
In comparison, 30 seconds of silence or 30 seconds of white noise encoded as 16-bit mono 22050 Hz WAV both make a file of about 1.2 MB. So you can see that the FLAC noise file saves no file size at all compared to WAV, but the FLAC silence file saves a vast amount compared to WAV. For "normal" audio content FLAC would turn out at about half the file size that a WAV would have.
Probably the lower bit rate Winamp shows is where the speaker was between words.
The point remains that you cannot set a bit rate when encoding FLAC. The resulting bit rate comes from the length, bit depth and sample rate (as with WAV) but reduced if the content is easy to predict and encode. The FLAC FAQ explains it thus:
https://xiph.org/flac/faq.html#general__lowest_bitrate.
edwinn wrote:p.s. I'm very seriously thinking of donating to encourage further development of this app..
Please do, if you can:
http://audacityteam.org/donate/.
Gale
Re: Resampling lower cuts the audio in half
Posted: Sat Aug 15, 2015 1:03 pm
by Gale Andrews
edwinn wrote:Here is the spectrum of the file displayed in the animation above.
The audio was a Youtube soundtrack rip, and now I see it was probably an 11 kHz (5.5 kHz bandwidth) originally?
Does FLAC generate energy in the 5.5 - 11 kHz range when coding?
What is your explanation of this.. anyone?
Re-encoding at a higher sample rate never adds frequencies that were not there in the first place - it only provides the possibility that higher frequencies could be added.
Most likely the audio was filtered to reduce "honkiness" that too much midrange can cause.
Gale