• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Testing PCM playback

WillerZ

Member
Joined
Jul 31, 2019
Messages
6
Likes
9
Location
Seattle, WA
I'm a longtime lurker and first time poster.

I wrote a program that can synthesize PCM streams at any bit-depth and sampling rate my DAC supports. I coded it to partially randomize what it does and to not tell me: my inputs to it are just the answers to yes/no questions like "did you just hear a tone?" and "did the two tones you just heard sound the same?".

TL;DR Red Book PCM is functionally transparent for me. So far all the theories hold, and although I can see a case for 24-bit I really don't need any higher sample rate.

I did a binary search to find the highest frequency of sine wave I can hear (a disappointing 14,439Hz). My wife took the same test and could hear tones up to 16,889Hz so I know that to be my limit and not a limitation of my DAC/amp/IEMs.

One of the theories I have seen on other forums is that human hearing does not behave like a sine-wave processing machine. The suggestion is that it's possible to hear the effect of an ultrasonic wave added to a sonic wave, so while I can't hear a 14,440Hz tone alone I should be able to hear its effect if it's a harmonic of a frequency I can hear.

I decided to test this with square waves. A square wave is logically an infinite sum of sine waves, but i have to discard anything above the Nyquist limit before sampling, which for 192kHz sampling leaves:
  • 4,814
  • 14,442 <- 3Hz into my ultrasonic region
  • 24,070
  • 33,698
  • 43,326
  • 52,954
  • 62,582
  • 72,210
  • 81,838
  • 91,466
If this theory were true, I should be able to hear the difference between a square wave at 4,814Hz and a 4,814Hz sine wave. I can't. Again I was able to confirm that the program was working because my wife can tell the difference between the two. She also can't tell the difference between a square and sine wave at just over 1/3 of her ultrasonic threshold. We both can tell the difference right up to that line.

FWIW these results are stably reproducible across a few DACs, a couple of amplifiers and varying IEMs/headphones/speakers.

Anyone got any other theories I can test?

There is a good case for using a much higher sample rate on the ADC end; I can elaborate on that if anyone's interested.
 

pkane

Master Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
5,670
Likes
10,301
Location
North-East
I'm a longtime lurker and first time poster.

I wrote a program that can synthesize PCM streams at any bit-depth and sampling rate my DAC supports. I coded it to partially randomize what it does and to not tell me: my inputs to it are just the answers to yes/no questions like "did you just hear a tone?" and "did the two tones you just heard sound the same?".

TL;DR Red Book PCM is functionally transparent for me. So far all the theories hold, and although I can see a case for 24-bit I really don't need any higher sample rate.

I did a binary search to find the highest frequency of sine wave I can hear (a disappointing 14,439Hz). My wife took the same test and could hear tones up to 16,889Hz so I know that to be my limit and not a limitation of my DAC/amp/IEMs.

One of the theories I have seen on other forums is that human hearing does not behave like a sine-wave processing machine. The suggestion is that it's possible to hear the effect of an ultrasonic wave added to a sonic wave, so while I can't hear a 14,440Hz tone alone I should be able to hear its effect if it's a harmonic of a frequency I can hear.

I decided to test this with square waves. A square wave is logically an infinite sum of sine waves, but i have to discard anything above the Nyquist limit before sampling, which for 192kHz sampling leaves:
  • 4,814
  • 14,442 <- 3Hz into my ultrasonic region
  • 24,070
  • 33,698
  • 43,326
  • 52,954
  • 62,582
  • 72,210
  • 81,838
  • 91,466
If this theory were true, I should be able to hear the difference between a square wave at 4,814Hz and a 4,814Hz sine wave. I can't. Again I was able to confirm that the program was working because my wife can tell the difference between the two. She also can't tell the difference between a square and sine wave at just over 1/3 of her ultrasonic threshold. We both can tell the difference right up to that line.

FWIW these results are stably reproducible across a few DACs, a couple of amplifiers and varying IEMs/headphones/speakers.

Anyone got any other theories I can test?

There is a good case for using a much higher sample rate on the ADC end; I can elaborate on that if anyone's interested.

Nice tests! Might be worth sharing the software with others so they can perform a similar test.

I may have missed this, but what are you using the ADC for in this test? Sounds like you just need a DAC and a transducer, but not an ADC.
 

BigVU's

Member
Forum Donor
Joined
Jul 30, 2019
Messages
70
Likes
37
Well much more scientific than I. Though interesting in that you were testing this out, I came across an explanation today from someone breaking this similar concept down in a you tube clip. If I understood it correctly, basically lossless audio like FLAC is the best format, the higher resolution rates above 44 or 48k are basically not something most humans will be able to hear. While in theory cleaner 96, 192 and higher were not actually something worth the value and argued it was marketing hype. Of course I could have it all wrong.
 

Blumlein 88

Grand Contributor
Forum Donor
Joined
Feb 23, 2016
Messages
20,702
Likes
37,442
Why is it a good case for a higher rate ADC? Please share.
 
OP
W

WillerZ

Member
Joined
Jul 31, 2019
Messages
6
Likes
9
Location
Seattle, WA
My ADC is purely software, and my analog domain is just maths. But both exist, and the requirements of the ADC process are the same as those on an electrical one, which I found interesting from my position of absolute ignorance about how such things are built.
 
OP
W

WillerZ

