#39102 - ProblemBaby - Mon Apr 04, 2005 4:04 pm
If I have a WAV-file at 31536hz.
would it be possible to just save each fourth point and then somehow recreate the Wave so it sounds like 32khz and not 8khz
Ive tried to do a linear interpolation but it doesnt sound that good, does it exist more accurate methods cause this case isnt fun to hear :D
_
/ \
/ \
*p1 *p2
Result:
*p1-----*p2
#39109 - ampz - Mon Apr 04, 2005 5:14 pm
ProblemBaby wrote: |
If I have a WAV-file at 31536hz.
would it be possible to just save each fourth point and then somehow recreate the Wave so it sounds like 32khz and not 8khz
Ive tried to do a linear interpolation but it doesnt sound that good, does it exist more accurate methods cause this case isnt fun to hear :D |
What is the frequency content of the wav file?
If there are frequencies in the wav file above 3-4kHz then what you are asking is obviously impossible.
However, if the frequency content of the wav file is all below 3kHz (or even better: below 2kHz), then it can be done.
Frequency content below 2kHz should sound decent with just linear interpolation.
#39112 - serf - Mon Apr 04, 2005 5:42 pm
Don't downsample and then upsample: not only will you lose all of your high frequencies, but you'll introduce more noise than necessary.
Are you trying to resample in real time? Or can it all happen offline? If you're trying to do this in real time, or for multiple samples at once, some kind of low-order polynomial or spline interpolation might be best (Hermite interpolation seems to be a popular one). If you have more time and resources, windowed sinc interpolation will give you better sounding results.
info on windowed sinc resampling
music-dsp source code archive (plenty of interpolation examples in the "other" category)
edit: By "multiple samples" above, I mean samples as in "short audio files," not as in "instantaneous values of a signal"....
Last edited by serf on Mon Apr 04, 2005 5:49 pm; edited 1 time in total
#39113 - ProblemBaby - Mon Apr 04, 2005 5:43 pm
I dont understand your question exactly but the reason to why it is 31536 is that my mixer runs at that speed and the Sounds use the whole frequency spectrum or what it is called.
#39114 - ampz - Mon Apr 04, 2005 6:04 pm
ProblemBaby wrote: |
I dont understand your question exactly but the reason to why it is 31536 is that my mixer runs at that speed and the Sounds use the whole frequency spectrum or what it is called. |
The sounds use the whole spectrum from 0-15kHz? Then no, it cannot be downsampled without huge losses.
#39146 - tepples - Tue Apr 05, 2005 4:23 am
Are you trying to use downsampling as a crude form of lossy audio compression? If so, there exist other lossy audio codecs that sound better at a given bitrate. Investigate some form of ADPCM, GSM 06.10, or something custom.
That said, someone seems to think nearest-neighbor resampling sounds better than linear interpolation in some cases. There's a thread in Pocket Heaven about this issue; start here.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#39159 - ProblemBaby - Tue Apr 05, 2005 7:47 am
My dream for the future was to implement it in my Mixer.
serf: Thanks for the info, It was very interesting but I couldn't make it sound a lot better=/
tepples: Thanks, I'll check it out
One question though: Nearest Neighbor, how does that work with audio? I cant find any good info.
#39167 - yannis - Tue Apr 05, 2005 2:40 pm
You are assuming the difference between your first point and next point is exactly linear.
What you are trying to do is interpolate data between two points which is a form of error correction. Doing this will create quantization distortion.
It will sound MUCH worse for 8bit than 16bit too as you are interpolating between extreme values 0-255 rather than 0-65535.
_________________
DS & GBA Audio Professional
www.GroovyAudio.com
#39172 - tepples - Tue Apr 05, 2005 3:07 pm
Nearest neighbor is just sample and hold. Just keep outputting one sample until it's time for the next sample. It makes sense for some waves but less sense for other waves; if you make a mixer with both linear and nearest neighbor resampling, that will give your mixer much more flexibility.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#39174 - ProblemBaby - Tue Apr 05, 2005 3:44 pm
I listened to the sound example in the other post and heard the differnece.
But I cant understand how thats possible cause it should be exactly the same if I just hold the sample, right?
at 2 hz
12
at 4hz
1122
wouldnt that sound exactly the same??
thanks in advance
#39186 - ampz - Tue Apr 05, 2005 7:50 pm
ProblemBaby wrote: |
wouldnt that sound exactly the same?? |
Depends on the hardware.
If the DAC output has adjustable low pass filters (where the filter frequency is automatically adjusted to half the sample frequency), then it would NOT sound the same. But if the output has fixed low pass filters then it would indeed sound the same.
#39193 - tepples - Tue Apr 05, 2005 8:49 pm
The GBA DAC output has what appears to be a fixed band-pass filter.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#39200 - ampz - Tue Apr 05, 2005 10:34 pm
tepples wrote: |
The GBA DAC output has what appears to be a fixed band-pass filter. |
Why band pass?
EDIT
Sorry, stupid question.
There is probably a series capacitor on the output to eliminate any DC offset. That capacitor works like a high-pass filter.
low-pass + high-pass == band-pass