Disable automatic low pass filter when resampling

First off I’m using windows 8.1 Pro and Audacity 2.2.2

Whenever I resample something in audacity, it resamples it but it also has an automatic low pass to prevent the alias frequencies from coming through. Is there a way I can disable this to hear for example a 8 khz sample rate file without the low pass, meaning including all of the hiss and alias noises along with that sample rate?
Thanks.
PS: I am willing to modify code in my copy of audacity to attempt this

PS: I am willing to modify code in my copy of audacity to attempt this

You’ll probably have to do that. Filtering is part of any proper downsampling algorithm. I’ve never even looked at the Audacity code but I assume you know it’s open source.

You can probably make a [u]Nyquist[/u] plug-in. That should be easier than modifying the Audacity code and I’d imagine it’s “easy” if divide the sample rate by even numbers.

Well, then what code should I write? I don’t have a ton of experience with nyquist so a little help would be greatly appreciated :slight_smile:

A similar effect could be achieved with a bit-crush plugin.
Tritik Krush is free & works in Audacity on Windows …

  1. Select the track
  2. Apply this command in the Nyquist Prompt:
;version 4
(force-srate 8000 *track*)
  1. From the track drop-down menu, select “Rate” and set it to 8000.

The “force-srate” command resamples a sound using linear interpolation without pre-filtering.
TRACK is a special variable that passes the selected audio from Audacity to Nyquist.

By the way, the current and recommended version of Audacity is 2.3.2. It is available via the Audacity website: Audacity ® | Download for Windows

To Steve’s solution:

Yes, I know of that nyquist command. But it still acts the same as if I just clicked resample. This simply does that but in a more complicated way and it doesn’t give the results I want.

To the Trikit solution:

Yes, I know I can use a bit crusher, but that defeats the whole purpose of being able to set a specific sample rate.

Thanks

that defeats the whole purpose of being able to set a specific sample rate.

Reducing the sample rate isn’t “free.” 8000 is just better than AM radio.

What’s the goal? I mean the real goal, not the microscopic viewing the rate goal. Why are we doing this?

Koz

Tritik Krush does also downsampling as well as bitcrush.
dBlue crusher is a free plugin which has a downsample slider, independent of bitcrush.

Try following the instructions exactly as I wrote them.



In Audacity 2-3-2 on Windows 8 that code just speeds it up.

It doesn’t “only” speed it up. It resamples the selected audio to 8 kHz, and returns the audio to the track. It does NOT change the Audacity track which is still set to 44.1 kHz.
Because there are less samples in the returned audio than there were in the original (because it has been resampled), it takes up less space in the audio track, effectively “speeding it up”.
By changing the track sample rate (from the track’s drop down menu) to 8000 Hz, the samples are then correctly spaced out at intervals of 1/8000 second, and the track will play at the correct speed.

OK but that plays it at the correct speed, but it has nothing above 4kHz.
It doesn’t have the high-frequency digital-artefacts, which was the brief.

OK but that plays it at the correct speed, but it has nothing above 4kHz.
It doesn’t have the high-frequency digital-artefacts, which was the brief.

Right. It won’t. The Nyquist limit is half the sample rate.

Aliasing is “false” lower frequencies that are created if you don’t filter before downsampling.

Exactly so.
Example, If you generate a sine tone at 5 kHz and resample to 8 kHz, the Nyquist frequency is 4 kHz. “Proper” resampling (with anti-alias filtering) will remove the 5 kHz sine tone and the result will be silence. Resampling without anti-alias filtering will create a strong peak at 3 kHz (the alias frequency).

The code I provided will also create additional frequencies at a much lower level. These are the result of “distortion” cause by the linear interpolation.

The problem is the sheer act of selecting 8khz in the drop down after using the nyquist command does the exact same effect as just selecting resample and selecting 8khz. The dblue crusher also doesn’t allow for a specific sample rate, just a number of sample reductions

No it doesn’t.

When you select Resample, the audio is resampled by “soxr” (a high quality resampling library) which applies anti-alias filtering prior to resampling.
With the steps that I posted, the audio is resampled by Nyquist using linear interpolation and no pre-filtering.

Try the comparison that I described in this post: Disable automatic low pass filter when resampling - #14 by steve
You will see that Audacity’s resampling (using soxr) produces silence, whereas Nyquist’s “force-srate” produces an alias 3 kHz waveform.