3 ms·
Sampling does not lose information below the Nyquist limit, but quantization does introduce errors that can't be fixed. And resampling at a different rate might
by pxndxx 9mo ago
Sampling does not lose information below the Nyquist limit, but quantization does introduce errors that can't be fixed. And resampling at a different rate might introduce extra errors, like when you recompress a JPEG.
- brudgers 9mo agoIn the audio world, quantization is usually discussed in terms of bit-depth rather than sample rate.
- mort96 9mo agoYeah, they know and their comment reflects that knowledge. They're saying that if we had infinite bit depth, we could arbitrarily resample anything to anything as long as the sample rate is above the Nyquist frequency; however we don't have an infinite bit depth, we have a finite bit depth (i.e the samples are quantized), which limits the dynamic range (i.e introduces noise). This noise can compound when resampling.
- adgjlsfhk1 9mo agoThe key point is that even with finite bit depth (as long as you dither properly), the effect of finite bit depth is easily controlled noise of program chosen spectrum. i.e. as long as your sampling isn't doing anything really dumb, the noise introduced by sampling is well below noise floor.
- pxndx 9mo agoYeah, but that noise keeps compounding every time you resample.
- adgjlsfhk1 9mo agoSure, but you will resample ~5 times max.
- mort96 9mo agoI've been trying to figure out whether this is true or not, and I've only been able to find that it doesn't compound: the noise from the original quantization and the noise from the second (post-resample) quantisation aren't independent, both arise from rounding the data to the same 16-bit grid. Somehow, this seems to mean the noise doesn't compound. I wish I understood this better and at least knew whether it's true or false. I have to do more reading on it.
- dietr1ch 9mo agoI see I lose data on the [18kHz..) range, but at the same time as a male I'm not supposed to hear that past in my early 30s, sprinkle concerts on top and make it more like 16kHz :/ At least I don't have tinnitus. Here's my test, ```fish set -l sample ~/Music/your_sample_song.flac # NOTE: Maybe clip a 30s sample beforehand set -l borked /tmp/borked.flac # WARN: Will get overwritten (but more likely won't exist yet) cp -f $sample $borked for i in (seq 10) echo "$i: Resampling to 44.1kHz..." ffmpeg -i $borked -ar 44100 -y $borked.tmp.flac 2>/dev/null mv $borked.tmp.flac $borked echo "$i: Resampling to 48kHz..." ffmpeg -i /tmp/borked.flac -ar 48000 -y $borked.tmp.flac 2>/dev/null mv $borked.tmp.flac $borked end echo "Playing original $sample" ffplay -nodisp -autoexit $sample 2>/dev/null echo "Playing borked file $borked" ffplay -nodisp -autoexit $borked 2>/dev/null echo "Diffing..." set -l spec_config 's=2048x1024:start=0:stop=22000:scale=log:legend=1' ffmpeg -i $sample -lavfi showspectrumpic=$spec_config /tmp/sample.png -y 2>/dev/null ffmpeg -i $borked -lavfi showspectrumpic=$spec_config /tmp/borked.png -y 2>/dev/null echo "Spectrograms," ls -l /tmp/*.spec.png ```