Reply by Erik de Castro Lopo November 3, 20042004-11-03
Tim Wescott wrote:
> > ggabe wrote: > > > There's a 8KHz audio sample rate I want to convert up to 44.1KHz > > sample rate. What's the right approach to keep Mr. Nyquist happy? > > No one's mentioned Secret Rabbit Code for sample rate conversion. I > haven't tried it, but from the web site it looks like good stuff.
Actually, I pretty sure I mentioned it (see my email address below) :-). Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "Always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live." -- Martin Golding
Reply by Jim Thomas November 3, 20042004-11-03
Stephan M. Bernsee wrote:
> On 2004-11-03 14:39:31 +0100, Jim Thomas <jthomas@bittware.com> said: > >> ...then you might consider converting 8KHz to 44.0KHz instead of to >> 44.1K. This will shift the frequencies down, > > > Just some nit picking: it will actually *scale* the frequencies. It will > shift the pitch...
Yes. I think the only advantage this offers though is that it requires less memory for the the filter coefficients. Using the standard multirate filtering tricks (don't multiply by zero, and don't calculate samples that will be discarded), the processing time should be about the same. These days, reduced memory is not much of an advantage. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world - Calvin
Reply by George Bush November 3, 20042004-11-03
If the data sample isn't too long, you might try "Perfect Interpolation".

In article <10ohv6pln7psi4a@corp.supernews.com>, Tim Wescott 
<tim@wescottnospamdesign.com> wrote:
>ggabe wrote: > >> There's a 8KHz audio sample rate I want to convert up to 44.1KHz >> sample rate. What's the right approach to keep Mr. Nyquist happy? > >No one's mentioned Secret Rabbit Code for sample rate conversion. I >haven't tried it, but from the web site it looks like good stuff. >
Reply by Tim Wescott November 3, 20042004-11-03
ggabe wrote:

> There's a 8KHz audio sample rate I want to convert up to 44.1KHz > sample rate. What's the right approach to keep Mr. Nyquist happy?
No one's mentioned Secret Rabbit Code for sample rate conversion. I haven't tried it, but from the web site it looks like good stuff. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Reply by Stephan M. Bernsee November 3, 20042004-11-03
On 2004-11-03 14:39:31 +0100, Jim Thomas <jthomas@bittware.com> said:

> ...then you might consider converting 8KHz to 44.0KHz instead of to > 44.1K. This will shift the frequencies down,
Just some nit picking: it will actually *scale* the frequencies. It will shift the pitch... -- Stephan M. Bernsee http://www.dspdimension.com
Reply by Jim Thomas November 3, 20042004-11-03
Rob Vermeulen wrote:
> Erik, > >>Sorry, thats just plain bad advice. > > I'd figured that out already, by reading the other advices :)
If you're strapped for processing resources, and if you are processing off-line data (that is, the sample rate converter is not between an A/D and a D/A - for example, you could be streaming A/D to disk), then you might consider converting 8KHz to 44.0KHz instead of to 44.1K. This will shift the frequencies down, but for the typical 8K-sampled signal (voice), the shift will not likely be noticed. I dunno how it might affect modulated signals (i.e., fax/modems) but even that might be able to tolerate the frequency shift. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world - Calvin
Reply by Rob Vermeulen November 3, 20042004-11-03
Erik,

> Sorry, thats just plain bad advice.
I'd figured that out already, by reading the other advices :)
> "The day Microsoft makes something that doesn't suck is probably the > day they start making vacuum cleaners." -- Ernst Jan Plugge
Nice ;-)
Reply by Jon Harris November 2, 20042004-11-02
"Stephan M. Bernsee" <spam@dspdimension.com> wrote in message
news:2uosmgF2cs5f1U2@uni-berlin.de...
> On 2004-11-02 07:43:41 +0100, Erik de Castro Lopo <nospam@mega-nerd.com> said: > > Our perception usually prefers *any* kind of energy over zero energy at > a certain band, most likely because zero energy at a certain frequency > rarely happens in nature. When you are upsampling from 8kHz to 44.1kHz > you get a very large area that contains (almost) no energy which tends > to sound "unnatural" and "dead" to a listener when using hi-end > reproduction. Linear interpolation will add some noise which might > sound more natural, even though it isn't "politically correct" from the > DSP viewpoint.
That is an interesting perspective, Stephan. I hadn't thought of that myself. I'll have to listen both ways and see if it makes any difference. I suppose an alternative would be to use "good" interpolation, but then generate some artificial high frequency content by either adding band-limited noise or using some type of "harmonic exciter" algorithm. But maybe the linear interpolation method accomplishes a similar thing very cheaply?
Reply by David Kirkland November 2, 20042004-11-02
From a signal processing point of view, I would use the standard interpolation 
(with Low Pass filter) to get to  40 kHz, and then use linear interpolation.

