7 ms·
> it's probably worth avoiding the resampling of 44.1 to 48 kHz Ehhm, yeah, duh? You don't resample unless there is a clear need, and even then you don't upsam
by ZeroConcerns 8mo ago
> it's probably worth avoiding the resampling of 44.1 to 48 kHz
Ehhm, yeah, duh? You don't resample unless there is a clear need, and even then you don't upsample and only downsample, and you tell anyone that tries to convince you otherwise to go away and find the original (analog) source, so you can do a proper transfer.
- mort96 8mo agoIf only it was that simple T_T I'm working on a game. My game stores audio files as 44.1kHz .ogg files. If my game is the only thing playing audio, then great, the system sound mixer can configure the DAC to work in 44.1kHz mode. But if other software is trying to play 48kHz sound files at the same time? Either my game has to resample from 44.1kHz to 48kHz before sending it to the system, or the system sound mixer needs to resample it to 48kHz, or the system sound mixer needs to resample the other software from 48kHz to 44.1kHz. Unless I'm missing something?
- mort96 8mo agoAnd actually, why do we have both 48kHz and 44.1kHz anyway? If all "consumer grade high quality audio" was in 44.1kHz (or 48kHz) we probably could've avoided resampling in almost all circumstances other than professional audio contexts (or for already low quality audio like 8kHz files). What benefit do we get out of having both 44.1 and 48 that outweighs all the resampling it causes?
- deleted 8mo ago[deleted]
- zamadatix 8mo agoAs far as I understood, both rates ultimately come from trying to map to video standards of the time. 44.1 kHz mapped great to reusing analog tape of the time, 48 kHz mapped better to digital clocking and integer multiples of video standards while also having a slightly wider margin on oversampling the high frequency. 44.1 kHz never really went away because CDs continued using it, allowing them to take any existing 44.1 kHz content as well as to fit slightly more audio per disc. At the end of the day, the resampling between the two doesn't really matter and is more of a minor inconvenience than anything. There are also lots of other sampling rates which were in use for other things too.
- CharlesW 8mo ago> And actually, why do we have both 48kHz and 44.1kHz anyway? Those two examples emerged independently, like rail standards or any number of other standards one can cite. That's really just the top of the rabbit-hole, since there are 8-20 "standard" audio sample rates, depending how how you count. This isn't really a drawback, and it does provide flexibility when making tradeoffs for low bitrates (e.g. 8 kHz narrowband voice is fine for most use cases) and for other authoring/editing vs. distribution choices.
- sneak 8mo agoCDs used 44.1, DAT and DVDs used 48. That’s it. Most stuff on the internet ripped from CD is 44.1. 48 is getting more common. We’re like smack in the middle of the 75 year transition period to 48kHz. For new projects, I use 48, because my mics are 32bit (float!)/48kHz.
- brudgers 8mo agoPerhaps the benefit we get is access to existing recordings? 44.1khz exists because it was the lowest technically practical speed and was an optimization for processing speed and storage space. 48khz exists because it syncs with video easily — I’ve also heard it allows for more tolerance in the anti-aliasing filter.
- cormorant 8mo ago> 48khz exists because it syncs with video easily I guess meaning 24fps video? Because 44100 is already a multiple of 25, 30, 50, and 60.
- adgjlsfhk1 8mo ago48k also supports 24, 48, 120, and 240 which are all nice to haves.
- brudgers 8mo ago24fps is where the money is because 24fps is the standard for film.
- PunchyHamster 8mo agotechnically we could use 40kHz and just upsample, the extra frequency over 40kHz is basically leeway to make analog part possible/cheap, but it is not technically needed in the signal the first CD player didn't had compute power to upsample perfectly but modern devices certainly do.
- mort96 8mo agoAFAIU, 40kHz exactly wouldn't really work, if your goal is to represent 0Hz-20kHz: in order to avoid aliasing, you need a low pass filter to remove all frequency content above half your sample rate, and no filter is infinitely hard (and you generally want to give the filter a decent range of frequencies to work with). If you want to start your low pass filter at 20kHz, you want it to end (i.e reach practically -∞dB) at a few kHz above 20kHz. If you used a sample rate of exactly 40kHz, you would need your low pass filter to reach -∞dB at 20kHz, meaning it'd have to start somewhere in the audible region. Though this is just my understanding. Maybe I'm wrong.
- rerdavies 8mo ago> Why do we have both 48kHz and 44.1kHz anyway Because of greed. Early audio manufacturers (SONY notably) used 48kHz for profession-grade audio equipment, that would be used in studios or TV stations, and degraded 44.1khz audio for consumer devices. Typically you would pay an order of magnitude more for the 48kHz version of the hardware. 48khz is better for creating and mixing audio. You cannot practically mix audio at 44.1khz without doing very slight damage to audible high frequencies. But enough to make a difference. If you were creating for consumer devices, you would mix at 48Khz, and then downsample to 44.1khz during final mastering, since conversion from 48kHz to 44.1kHz can be done theoretically (and practically) perfectly. (Opinions of the OP notwithstanding). I think it's safe to say that the 44.1kHz sampling rate was maliciously selected specifically because it is just low enough that perfect playback is still possible, but perfect mixing is practically not possible. And obviously maliciously chosen to be a rate with no convenient greatest common denominator with 48Khz, which would have allowed easy and cheap perfect realtime resampling. Had Sony chose 44.0kHz, it would be trivially easy to do sample rate conversion to 48Khz in realtime even with primitive hardware available in the late 1970s. That extra .1kHz is transparently obvious malice and greed in plain sight. Presumably SONY would sell you the software or hardware to perform perfect non-realtime conversion of audio from 48khz to 44.1khz for a few tens of thousands of dollars. Not remotely subtle how greedy all of this was. There has been no serious reason to use 44.1kHz instead of 48kHz for about 50 years, at least from a technology point of view. (And no real reason to EVER use 44.1khz instead of 48kHz other than GREED).
- brendyn 8mo agoAre you able to share evidence for this?
- rerdavies 8mo agoWhat would you consider evidence? Emails between standards committee members agreeing to collude in order to screw pro-audio customers? The evidence is: why on earth would anyone on a standards committee choose 44.1kHz, instead of 44.0kHz? The answer: 44.1kHz was transparently obviously chosen to make it impossible to perform on-the-fly rate conversions. The mathematics of polyphase rate converters was perfectly well understood at the time these standards were created.
- zamadatix 8mo agoThat's a clear need IMO, but it'd be slightly better if the game could have 48 kHz audo files and downsampled them to 44.1 kHz playback than the other way around (better to downsample than upsample).
- adgjlsfhk1 8mo agoThey're both fine (as long as the source is band limited to 20khz which it should be anyway).
- adrian_b 8mo agoThe analog source is never perfectly limited to 20 kHz because very steep filters are expensive and they may also degrade the signal in other ways, because their transient response is not completely constrained by their amplitude-frequency characteristic. This is especially true for older recordings, because for most newer recordings the analog filters are much less steep, but this is compensated by using a much higher sampling frequency than needed for the audio bandwidth, followed by digital filters, where it is much easier to obtain a steep characteristic without distorting the signal. Therefore, normally it is much safer to upsample a 44.1 kHz signal to 48 kHz, than to downsample 48 kHz to 44.1 kHz, because in the latter case the source signal may have components above 22 kHz that have not been filtered enough before sampling (because the higher sampling frequency had allowed the use of cheaper filters) and which will become aliased to audible frequencies after downsampling. Fortunately, you almost always want to upsample 44.1 kHz to 48 kHz, not the reverse, and this should always be safe, even when you do not know how the original analog signal had been processed.
- PunchyHamster 8mo agoyeah but you can record it in 96kHz, then resample it perfectly to 44.1 (hell, even just 40) in digital domain, then resample it back to 48kHz before sending to DAC
- adrian_b 8mo ago
- zipy124 8mo agoyou're not missing something. You can re-sample them safely as stated by the author. They simply state you should check the re-sampler as: > Although this conversion can be done in such a way as to produce no audible errors, it's hard to be sure it actually is. That is, you should verify the re-sampler you are using or implement yourself in order to be sure it is done correctly, and that with todays hardware it is easily possible.
- Veliladon 8mo agoGetting pristine resampling is insanely expensive and not worth it. If you have a mixer at 48KHz you'll get minor quantization noise but if it's compressed already it's not going to do any more damage than compression already has.
- ZeroConcerns 8mo agoDAC frequency and the audio format requirements for whatever you supply to your platform audio API have literally nothing to do with each other. My reply was from an audio mastering perspective.
- Joeboy 8mo ago> Unless I'm missing something? I suppose the option you're missing is you could try to get pristine captures of your samples at every possible sample rate you need / want to support on the host system.
- zelphirkalt 8mo agoIs this not the job of the operating system or its supporting parts, to deal with audio from various sources? It should not be necessary to inspect the state of the OS your game is running on, to know what kind of audio you can playback. In fact, that could even be considered spying on things you shouldn't. Maybe the OS or its sound system does not abstract that from you and I am wrong about the state of OS in reality, but this seems to me like a pretty big oversight, if true. If I extrapolate from your use-case, then that would mean any application performing any playback of sound, needs to inspect whether something else is running on the system. That seems like a pretty big overreach. As an example, lets say I change frequency in Audacity and press the play button. Does Audacity now go and inspect, whether anything else on my system is making any sound?
- Joeboy 8mo ago> Is this not the job of the operating system or its supporting parts, to deal with audio from various sources I think that's the point? In practice the OS (or its supporting parts) resample audio all the time. It's "under the hood" but the only way to actually avoid it would be to limit all audio files and playback systems to a single rate.
- zelphirkalt 8mo agoI don't understand then, why they need to deal with that when making a game, unless they are not satisfied with the way that the OS resamples under the hood.
- adzm 8mo agoYou are right; the system sound mixer should handle all resampling unless you explicitly take exclusive control of the audio device. On Windows at least, this means everything generally gets resampled to 48khz. If you are trying to get the lowest latency possible, this can be an obstacle... on the order of single digit milliseconds.
- bob1029 8mo agoIf 44.1kHz is otherwise sufficient but you have a downstream workflow that is incompatible, there are arguments for doing this. It can be done with no loss in quality. From an information theory perspective, this is like putting a smaller pipe right through the middle of a bigger one. The channel capacity is the only variable that is changing and we are increasing it.
- anonymars 8mo agoThis isn't the whole picture because they aren't multiples of each other, so there will be interpolation/jitter For example if you watch a 24fps film on a 60fps screen, in contrast to a 120fps screen
- mort96 8mo agoThat's not how audio works. PCM data at some sample rate with infinite precision samples perfectly encodes all the audio data of all frequencies up to half the sample rate. Resampling is a theoretically lossless operation when the frequency content of the audio fits within half the sample rate of both the source and the destination sample rates (which will always be true when resampling to a higher sample rate, FWIW). The issues are that 1) resampling has a performance and latency cost, 2) better resampling has a higher performance and latency cost
- zipy124 8mo agoThat seems a rather shallow - and probably incorrect - reading of the source. This is an efficiency and trust trade off as noted: > given sufficient computing resources, we can resample 44.1 kHz to 48 kHz perfectly. No loss, no inaccuracies. and then further > Your smartphone probably can resample 44.1 kHz to 48 kHz in such a way that the errors are undetectable even in theory, because they are smaller than the noise floor. Proper audio equipment can certainly do so. That is you don't need the original source to do a proper transfer. The author is simply noting > Although this conversion can be done in such a way as to produce no audible errors, it's hard to be sure it actually is. That is that re-sampling is not a bad idea in this case because it's going to have any sort of error if done properly, it's just that the Author notes you cannot trust any random given re-sampler to do so. Therefore if you do need to resample, you can do so without the analog source, as long as you have a re-sampler you can trust, or do it yourself.
- sgerenser 8mo agoSpeaking of a resampler you trust, I’ve had good experience with libsamplerate (http://www.mega-nerd.com/SRC/ http://www.mega-nerd.com/SRC/), which as of 2016 is BSD licensed.
- brudgers 8mo agoA very common clear need is incorporating 44.1khz audio sourcesinto video. 48khz is 48khz because 48khz divided by 24fps, 25fps, or 30fps is an integer (and 44.1khz is not). Also, for decades upsampling on ingest and downsampling on egress has been standard practice for DSP because it reduces audible artifacts from truncation and other rounding techniques. Finally, most recorded sound does not have an original analog source because of the access digital recording has created…youtube for example.