Downsampling Help Needed: Aliasing Prevention

Discussion in 'Working with Sound' started by tommyzai, Feb 12, 2025.

  1. tommyzai

    tommyzai Platinum Record

    Joined:
    Feb 7, 2012
    Messages:
    887
    Likes Received:
    229
    I am trying to convert from 192kHz to 96kHz or possibly 48kHz, but don't want discarded higher frequencies to alias.

    *Any recommendations?
    *Would you recommend using a low-pass filter to remove the unwanted high stuff prior to downsampling?
    *If so, at what frequency should I start removing with the filter?
     
  2.  
  3. Lieglein

    Lieglein Audiosexual

    Joined:
    Nov 23, 2018
    Messages:
    1,049
    Likes Received:
    598
    A proper samplerate converter.
    Can be found here: https://src.infinitewave.ca/

    Yes.

    So that it effectively removes everything above the nyquist frequency but not what is in the audible range of human hearing ~22kHz.
     
  4. tommyzai

    tommyzai Platinum Record

    Joined:
    Feb 7, 2012
    Messages:
    887
    Likes Received:
    229
    I have some users claiming that many of the editors and DAWs have a built-in low pass for the conversion, but . . .
     
  5. xorome

    xorome Audiosexual

    Joined:
    Sep 28, 2021
    Messages:
    1,288
    Likes Received:
    941
    Unless explicitly stated otherwise, every downsampler will automatically filter content past the new Nyquist limit. You'd have to go way out of your way to find one that doesn't by default (-> the depths of hobbyist projects and building blocks intended for developers)
     
    • Agree Agree x 2
    • Like Like x 1
    • Useful Useful x 1
    • List
  6. ItsFine

    ItsFine Rock Star

    Joined:
    Apr 22, 2023
    Messages:
    669
    Likes Received:
    392
    • Like Like x 1
    • Winner Winner x 1
    • Useful Useful x 1
    • List
  7. Xupito

    Xupito Audiosexual

    Joined:
    Jan 21, 2012
    Messages:
    7,409
    Likes Received:
    4,104
    Location:
    Europe
  8. Baxter

    Baxter Audiosexual

    Joined:
    Jul 20, 2011
    Messages:
    3,918
    Likes Received:
    2,759
    Location:
    Sweden
    Just download Voxengo r8brain (which is free) and be done with it. Downsampling is not as crappy and diverse as it was a decade ago. Now everyone pretty much has gotten up to speed code/quality-wise, where Voxengo being one of them and offering great conversion for free.
     
  9. tommyzai

    tommyzai Platinum Record

    Joined:
    Feb 7, 2012
    Messages:
    887
    Likes Received:
    229
    It seems this process is called, "Decimation." Would there be any advantage to manually using a low-pass filter to remove highs that are about the range prior to downsampling?
     
  10. Will Kweks

    Will Kweks Rock Star

    Joined:
    Oct 31, 2023
    Messages:
    660
    Likes Received:
    415
    While I agree that a) there's not much to care about normally, b) testing is good, and c) this is a well done test, it's however testing bit depth and not sample rate, so not really applicable here. Otherwise echoing others here, there will be a lowpass present in resamplers unless you go out of your way to disable one.

    I once coded a downsampler wrong on purpose to see if I could get some interesting aliasing happening but I found out that no, it either sounds like absolute dogshit or it's basically OK with no shittiness happening. Live and learn.
     
    • Like Like x 1
    • Love it! Love it! x 1
    • List
  11. Radio

    Radio Audiosexual

    Joined:
    Sep 20, 2024
    Messages:
    2,375
    Likes Received:
    1,254
    1. A low pass filter to avoid aliasing must be placed before the analog-to-digital conversion.

    2. Downsampling for digital signal processing (also called decimation) is the process of reducing the bandwidth and sample rate of the sampler, which removes some of the original data from the original signal. The process of reducing the sample frequency is often done by reducing the sample rate by an integer factor, keeping only one of every nth samples.

    This is done using a low pass filter, also known as an anti-aliasing filter, to reduce the high frequency/noise components of a discrete-time signal by the integer factor mentioned before.

    3. MP3 has problems mainly with the high frequencies.
    Don't waste bandwidth by using 32 kHz instead of 44.1 kHz. Your song will sound better.

    4. Anti-aliasing (decimation) filtering before downsampling
    https://users.ece.utexas.edu/~bevans/courses/ee381k/lectures/multirate/multirate.pdf

    MP3 encoding

    - Assume the highest possible bit rate and the filters you need.
    MP3 mainly has difficulties with the high frequencies. Don't waste bandwidth with 32 kHz instead of 44.1 kHz. Your song will sound better.

    - Don't overcompress everything with a compressor/limiter. Leave some of the dynamics of the song so that the encoding algorithm has something to work with.

    - Set the encoder to “Best possible quality”. This will allow you to get the best possible results. It takes longer, but it's worth it.

    - Remember: MP3 encoding makes the resulting material slightly hotter than the original mix in most cases Limit the output level of the material intended as MP3 to - 1 dB, instead of the usual -0.1 dB or - 0.2 dB. Avoid digital overloads (overs).

    - A high-quality MP3 encoder is LAME.
    - 160 kbs: The lowest bit rate that is acceptable for files
    - 320 kbs: The highest quality, but shows the largest files, but is hardly distinguishable from a CD.
     
    Last edited: Feb 13, 2025
  12. fiction

    fiction Audiosexual

    Joined:
    Jun 21, 2011
    Messages:
    1,933
    Likes Received:
    706
    Filtering is the job of a good resampler, like the suggested r8brain or sox (commandline).

    Remember that it also depends on what you plan to do with the resampled file. If your audio contains enough high frequencies close to fs/2 at audible amplitudes, this can require a good quality DAC with steep filtering too.
    I would first analyze the audio, then decide which should be the minimum target fs.
    Oh, and not everybody can hear 23kHz btw :guru:
     
  13. poka chip

    poka chip Ultrasonic

    Joined:
    Jun 6, 2022
    Messages:
    68
    Likes Received:
    38
    after seeing this topic i got a question.
    let`s say i got a mixdown at 96 khz samplerate and the last step is to set up an eq with a high cut at 22 khz.
    and then downsample to 44 khz.
    should there be actually any aliasing occur, cause the frequncies above 22 khz has been eliminated before downsampling ?
    i assume there is a clean spectrum between 0 and 22 khz and a downsampling from 96 khz to 44 khz is then nyquest free ?
     
  14. Stevie Dude

    Stevie Dude Audiosexual

    Joined:
    Dec 29, 2020
    Messages:
    2,499
    Likes Received:
    2,246
    Location:
    Near Nyquist
    Izotope RX Resample module has option to control the LPF steepness among other things while showing prediction of the aliasing and also pre-ringing controls if that's your concern.
     
    Last edited: Feb 13, 2025
    • Like Like x 1
    • Useful Useful x 1
    • List
  15. tommyzai

    tommyzai Platinum Record

    Joined:
    Feb 7, 2012
    Messages:
    887
    Likes Received:
    229
    Same Q here. If there are no freqs up there . . . all clean . . . can there be aliasing? Would removing those unwanted highs aid in the process, be useless, or cause other issues?
     
  16. Radio

    Radio Audiosexual

    Joined:
    Sep 20, 2024
    Messages:
    2,375
    Likes Received:
    1,254
    Workshop: Aliasing and Oversampling in Music Production
    https://www-amazona-de.translate.go...l=auto&_x_tr_tl=en&_x_tr_hl=de&_x_tr_pto=wapp

    How do you apply the Nyquist theorem to avoid aliasing and distortion in signal processing?

    If you work with digital signals, you know how important it is to avoid aliasing and distortion. These are phenomena that occur when you sample a continuous signal at a rate that is too low to capture its frequency content. The result is a loss of information and a degradation of quality. But how can you prevent this from happening? The answer lies in the Nyquist theorem, a fundamental principle of signal processing that tells you the minimum sampling rate you need to preserve the original signal. In this article, we will explain what the Nyquist theorem is, how it relates to the Nyquist frequency and the Nyquist zone, and how you can apply it to your signal processing tasks.

    1) What is the Nyquist theorem?

    The Nyquist theorem, also known as the sampling theorem, states that a continuous signal can be perfectly reconstructed from its samples if the sampling rate is at least twice the highest frequency in the signal. This means that you need to know the frequency spectrum of your signal before you sample it, and choose a sampling rate that is high enough to capture all the relevant details. The Nyquist theorem also implies that there is a maximum frequency that can be represented by a given sampling rate. This frequency is called the Nyquist frequency, and it is equal to half the sampling rate. For example, if you sample a signal at 10 kHz, the Nyquist frequency is 5 kHz.

    2) What is aliasing and how to avoid it?

    Aliasing is the distortion that occurs when you sample a signal at a rate that is lower than the Nyquist rate. In this case, the frequencies in the signal that are higher than the Nyquist frequency cannot be distinguished from the lower ones, and they appear as false or aliased frequencies in the sampled signal. This can lead to unwanted noise, artifacts, and errors in your signal processing. To avoid aliasing, you need to filter out the frequencies that are above the Nyquist frequency before you sample the signal. This is called anti-aliasing filtering, and it is usually done by using a low-pass filter that attenuates the high frequencies and passes the low ones

    3) What is the Nyquist zone and how to use it?

    The Nyquist zone is a concept that helps you understand how different frequency bands are mapped to the sampled signal. The first Nyquist zone is the frequency range from 0 to the Nyquist frequency, and it corresponds to the original signal. The second Nyquist zone is the frequency range from the Nyquist frequency to twice the Nyquist frequency, and it corresponds to the inverted and shifted version of the original signal. The third Nyquist zone is the frequency range from twice the Nyquist frequency to three times the Nyquist frequency, and it corresponds to the non-inverted and shifted version of the original signal. And so on for higher Nyquist zones. You can use the Nyquist zones to manipulate the frequency content of your signal by changing the sampling rate or using band-pass filters. For example, if you want to sample a signal that has a frequency of 7 kHz, you can use a sampling rate of 8 kHz and a band-pass filter that selects the second Nyquist zone, which contains the 7 kHz signal.

    4) How to apply the Nyquist theorem in practice?

    The Nyquist theorem is a theoretical ideal that assumes infinite precision and perfect filtering. In practice, however, you may face some limitations and challenges when applying it to real signals, such as not knowing the exact frequency spectrum of your signal or having noise or interference that affects your signal quality. You may also have constraints on your sampling rate due to hardware limitations, storage capacity, or processing speed. To optimize signal processing in these cases, you may need to compromise between accuracy and efficiency. Oversampling involves sampling a signal at a rate higher than the Nyquist rate, which gives more information but increases data size and processing time. Decimation reduces the sampling rate of a signal by discarding some samples, saving space and time but reducing resolution and potentially introducing aliasing and noise. Interpolation increases the sampling rate of a signal by adding some samples, improving resolution and smoothness but introducing errors and noise if not done properly.

    5) Why is the Nyquist theorem important?

    The Nyquist theorem is important because it sets the fundamental limit on how much information you can extract from a continuous signal using discrete samples. It also gives you a guideline on how to choose your sampling rate and your filtering strategy to preserve the integrity and quality of your signal. The Nyquist theorem is applicable to many fields and applications that involve digital signals, such as audio, video, image, communication, control, and biomedical engineering. By understanding and applying the Nyquist theorem, you can improve your signal processing skills and outcomes.
     
    Last edited: Feb 13, 2025
  17. xorome

    xorome Audiosexual

    Joined:
    Sep 28, 2021
    Messages:
    1,288
    Likes Received:
    941
    Not sure what the question is, sorry. There is no benefit in using your own lowpass before your DAW's downsampler / a standalone downsampler.

    You wouldn't be "helping" your DAW, you'd be making it worse:
    - You'd be cutting more of the audible range than if you'd just let your DAW do the job with its own filter.
    - You'd be adding more phase shift/delay with an IIR EQ (= "default" filter type for EQs).
    - You'd be adding more pre-ringing with a FIR type EQ.
    - If you render to a lower kHz from a higher kHz mix, your DAW's decimation process will be engaged no matter what, this is not "negotiable" with the DAW. The surplus samples from a higher sample rate need to be discarded some way.
     
    • Agree Agree x 2
    • Like Like x 1
    • Useful Useful x 1
    • List
  18. Radio

    Radio Audiosexual

    Joined:
    Sep 20, 2024
    Messages:
    2,375
    Likes Received:
    1,254
    You cannot remove aliasing when it's already introduced. Just use good plugins and instruments that already have as little aliasing as possible, this is the only way to "eliminate" it.

    ExperimentalScene - ES AntiAlias - Free VST Audio Filter For Windows (Warning: 32-bit Windows VST Host) Use at your own risk!

    ES AntiAlias is a free plugin that filters out harmonics that occur above the nyquist frequency by oversampling the input signal and then filtering. If you are using any instruments or effects that generate aliased digital audio (many of them) ES AntiAlias can improve the sound quality.

    You will generally notice a difference by hearing less annoying high frequency harmonics.
    This plugin is available as a native DarkPlug machine, included with DarkWave Studio, and also as a VST plugin for third-party hosts.

    Features: - Stereo Input and Output, - 64 Bit Floating Point Audio Engine, - Minimum Phase Distortion FIR Filter

    www.experimentalscene.com/software/antialias/

    Applicability of oversampling

    A technique known as oversampling is commonly used in audio conversion, especially audio output. The idea is to use a higher intermediate digital sample rate, so that a nearly-ideal digital filter can sharply cut off aliasing near the original low Nyquist frequency, while a much simpler analog filter can stop frequencies above the new higher Nyquist frequency.

    The purpose of oversampling is to relax the requirements on the anti-aliasing filter, or to further reduce the aliasing. Since the initial anti-aliasing filter is analog, oversampling allows for the filter to be cheaper because the requirements are not as stringent, and also allows the anti-aliasing filter to have a smoother frequency response, and thus a less complex phase response.

    On input, an initial analog anti-aliasing filter is relaxed, the signal is sampled at a high rate, and then downsampled using a nearly ideal digital anti-aliasing filter.
     
    Last edited: Feb 13, 2025
  19. Plendix

    Plendix Platinum Record

    Joined:
    Nov 14, 2013
    Messages:
    428
    Likes Received:
    237
    have a look at this and go mad:
    https://src.infinitewave.ca/

    PS: Use whatever you got. Any modern DAW is perfectly capable of downsampling audio beyond quality loss anyone can hear. Like Cubase 10 produces artefacts on -180db!
    Even Renoise 3 manages to keep the dirt down to 90db.
    and Renoise is a tracker.
    But with anything audio related, src is just fine for ones personal paranoia.
    //edit// I would not recommend doing the converters job before doing the conversion.
    the converter knows best where to low pass and at what q.
     
    Last edited: Feb 13, 2025
  20. shinjiya

    shinjiya Platinum Record

    Joined:
    Dec 25, 2018
    Messages:
    334
    Likes Received:
    197
    Try TDR Ultrasonic, even the demo will be enough since it's unlimited (but doesn't save settings). Though, I wouldn't care too much about it. People keep fretting over aliasing they themselves can't hear.
     
  21. patatern

    patatern Rock Star

    Joined:
    Feb 15, 2021
    Messages:
    579
    Likes Received:
    369
    Location:
    tiksi
    Nobody named WEISS SARACON?

    I use it extensively since ages, and it never disappoints. Just use the basic preferences and the thing is done.
     
Loading...
Similar Threads - Downsampling Help Needed Forum Date
Downsampling from 48 to 44.1 Mixing and Mastering Aug 16, 2014
Your opinion on downsampling Working with Sound Jun 7, 2011
help with recognizing the origin of this sound how to make "that" sound Saturday at 6:35 PM
Help Installing Arturia Collection, Symlink Installer not working Software Saturday at 2:29 PM
I did another track but was i too quick? maybe delete it, help please Electronic Feb 8, 2025
Loading...