I’m working with low samplerate audio and noticing that Audacity’s playback sounds lowpassed. Pretty aggressively at that. I’m guessing that it’s interpolating between samples, but the effect sounds the same as cutting everything over ~2.5kHz for my 20kHz audio clip. I’d like to hear it “raw”.
Just to test things, I stretched my clip by repeating each sample 4 times and played it back at 4xspeed(80kHz). All the highs are there.
So, can this feature be disabled? Can I make Audacity not smooth out my audio?
The maximum frequency that can be supported is half of the sample rate (See: http://en.wikipedia.org/wiki/Nyquist_frequency), thus a sample rate of 20 kHz has a cutoff just below 10 kHz. Audacity does not automatically apply additional filtering beyond that.
Thanks for the input, but I don’t think this is the issue.
A 20kHz sample rate doesn’t have a 10kHz cutoff in the same sense as a low pass filter. There should still be upper harmonics. Put a square wave through a spectrum analyzer and you’ll see the higher constituent frequencies. http://en.wikipedia.org/wiki/Square_wave
Also, this doesn’t explain why my “upsampled” clip retains the highs. It has the same values, just repeated to force playback at 80kHz.
After poking around the menus, I’m almost positive the problem stems from the “Real-time Conversion”. It has a sample rate conversion option that only lets you select between two types of interpolation. Can I get around this? Are there plugins for other kinds of conversion?
Audacity doesn’t low pass a 20000 Hz file that can contain frequencies up to 10000 Hz so that it only contains up to 2500 Hz.
Are you sure you have turned all the effects off in your sound card?
What version of Windows and what version of Audacity? Please see the pink panel at the top of the page. From your description you are using an obsolete version of Audacity that uses libresample for sample rate conversion.
However you would need to say far more about what audio device you are playing to and what its Windows settings are to decide if there is any resampling going on in Windows, and also to say what the Audacity Project Rate bottom left is to decide if there is sample rate conversion in Audacity. If Project Rate says less than 20000 Hz then you have chosen to resample playback to a sample rate that cannot contain as high frequencies as the audio track does.
You can compile Audacity with libresample, libsamplerate or libsoxr. See Missing features - Audacity Support for details of the current sample rate conversion library that Audacity uses.
The 44.1k rendered WAV output of Audacity also sounds like this. I think that eliminates the hardware/drivers as the source of the issue.
Anyway, let me start over and explain my situation.
I’m working with the raw rom of some 20kHz drum sounds, the SpecDrum’s specifically. I also have some 44.1kHz recording of the hardware playing back these exact same 20kHz sounds. When I import the rom as a raw data/signed 8 bits/20khz it is muffled sounding compared to the recordings. If I tweak the rom so each byte(sample) is repeated 4 time, then re-import it at 80kHz, it sounds exactly like the recordings.
My question now is, why does a 20kHz sample sound any better/different when re-recorded/re-sampled at a higher rate?
Is it generating noise through aliasing even at an integer multiple of the sampling rate?
Your initial theory / guess that Audacity cuts frequencies above 2.5 kHz for 20 kHz sample rate is not correct, at least not for the current version of Audacity.
You’ve not said which version of Audacity you are using, but your description of available settings suggests that you are using an obsolete version. Please check in “Help > About Audacity” to see which Audacity version you are using. If it is not 2.0.5, please update from here: http://audacityteam.org/download/
We are not able to provide technical support for obsolete versions of Audacity as any reported problems may be due to bugs that have long since been fixed.
If you get the same results in Audacity 2.0.5 then please describe how exactly each of the recording is made and how you are playing them back to compare them.
I’m sorry I didn’t specify. I was using version 2.0.2, but I get similar results in 2.0.5.
I’ve attached a project with three audio clips.
The first is the original rom. Imported as “Raw Data”, signed 8bit, mono, 20kHz.
The second is my cheated 40kHz version of the rom. Raw, signed 8bit, mono, 40kHz
The last is a recording I found of the rom played by the SpecDrum/possibly an emulator. Wav, 16bit, 44.1kHz
All of them have been resampled to 44.1kHz. The project rate is also 44.1kHz
The SpecDrum’s hardware looks to be a latching r2r DAC written to at 20kHz.
I can’t recreate what I described as a ~2.5kHz lowpass. I’m not sure why. It sounds now like the expected 10kHz cutoff.
I’d like to hear the content over 10kHz even if it is result of aliasing/noise. SpecDrum example.zip (63.5 KB)
How exactly did you make that? I was expecting to see duplicated samples.
For a sample rate of 20 kHz, there isn’t any frequency content over 10 kHz. The Nyquist frequency is a brick wall beyond which frequencies cannot be represented. Aliasing distortion is when you attempt to create frequencies above the Nyquist frequency, but because such frequencies cannot exist, the values “bounce back” to create “phantom” frequencies below the Nyquist frequencies. It is those “phantom” frequencies that are called “aliasing”.
It is composed of perfect duplicate samples @ 40kHz. What I uploaded is resampled to 44.1kHz.
I can include each clip at its original rate if you’d like.
Thank you explaining aliasing. I was afraid I was misusing the term.
That aside, there is something audible above 10kHz in the last two clips. Spectral layers shows it as a reflection of everything below the Nyquist frequency. Is my silly sample duplication method the only way to generate/hear this?
I didn’t give you the original rom that I used, so you can’t exactly reproduce my steps.
I imported the raw data, then selected Track>resample and entered 44100Hz. HQ conversion is set to “Best Quality” with no dithering.
I’ve attached the roms and recordings.
snare(20kHz).bin is the original rom
snare(40kHz).bin is the duplicated a,a,b,b,c,c rom
The others are recording I found on the web
If it helps, I can upload my script that made the 40kHz version and I can include the graphs from spectral layers. SpecDrum raw.zip (24.4 KB)
I think that what you’re seeing in the recording of the SpecDrum is spectral imaging caused by resampling with very low order (perhaps linear) interpolation, either in the hardware itself, or in whatever made the recording. If it’s the latter, the recording is not representative the sound being produced by the hardware. If it’s the former, you can approximate this by using Audacity’s fastest (lowest quality) resampler setting.
For the moment I’m going to assume the sound isn’t the result of the recording process since both recordings sound similar.
This leaves the hardware: it’s 80’s tech. I’ve stepped through the code and looked at the schematics. It’s just a CPU spewing bytes at 20kHz to an R2R DAC. It has some filter/amplification after that, but that’s beyond the point.
My understanding is that the raw DAC’s output will be stair-stepped. Each sample is held for 1/20,000 of a second so, you should see a “flat” part that lasts 1sec/20,000. Even if you record this output at, say, 96kHz, you should see the same 1sec/20,000 flat parts. Kinda like a digital sample and hold.
I think it lends some credence that my 40Khz version looks stair-stepped and sounds like the recordings.
Audacity’s lowest quality reample doesn’t produce this result.
The fact that DACs output a sequence of piecewise constant values (known as zero-order hold in sample data textbooks) or rectangular pulses causes multiple harmonics above the Nyquist frequency. Usually, these are removed with a low pass filter acting as a reconstruction filter in applications that require it.
I want to hear the harmonics that sit above the Nyquist frequency. Regardless of the actual hardware or recordings, I’d like to hear the raw dac output and apply my own filtering.
Presumably the way to hear the raw DAC output is to listen to it in the DAC with all filtering turned off.
Would there be any way to record the DAC output using an ADC and preserve the “harmonics above the Nyquist frequency”? As far as I can tell, none of your (unfaked) recordings have the required harmonics, is that correct?
if you made such recording in a digital format containing “audio above the Nyquist frequency”, is there any spectrum tool in a digital audio editor that would show it?
True, but I don’t have a realtime way to play things over an 8bit DAC. I don’t even have the original SpecDrum hardware.
I’d just like to get Audacity close to sounding unfiltered.
No, that is not correct.
As far as I know, the recordings I’ve previously included are of the DAC in question. I think the term Nyquist frequency is confusing things. The recordings contain harmonics above 10kHz. That is to say, they “have the required harmonics”.
I’m not saying a 44.1kHz wav has frequencies over 22.05kHz in it.
I’m saying that playing a 20kHz recording with an unfiltered DAC will yield frequencies above 10kHz.
So the aim of the exercise is to make the 20 kHz 8 bit ROM sample that you have (first track), sound like the 44100 kHz recording that you found?
I think that is more or less correct.
The “steps” created by the sample and hold will generate a broad spectrum of frequencies (in the analogue domain) that are above the Nyquist frequency of the digital audio.
In effect, your technique of repeating each sample, then resampling emulates digitally what occurs in the hardware. It seems to me that you have solved the problem.
Modern D/A converters don’t produce a stepped output response, so these additional harmonics are not generated, so modern D/A converters will not sound the same as the old D/A converter in the SpecDrum unless you also synthesize the distortion created by the SpecDrum converter, which is what your “sample doubling” method does.