Subject: Re: Proposal: Audio: Sampling rate conversion
To: Lennart Augustsson <lennart@augustsson.net>
From: Wojciech Puchar <wojtek@chylonia.3miasto.net>
List: tech-kern
Date: 03/04/2002 18:06:44
> Subject: Re: Proposal: Audio: Sampling rate conversion
>
> This is probably a reasonable compromise for going in to the
> kernel since it is efficient. It leads to rather poor audio
> quality though, so we might consider more complicated filters
> in the future.
in case of 44100=>48000 or 48000=>44100 you wan't probably hear the
difference as average adult can't hear more than 16kHz.
but in case of 8000=>44100 or 8000=>48000 it would sound terrible!!!!!
for example 1000Hhz sound with produce mix of 1000,5000,9000,13000,17000
and 21000 Hz sound. and you WILL hear it.
for extrapolation i would do:
unsigned long tmp;
unsigned tmp2,tmp3;
for(i=something;i<something_else;i++) {
tmp=i*srcfreq;
tmp2=tmp%dstfreq
tmp3=tmp/dstfreq;
output[i]=(((long)input[tmp3]*(dstfreq-tmp2))+((long)input[tmp3+1]*tmp2))/dstfreq
}
i wish i didn't do any mistake. this will produce simple linear
extrapolation of input which won't remove artifact but will make it
much softer.
on pentium-II/III/IV CPUs (where such devices are most common found)
multiply is single-cycle, divide less than 4 cycles so CPU load should not
be noticable.