Member
Joined
Jul 31, 2019
Messages
6
Likes
9
Location
Seattle, WA
Any ADC requires that the input frequencies above the Nyquist limit are removed before the sampling takes place. So if we are sampling at 44.1kHz we need to build something in the analog domain to chuck out anything above 22.05kHz. Given that people can hear frequencies up to 22kHz we are looking for something with very high accuracy.

If you want a usable signal up to 22kHz it's probably easier to hit that filtering window of 22-48kHz, sample at 96kHz, then do the rest of the filtering in the digital domain where it's a lot easier (no real-time requirement, etc, etc).
 

Blumlein 88

Grand Contributor
Forum Donor
Joined
Feb 23, 2016
Messages
20,702
Likes
37,442
Any ADC requires that the input frequencies above the Nyquist limit are removed before the sampling takes place. So if we are sampling at 44.1kHz we need to build something in the analog domain to chuck out anything above 22.05kHz. Given that people can hear frequencies up to 22kHz we are looking for something with very high accuracy.

If you want a usable signal up to 22kHz it's probably easier to hit that filtering window of 22-48kHz, sample at 96kHz, then do the rest of the filtering in the digital domain where it's a lot easier (no real-time requirement, etc, etc).
Most real world ADC's these days let a little aliasing in between 20 khz and 22 or 24 khz. There usually is very little at very low level below 20 khz. The advantage to going with 88 or 96 khz isn't great. The built in filters usually do a pretty good job. It is pretty much a non-issue in general. The built in filters take care of it for you fine.

Here are the results of me testing some ADCs for aliasing levels.
https://www.audiosciencereview.com/forum/index.php?threads/comparing-aliasing-in-three-adcs.3272/
 

pkane

Master Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
5,670
Likes
10,301
Location
North-East
My ADC is purely software, and my analog domain is just maths. But both exist, and the requirements of the ADC process are the same as those on an electrical one, which I found interesting from my position of absolute ignorance about how such things are built.

So you are generating the waveform in floating point (analog), filtering and then sampling it at a specified rate, I assume? What filter do you use?
 
OP
W

WillerZ

Member
Joined
Jul 31, 2019
Messages
6
Likes
9
Location
Seattle, WA
So you are generating the waveform in floating point (analog), filtering and then sampling it at a specified rate, I assume? What filter do you use?

I only generate sine waves, and my "filter" is just that I do not generate any with higher frequency than 1/2 the sample rate.
 
OP
W

WillerZ

Member
Joined
Jul 31, 2019
Messages
6
Likes
9
Location
Seattle, WA
Exactly.

I also, because why not, tried sampling a pure square wave. This sounded awful from the aliased ultrasonic components, as it should have.
 

PaulD

Senior Member
Joined
Jul 22, 2018
Messages
453
Likes
1,341
Location
Other
[snip]
I did a binary search to find the highest frequency of sine wave I can hear (a disappointing 14,439Hz). My wife took the same test and could hear tones up to 16,889Hz so I know that to be my limit and not a limitation of my DAC/amp/IEMs.

One of the theories I have seen on other forums is that human hearing does not behave like a sine-wave processing machine. The suggestion is that it's possible to hear the effect of an ultrasonic wave added to a sonic wave, so while I can't hear a 14,440Hz tone alone I should be able to hear its effect if it's a harmonic of a frequency I can hear.

I decided to test this with square waves. A square wave is logically an infinite sum of sine waves, but i have to discard anything above the Nyquist limit before sampling, which for 192kHz sampling leaves:
[snip]
If this theory were true, I should be able to hear the difference between a square wave at 4,814Hz and a 4,814Hz sine wave. I can't. Again I was able to confirm that the program was working because my wife can tell the difference between the two. She also can't tell the difference between a square and sine wave at just over 1/3 of her ultrasonic threshold. We both can tell the difference right up to that line.
[snip.

Hi WillerZ, (I edited your post above s bit to point to the bits I'm referring to) what you are be experiencing may be Auditory Masking. The square wave harmonics are decreasing in amplitude, and the higher amplitude fundamental could be masking the audibility of the higher harmonics.

Perhaps try a test of playing the upper harmonics at a level you can easily detect, and then add the lower frequency components to see if that impedes the audibility of the higher ones. Or, more generalised, perhaps playing a 14KHz signal you can detect and adding lower frequencies to test if that impedes the audibility of higher frequencies.

Here's a bit more on auditory masking:
https://en.wikipedia.org/wiki/Auditory_masking
https://www.acousticresearch.org/psychoacoustics
 
OP
W

WillerZ

Member
Joined
Jul 31, 2019
Messages
6
Likes
9
Location
Seattle, WA
Try a test of playing the upper harmonics at a level you can easily detect, and then add the lower frequency components to see if that impedes the audibility of the higher ones. Or, more generalised, perhaps playing a 14KHz signal you can detect and adding lower frequencies to test if that impedes the audibility of higher frequencies.

I'm sorry my post was not clear - I already tried what I think you are suggesting. I can hear a tone at 14439Hz, and I can hear the difference between a 4813Hz square wave (that has 14439Hz as its first expressed harmonic) and a 4813Hz sine wave. I cannot differentiate signals if the differences are in the 14440Hz and up range.
 

PaulD

Senior Member
Joined
Jul 22, 2018
Messages
453
Likes
1,341
Location
Other
Ahhh! Sorry for the misunderstanding... It may well be a personal hearing anomaly, I really have no idea, sorry, but differentiating signals at the frequency extremes is always difficult as the Basilar membrane is less flexible in those regions (thus the Fletcher-Munson curves).
 
Top Bottom