A Audio, hi-fi and car audio  forum. Audio Banter

Go Back   Home » Audio Banter forum » UK Audio Newsgroups » uk.rec.audio (General Audio and Hi-Fi)
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

uk.rec.audio (General Audio and Hi-Fi) (uk.rec.audio) Discussion and exchange of hi-fi audio equipment.

Audio resampler quality



 
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old August 7th 05, 06:58 PM posted to uk.rec.audio
Chris Isbell
external usenet poster
 
Posts: 126
Default Audio resampler quality

On Sun, 07 Aug 2005 16:04:45 GMT, "DAB sounds worse than FM"
wrote:

Chris Isbell wrote:

BTW: My main use is for converting 48kHz DVB transport streams to
44.1kHz so that I can burn CDs of radio programs to listen to in the
car. (It's the engineer's version of pod casting. ;-)



What method do you use? I do the following:

ProjectX to get the audio from the transport stream, then play the MP2
file in Winamp with the output plug-in set to Nullsoft Disk Writer (set
to produce 16-bit / 44.1 kHz).


I also use ProjectX for the audio extraction, followed by Audacity
under Linux, using its LAME plug in to import the file. Once in
Audacity, I resample the who lot down from 48ksps to 44.1.ksps and
export as a RIFF (.wav) file. Finally, I re-import the resampled file
into a new Audacity project, divide this into tracks and export these
as individual RIFF files, burning them onto CD using K3b (removing the
default two-second gap between tracks that K3b adds by default).

The reason for the import/export into Audacity is that there is a bug
in the program where it incorrectly divides the recording into tracks
when also performing sample rate conversion. (A few seconds of the
previous track appear at the start of all tracks except the first.)