As memory serves the Sinc Interpolation is not optimal in any sense, and except 
for Kaiser windows you don't really have any control over the dB ripple, 
attenaution or transition width. Atleast with the Parks McClellan algorithm you 
get some optimality.

By upsampling first, you leave the frequency content at the lower frequencies, 
and you put yourself in position to get the best out of the linear 
interpolation.

You can of course go to higher frequencies first, and then use the linear 
interpolation. This improves the Lin. Interp. part but at the cost of increased 
complexity in the regular dsp interpolation (pad and filter).

Cheers,
David
"Stephan M. Bernsee" <spam@dspdimension.com> wrote in message 
news:2uosmgF2cs5f1U2@uni-berlin.de...
> On 2004-11-02 07:43:41 +0100, Erik de Castro Lopo <nospam@mega-nerd.com> said: > >> Sorry, thats just plain bad advice. >> >> Linear interpolation can provide reasonable results if the >> highest frequency component is 1/4 of the sample frequency >> or less. However, for audio sampled at 8kHz this is unlikey >> to be the case. In fact it is likey to have a large amount >> of energy in the 2-4kHz band and its this band where linear >> interpolation performs worst. >> >> Erik > > I concur with Erik and Jon that the use of zero order hold interpolation and > linear interpolation isn't a wise thing from the technical perspective. The > best option would be a sinc interpolation or at least a reasonably long FIR > approximation of it. > > However, in defense of what Rob said, I would agree with him that due to the > artifacts introduced when improperly upsampling a signal from 8kHz to 44.1kHz > it may be perceptually better to use linear interpolation in that specific > case. > > Our perception usually prefers *any* kind of energy over zero energy at a > certain band, most likely because zero energy at a certain frequency rarely > happens in nature. When you are upsampling from 8kHz to 44.1kHz you get a very > large area that contains (almost) no energy which tends to sound "unnatural" > and "dead" to a listener when using hi-end reproduction. Linear interpolation > will add some noise which might sound more natural, even though it isn't > "politically correct" from the DSP viewpoint. > -- > Stephan M. Bernsee > http://www.dspdimension.com >
Reply by Stephan M. Bernsee November 2, 20042004-11-02
On 2004-11-02 07:43:41 +0100, Erik de Castro Lopo <nospam@mega-nerd.com> said:

> Sorry, thats just plain bad advice. > > Linear interpolation can provide reasonable results if the > highest frequency component is 1/4 of the sample frequency > or less. However, for audio sampled at 8kHz this is unlikey > to be the case. In fact it is likey to have a large amount > of energy in the 2-4kHz band and its this band where linear > interpolation performs worst. > > Erik
I concur with Erik and Jon that the use of zero order hold interpolation and linear interpolation isn't a wise thing from the technical perspective. The best option would be a sinc interpolation or at least a reasonably long FIR approximation of it. However, in defense of what Rob said, I would agree with him that due to the artifacts introduced when improperly upsampling a signal from 8kHz to 44.1kHz it may be perceptually better to use linear interpolation in that specific case. Our perception usually prefers *any* kind of energy over zero energy at a certain band, most likely because zero energy at a certain frequency rarely happens in nature. When you are upsampling from 8kHz to 44.1kHz you get a very large area that contains (almost) no energy which tends to sound "unnatural" and "dead" to a listener when using hi-end reproduction. Linear interpolation will add some noise which might sound more natural, even though it isn't "politically correct" from the DSP viewpoint. -- Stephan M. Bernsee http://www.dspdimension.com