PCM Resampling
Reply #14 – 2005-10-23 15:49:14
I read coefficients are values which modify sample values in time (or other dimension) compounding expression types. The term seems generic for polynomial and series type's 'calibratable variables' The order of a filter, is the number of samples used in its expression. The name/type of a filter eg FIR IIR is a theoreticaly backed up handle (im wary of adopting) on the low level expression types nature and useability. Zero padding introduces a weird harmonic~ish pattern to sample ,which partialy negates itself out or is removed fully by lowpassing (?) ..single order Zero stuffing would be like frequency modulation.. -its not an immediately accessible idea to me. I fiddled about to write a ~slightly more refined lowlevel sample converter method. public short[] resample(short[] inWv, int inWvFq, int oWvFq, int strt, int fnsh) { short[] OutWv=new short[fnsh-strt]; //care in bounding these params to inWv array, both pcm series have to coincide at start=0. //This method can be used to return chunks of resampled output in sequence //or strt and fnsh must be precalculated to map OutWv against inWv. //inWvFq =11; oWvFq =8; or scale these to lessen dither strength int tdither/*timeditherer*/ , rnddith/*ditherStartRandomiser*/; tdither=0; rnddith=(int)Math.random(60); for(int tiOutWv=strt; tiOutWv<fnsh; tiOutWv++) //TimeIndexofOutWaveArray { inWvTrgt=tiOutWv*inWvFq-tdither; //TargetIndexofInwavArray OutWv[tiOutWv-strt]= (short) ( inWv[ inWvTrgt/oWvFq ] *(oWvFq-(inWvTrgt %oWvFq))/oWvFq +inWv[1+inWvTrgt/oWvFq ] * (inWvTrgt %oWvFq) /oWvFq ); tdither=((rnddith+tiOutWv*207)&(tiOutWv*203))%3; } return OutWv; }//end method Not sure how this would sound yet, since im stuck elsewhere on trying to use most efficiently a FileInputStream which seems unwilling to be left open outside its 'try' statement I suspect the dither could do with being scaled down, and a craftier derivation. Not sure about the byquading, cant see how to jam it into the loop straight away. Would you say it would improve things - maybe high freqs are already fudged beyond improvement by the time dithering and '~1.5 order averaging' done. [span style='font-size:8pt;line-height:100%']edit: might almost work now[/span]