It is complex, but much less complex than producing a DVD from a
television transport stream. :-(


--
Chris Isbell
Southampton, UK
  #12 (permalink)  
Old August 7th 05, 08:18 PM posted to uk.rec.audio
John Phillips
external usenet poster
 
Posts: 294
Default Audio resampler quality

On 2005-08-07, Chris Isbell wrote:
On 07 Aug 2005 08:34:57 GMT, John Phillips
wrote:
When I looked that seemed to test sound cards, not resampling software.
Also it seems to be Windows-only - I couldn't find a version for Linux
(which is what I run here). Perhaps I didn't look hard enough?


I assume that you have looked into Audacity
(http://audacity.sourceforge.net/). This seems to cover sample rate
conversion fairly well (apart from a bug when splitting into tracks at
the same time as performing sample rate conversion). It runs nicely
under Linux.


Yes. The web page I put up with some frequency response results (URL
in earlier article) contains a couple of Audacity screen shots.

Since this is what I use, I would be interested in your comments.


I have looked at Audacity's 48 - 44.1 kHz re-sampling in the frequency
domain. It has good but not exceptional bandwidth, with -3 dB coming at
about 19.2 kHz (87% of Nyquist). The aliasing looks moderate at circa
-44.3 dBFS peak (ref a -1 dBFS peak signal. That's far from perfect but
will be inaudible in this case anyway. The advantage is that it's very
quick and it seems good for its speed (although I am very much still
learning about re-samplers so my opinion may not be reliable).

So there's nothing I can see wrong with Audacity for this re-sampling
application.

I did find a circa 2002 thread on the Audacity developers' mailing
list where it looks like the author chose resample-1.7 as the basis for
Audacity's resampler. He gets much better performance than the stock
resample-1.7 - presumably because he customised resample's filter.

--
John Phillips
  #13 (permalink)  
Old August 7th 05, 08:36 PM posted to uk.rec.audio
John Phillips
external usenet poster
 
Posts: 294
Default Audio resampler quality

On 2005-08-07, Jim Lesurf wrote:
In article , John Phillips
wrote:
... A preliminary comparison is available at
http://www.mainly.me.uk/resampling/.


I'd suggest you also check with some other 'traditional' test waveforms
like two HF components or an HF+LF component and look for anharmonic
products. The results may depend on the precise time-period relationship
with the details of the resampling and sampling periods.


I can generate the waveforms but I am currently learning how to use
octave as a spectrum analyser (perhaps there's another way?) so it may
be a little time before I can do that.

--
John Phillips
  #14 (permalink)  
Old August 8th 05, 05:40 AM posted to uk.rec.audio
John Phillips
external usenet poster
 
Posts: 294
Default Audio resampler quality

On 2005-08-07, Jim Lesurf wrote:
In article , John Phillips
wrote:
On 2005-08-06, Jim Lesurf wrote:

[snip]

... A preliminary comparison is available at
http://www.mainly.me.uk/resampling/.
...
The input to each of the six resamplers is a frequency sweep of 1 kHz/s
from 0 to 23.999 kHz so the "seconds" scale at the top may be read as
"kHz".


The top response and the bottom two show considerable output from inputs
above 22.05 kHz. I assume that's aliasing ...


Your assumption is probably correct, but *might* not be. The snag is that
this depends on how the resampling is done. If done 'incorrectly' there may
be anharmonic artifacts at frequencies other than the simple primary alias
value. For example, due to incorrect forms of 'interpolation' over a range
of input samples which is too short to give satisfactory results. The most
probable effect is, therefore, aliasing at quite high frequencies, but
there is a risk of lower frequency products, particularly if the input is
more complex than a sinewave as other intermod products may be created.


An example (190kbyte GIF): http://www.mainly.me.uk/resampling/alias.gif

The image is of two 512-point FFT spectrograms (made by Audacity) of
1. The frequency sweep input (100 Hz/second, 48 kHz sampled).
2. The re-sampled output from "resample-1.7" (44.1 kHz sampled).

Input frequency is on the horizontal, time axis (100 Hz/s) output spectrum
is on the vertical axis.

I think the descending peak in the lower spectrogram, starting at 220.5
seconds (3'40.5'', 22.05 kHz input) and ending at 240 seconds (4'00'',
24 kHz input, 20.1 kHz output), is clearly aliasing.

However, the peak running below and parallel to the sweep is
interesting. At an input frequency of, say, 21 kHz (time = 3'30'') there
should be no aliasing from the resampler (I think). However there is a
peak on the output at about 17 kHz as well as the expected peak at 21 kHz.

Is this aliasing or another anharmonic artefact?

It's almost as if the 21 kHz input is aliased (mirrored) around 24 kHz
to somehow give 27 kHz, which is then aliased (mirrored) around 22.05
kHz to give 17.1 kHz. Could that happen with aliasing on an upsampling
stage before downsampling? If so, I suspect aliasing from a resampler
could be more complex than I first thought.

--
John Phillips
  #15 (permalink)  
Old August 8th 05, 08:48 AM posted to uk.rec.audio
Jim Lesurf
external usenet poster
 
Posts: 3,051
Default Audio resampler quality

In article , John Phillips
wrote:
On 2005-08-07, Jim Lesurf wrote:
In article , John Phillips
wrote:
... A preliminary comparison is available at
http://www.mainly.me.uk/resampling/.


I'd suggest you also check with some other 'traditional' test
waveforms like two HF components or an HF+LF component and look for
anharmonic products. The results may depend on the precise time-period
relationship with the details of the resampling and sampling periods.


I can generate the waveforms but I am currently learning how to use
octave as a spectrum analyser (perhaps there's another way?) so it may
be a little time before I can do that.


The way I use is to swipe code from somewhere like "Numerical Recipes in C"
.... :-)

FWIW The book has a series of FFT recipies that work quite nicely. I use
one of these, then display the results.

I'll agree that I am terribly 'old fashioned' in my approach, though... My
only real concession to 'modernity' is that I now rarely use "Numerical
Recipies in FORTRAN"... :-)

Slainte,

Jim

--
Electronics http://www.st-and.ac.uk/~www_pa/Scot...o/electron.htm
Audio Misc http://www.st-and.demon.co.uk/AudioMisc/index.html
Armstrong Audio http://www.st-and.demon.co.uk/Audio/armstrong.html
Barbirolli Soc. http://www.st-and.demon.co.uk/JBSoc/JBSoc.html
  #16 (permalink)  
Old August 8th 05, 09:06 AM posted to uk.rec.audio
Jim Lesurf
external usenet poster
 
Posts: 3,051
Default Audio resampler quality

In article , John Phillips
wrote:
On 2005-08-07, Jim Lesurf wrote:

[snip]

An example (190kbyte GIF): http://www.mainly.me.uk/resampling/alias.gif


Not yet had a chance to look at the above, but hope to do so later today.

The image is of two 512-point FFT spectrograms (made by Audacity) of 1.
The frequency sweep input (100 Hz/second, 48 kHz sampled). 2. The
re-sampled output from "resample-1.7" (44.1 kHz sampled).


FWIW I would personally tend to regard 512 points to be rather a small time
interval if you want detailed results. When doing analysis myself I tend to
prefer 8k - 64k ranges. 512 points may give poor resolution and be ridden
with end-effect or Gibbs oscillations, depending on the windowing
(apodizing).

[snip]

However, the peak running below and parallel to the sweep is
interesting. At an input frequency of, say, 21 kHz (time = 3'30'') there
should be no aliasing from the resampler (I think). However there is a
peak on the output at about 17 kHz as well as the expected peak at 21
kHz.


Is this aliasing or another anharmonic artefact?


Not sure. Need to look at the spectrum. Also, ideally, need to know
exactly how both the conversion and the 'spectrum' are produced. Might be
some other problem.

It's almost as if the 21 kHz input is aliased (mirrored) around 24 kHz
to somehow give 27 kHz, which is then aliased (mirrored) around 22.05
kHz to give 17.1 kHz. Could that happen with aliasing on an upsampling
stage before downsampling? If so, I suspect aliasing from a resampler
could be more complex than I first thought.


In principle you can get:

1) Spurious output at almost any integer relationship fout = m*fsig +/-
m*fsample1 +/- k*fsample2. Pick and mix your own values for m,n,k... :-)
The reason being that sampling/resampling are essentially like
phase-coherent multipliers or mixers.

2) Can also get 'end effects' if the resampling method uses a finite range.
(Which is hard to avoid in reality.) This is a result of how input values
come 'in and out of scope' of the process that works out the output
values. This can affect the relative sizes of components produced by (1).

Done 'correctly' no such problems will arise. But 'correctly' may be
impractical. In principle, each individual output point can be computed
from using *all* the input points with a sinc weighting. However doing this
for every individual output point (or FFTing the entire set in a oner to do
this in parallel!) may be slow or 'difficult' on most computers :-)

Hence in practice, once you get large data series, we have to use methods
that are 'good enough'.

Slainte,

Jim

--
Electronics http://www.st-and.ac.uk/~www_pa/Scot...o/electron.htm
Audio Misc http://www.st-and.demon.co.uk/AudioMisc/index.html
Armstrong Audio http://www.st-and.demon.co.uk/Audio/armstrong.html
Barbirolli Soc. http://www.st-and.demon.co.uk/JBSoc/JBSoc.html
  #17 (permalink)  
Old August 8th 05, 11:34 AM posted to uk.rec.audio
Arny Krueger
external usenet poster
 
Posts: 3,850
Default Audio resampler quality

"John Phillips" wrote
in message
On 2005-08-06, Arny Krueger wrote:
"John Phillips" wrote
in message

I am preparing to resample a lot of audio files from 48
kHz sample rate to 44.1 kHz. There are many freely
available re-sampling utilities and I am trying to
select the "best" one to use (I actually have at least
six from which to choose).

I have created a 48 kHz-sampled test file that sweeps a
sine wave from
0.0 Hz to 23.999 kHz over 23.999 seconds. I am looking
at the 44.1 kHz resampled result for:
- best flatness over at least 0.0 Hz to 20.0 kHz;
- least aliasing above 22.05 kHz; and
- minimum execution time (not really that important)


I assume these are the relevant issues. Have I got this
wrong or missed anything important?


Yes, you missed a critical parameter, dynamic range.


I'm not sure precisely how to do a test for dynamic
range. If I feed a WAVE file of silence into any of the
resampling programs I get silence out (no noise even).


That would be a signal-to-noise test. Not the same as a
dynamic range test.

Could you clarify with an example? Is the issue the
noise floor from rejected inputs 22.05 kHz?


Something like that.

The classic test for dynamic range is to measure pass a
clean -60 dB signal at say 1 KHz, null or notch it out, and
measure whatever is left over.


You also missed a free, easy-to-use tool, the Audio
Rightmark.


When I looked that seemed to test sound cards, not
resampling software.


Resampling and sound cards are the same basic problem.

Also it seems to be Windows-only - I
couldn't find a version for Linux (which is what I run
here). Perhaps I didn't look hard enough?


Perhaps you ought to retain some capability to be
mainstream.


  #18 (permalink)  
Old August 8th 05, 01:06 PM posted to uk.rec.audio
John Phillips
external usenet poster
 
Posts: 294
Default Audio resampler quality

On 2005-08-08, Arny Krueger wrote:
"John Phillips" wrote
in message
On 2005-08-06, Arny Krueger wrote:

That would be a signal-to-noise test. Not the same as a
dynamic range test.


Presumably also useful to know in re a resampler?

Could you clarify with an example? Is the issue the
noise floor from rejected inputs 22.05 kHz?


Something like that.

The classic test for dynamic range is to measure pass a
clean -60 dB signal at say 1 KHz, null or notch it out, and
measure whatever is left over.


OK ...

You also missed a free, easy-to-use tool, the Audio
Rightmark.

Also it seems to be Windows-only ...


Perhaps you ought to retain some capability to be
mainstream.


I do (and I do have RMAA 5.5 installed - still trying to find out how
some bits work) but I do like to be able to look "under the hood" for
some certainty about how things operate.

--
John Phillips
  #19 (permalink)  
Old August 8th 05, 03:59 PM posted to uk.rec.audio
Arny Krueger
external usenet poster
 
Posts: 3,850
Default Audio resampler quality

"John Phillips" wrote
in message
On 2005-08-08, Arny Krueger wrote:
"John Phillips" wrote
in message

On 2005-08-06, Arny Krueger wrote:

That would be a signal-to-noise test. Not the same as a
dynamic range test.


Presumably also useful to know in re a resampler?


Yes. Adding excessive background noise is one of those
things that a resampler could do.

Could you clarify with an example? Is the issue the
noise floor from rejected inputs 22.05 kHz?


Something like that.

The classic test for dynamic range is to measure pass a
clean -60 dB signal at say 1 KHz, null or notch it out,
and measure whatever is left over.


OK ...

You also missed a free, easy-to-use tool, the Audio
Rightmark.
Also it seems to be Windows-only ...


Perhaps you ought to retain some capability to be
mainstream.


I do (and I do have RMAA 5.5 installed - still trying to
find out how some bits work) but I do like to be able to
look "under the hood" for some certainty about how things
operate.


In the case of RMA 5.5 and earliser versions, a total
suspension of disbelief is not indicated. However, it does
provide a very thorough quick test. If you have any specific
questions, I might be able to help.



  #20 (permalink)  
Old August 8th 05, 05:17 PM posted to uk.rec.audio
John Phillips
external usenet poster
 
Posts: 294
Default Audio resampler quality

On 2005-08-08, Arny Krueger wrote:
"John Phillips" wrote
in message
... I do have RMAA 5.5 installed - still trying to
find out how some bits work ...


In the case of RMA 5.5 and earliser versions, a total
suspension of disbelief is not indicated. However, it does
provide a very thorough quick test. If you have any specific
questions, I might be able to help.


It seems easy enough but:

To test a resampler I generate the 48 kHz 16 bit test .wav, run
it through the resampler and read it back into RMAA (now as a 44.1 kHz
16 bit .wav). I always get "test waveform was not recorded correctly"
or something like that.

Comparing the original test files (44.1 and 48 k) I'm not surprised.
They have sections of different length so I suspect a re-sampled 48k file
does not look sufficiently like the 44.1k file for success. If that's
not the way to test a re-sampler I would be happy to be put right.

BTW I ignored the -1 dBFS peak calibration .wav as I have not discovered
what needs to be calibrated to what.

--
John Phillips
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:31 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.SEO by vBSEO 3.0.0
Copyright ©2004-2025 Audio Banter.
The comments are property of their posters.