• 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!

Beta Test: Multitone Loopback Analyzer software

OP
pkane

pkane

Master Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
5,732
Likes
10,413
Location
North-East
The various IEEE data converter standards (1057, 1241, 1658) as well as many other online (and free) resources describe how to generate relatively prime sequences for simulation and testing (the standards all focus on testing but the concept is the same). I use that method in all of my programs to maintain independent bins for tones and their (sub and supra) harmonics. Prime numbers should also get you there, I think, but the recipe the IEEE (etc.) uses also lets you choose frequencies related to your sampling rate for simulated and real-world testing without having to worry about binning and windowing, assuming you have enough points in the FFT to get close enough to the desired test tone frequency. I really like not having to window my data.

There used to be a big data converter app note from Analog Devices describing their approach using relatively prime numbers. I can't find it in my files at the moment, may have just a paper copy, it's that old (me too).

It turns out that most of the time if the sampling rate is even and you choose an odd multiplier to get to frequency it will also avoid overlaps. I have gotten lazy in some recent programs and just done that, but it does not always work.
The NID sequence in Evans' paper is a bit odd (pun intended!) His sequence generates odd frequencies only, but it actually doesn't do as good a job at avoiding IMD/test tones collisions as a prime sequence would. In addition, it doesn't do anything to avoid harmonics collision with test tones, which a prime sequence does. So, I think I'll stick with my method of generating a 'decoherent' sequence currently in Multitone :)
 

Music1969

Major Contributor
Joined
Feb 19, 2018
Messages
4,680
Likes
2,851
The current single tone SINAD King also happens to be the multitone King, which is nice.

But I can guarantee if it used 32 tones using @pkane 's decoherent frequencies, it would not have a noise/distortion floor this low, especially with white noise test. And the 22.5bits range (127dB range = approx 21 bits?) would decrease as the noise/distortion floor shot up quite a bit.

It would probably be between 110dB to 120 dB range - still highly transparent obviously but not the same 127dB range shown below

If we had to do a ranking based on 1 measurement, 32 decoherent freq tones would be my favourite :D @amirm

index.php
 
Last edited:

Rantapossu

Addicted to Fun and Learning
Joined
Jul 21, 2022
Messages
528
Likes
375
@pkane here's a little brain teaser for when you have nothing else to do. I know that you like programming challenges ;) .

Would it be possible to add an internal loopback sound device for MT?

Not a virtual sound card that is visible on Windows sound devices, but just one additional row on the output and input device selector. Like a "PK Multitone loopback output" and "PK Multitone loopback input".

When the two of them selected, it would route all sounds through these two "devices" without installing any external loopback devices for Windows.

It could be a bit-perfect by default and if you want, it could use the parts of your other programs to degrade the quality of the sound card, add distortion, noise floor, harmonics and other real word word elements when selected.

It would be very handy when testing the program in the virtual environment or with the laptops without any line input devices. It would come with MT and you don't have to setup any external sound cards or install software loopback devices to just test the new features of MT.

I made an external loopback plug with some resistors for my work laptop to route the headphone output to the microphone input to be able to test MT (I know, I shouldn't test MT while I'm working.... ;) ). This software addition would make it obsolete...
 
Last edited:
OP
pkane

pkane

Master Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
5,732
Likes
10,413
Location
North-East
@pkane here's a little brain teaser for when you have nothing else to do. I know that you like programming challenges ;) .

Would it be possible to add an internal loopback sound device for MT?

Not a virtual sound card that is visible on Windows sound devices, but just one additional row on the output and input device selector. Like a "PK Multitone loopback output" and "PK Multitone loopback input".

When the two of them selected, it would route all sounds through these two "devices" without installing any external loopback devices for Windows.

It could be a bit-perfect by default and if you want, it could use the parts of your other programs to degrade the quality of the sound card, add distortion, noise floor, harmonics and other real word word elements when selected.

It would be very handy when testing the program in the virtual environment or with the laptops without any line input devices. It would come with MT and you don't have to setup any external sound cards or install software loopback devices to just test the new features of MT.

I made an external loopback plug with some resistors for my work laptop to route the headphone output to the microphone input to be able to test MT (I know, I shouldn't test MT while I'm working.... ;) ). This software addition would make it obsolete...

You may want to look into virtual loopback audio drivers. Some are available for free. I use one for the Mac, and have one for Windows, as well. I think the one I use on Windows is called Virtual cable or some such thing.
 

Rantapossu

Addicted to Fun and Learning
Joined
Jul 21, 2022
Messages
528
Likes
375
You may want to look into virtual loopback audio drivers. Some are available for free. I use one for the Mac, and have one for Windows, as well. I think the one I use on Windows is called Virtual cable or some such thing.

I have used virtual "Hi-Fi Cable" for years, that's why I suggested an internal loopback route for MT. Like a straight input/output pipe programmed inside MT without installing any additional loopback virtual drivers for Windows. It could use a bit-perfect loopback or for example include parts of you Distort -program to degrade the audio if selected so. But as I said, you already have more important things to do in your life, but if you ever have some spare time and nothing else to do, this could be a nice programming challenge ;).
 
OP
pkane

pkane

Master Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
5,732
Likes
10,413
Location
North-East
I have used virtual "Hi-Fi Cable" for years, that's why I suggested an internal loopback route for MT. Like a straight input/output pipe programmed inside MT without installing any additional loopback virtual drivers for Windows. It could use a bit-perfect loopback or for example include parts of you Distort -program to degrade the audio if selected so. But as I said, you already have more important things to do in your life, but if you ever have some spare time and nothing else to do, this could be a nice programming challenge ;).

Maybe once I fix all the bugs ;)
 

Rantapossu

Addicted to Fun and Learning
Joined
Jul 21, 2022
Messages
528
Likes
375
Maybe once I fix all the bugs ;)

Should I stop reporting the bugs then? ;)

Just joking, the internal loopback isn't in the "Top 100" priorities of MT. But keep it in the bottom end of your to-do list, if possible. :cool:
 

JohnPM

Senior Member
Technical Expert
Joined
Apr 9, 2018
Messages
344
Likes
920
Location
UK
The NID sequence in Evans' paper is a bit odd (pun intended!) His sequence generates odd frequencies only, but it actually doesn't do as good a job at avoiding IMD/test tones collisions as a prime sequence would. In addition, it doesn't do anything to avoid harmonics collision with test tones, which a prime sequence does. So, I think I'll stick with my method of generating a 'decoherent' sequence currently in Multitone :)
A bit unfair, I think. My understanding is that it avoids harmonics up to the 4th order, that is the aim of that sequence. It also avoids the intermodulations of combinations of 2, 3 and 4 of the test tones. Combinations which do fall on the test frequencies have the same phase as the test frequency they hit and so generate a systematic bias rather than phase-dependent variations in levels that is a feature of other sequences and causes dispersion in results. Some of the intermodulations of the harmonics of prime sequences fall on test tones, for example, so they are no universal panacea.
 
OP
pkane

pkane

Master Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
5,732
Likes
10,413
Location
North-East
A bit unfair, I think. My understanding is that it avoids harmonics up to the 4th order, that is the aim of that sequence. It also avoids the intermodulations of combinations of 2, 3 and 4 of the test tones. Combinations which do fall on the test frequencies have the same phase as the test frequency they hit and so generate a systematic bias rather than phase-dependent variations in levels that is a feature of other sequences and causes dispersion in results. Some of the intermodulations of the harmonics of prime sequences fall on test tones, for example, so they are no universal panacea.

I'm happy to be proven wrong, and I understand none of these sequences are perfect. But, it is possible to compare them to each other using all the tones in the sequence.

To test them, I built an exhaustive harmonic/IMD frequency generator for multitones. I then proceeded to compute overlap with test tones to compare various sequences, and ultimately, picked prime as the best for my purposes.

Here, NID sequence of 24 tones from Evans' paper is compared to a prime sequence generated by Multitone. Percent is the percent of all IMD components of that order that overlap with the frequency of one of the test signals. IMD of order 1 represents harmonic distortion components:

1663277989585.png
 
Last edited:

JohnPM

Senior Member
Technical Expert
Joined
Apr 9, 2018
Messages
344
Likes
920
Location
UK
I guess it depends which primes then :) since sequences of primes and regular interval samplings of primes didn't show any particular benefits in my tests. Perhaps a better test is to pass the signal through a polynomial of the expected/target order and see what impact the coefficients have on the measured response at the tone frequencies.
 
OP
pkane

pkane

Master Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
5,732
Likes
10,413
Location
North-East
I guess it depends which primes then :) since sequences of primes and regular interval samplings of primes didn't show any particular benefits in my tests. Perhaps a better test is to pass the signal through a polynomial of the expected/target order and see what impact the coefficients have on the measured response at the tone frequencies.
For this test, I actually tried to make the sequences as similar as possible and picked the next larger prime based on the NID sequence. For example, replacing 49 in NID sequence with 53, or 81 with 83. Generally very similar sequences, as the result, except one contains all primes, the other is a mix of primes and odd numbers. Oh, and I started with 5 for both sequences, not with 1.
 

Music1969

Major Contributor
Joined
Feb 19, 2018
Messages
4,680
Likes
2,851
Great chat. The maths discussion has already helped improve both products.
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,925
Likes
16,770
Location
Monument, CO
Any prime sequence should work IIRC, as long as you do not sample the signal in time and have infinite-length FFTs. Where the concept needs help (thus all the "relatively prime" algorithms) is with sampled signals, where aliasing or imaging happens, and where finite record lengths introduce artifacts without windowing (or with, just fewer/smaller artifacts). I no longer have access to the Standards (unless I pay) but have old code that handles those conditions to create test signals. Essentially you need a set that is not only prime, but also "stays prime" after sampling, and a data set that ends at the end of the record so you do not have to window. The catch is, the last time I used the code was many years ago using Mathcad, and I have not bought a current license to load the files again. I still have a Matlab license, but the Matlab code was developed at work and they kept it when I left. I suppose I could just break down and buy one of the Standards since I think they all use the same scheme (at least when I was involved with them).

My current code just uses odd ratios or primes on the record length without all the extra code to check boundary conditions.

I'd guess the answer is out there, somewhere, on the 'net...
 
OP
pkane

pkane

Master Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
5,732
Likes
10,413
Location
North-East
Any prime sequence should work IIRC, as long as you do not sample the signal in time and have infinite-length FFTs. Where the concept needs help (thus all the "relatively prime" algorithms) is with sampled signals, where aliasing or imaging happens, and where finite record lengths introduce artifacts without windowing (or with, just fewer/smaller artifacts). I no longer have access to the Standards (unless I pay) but have old code that handles those conditions to create test signals. Essentially you need a set that is not only prime, but also "stays prime" after sampling, and a data set that ends at the end of the record so you do not have to window. The catch is, the last time I used the code was many years ago using Mathcad, and I have not bought a current license to load the files again. I still have a Matlab license, but the Matlab code was developed at work and they kept it when I left. I suppose I could just break down and buy one of the Standards since I think they all use the same scheme (at least when I was involved with them).

My current code just uses odd ratios or primes on the record length without all the extra code to check boundary conditions.

I'd guess the answer is out there, somewhere, on the 'net...

Primes made sense to me, since no harmonic distortion will ever overlap the primary tones (harmonics are never prime, by definition), and a sum of two primes or any even number of primes will never fall on a prime, since they are all even numbers. I don't see a huge differences in results with any of these sequences, including log-linear that Amir is using and that's confirmed by the tiny overlap numbers I've computed for NID and primes. So, while this is curious and was a fun exercise, I don't know that it'll make a much better "single measurement" as @Music1969 seems to hope it will ;)

I've done most of this testing a couple of years ago, and left the decoherent sequence out of Multitone, as I didn't find that it made a worthwhile difference. Maybe it will for certain kinds of devices, possibly highly non-linear?
 

Music1969

Major Contributor
Joined
Feb 19, 2018
Messages
4,680
Likes
2,851
I don't see a huge differences in results with any of these sequences, including log-linear that Amir is using and that's confirmed by the tiny overlap numbers I've computed for NID and primes. So, while this is curious and was a fun exercise, I don't know that it'll make a much better "single measurement" as @Music1969 seems to hope it will ;)
I see an increase in noise/distortion floor in my measurements compared with log-linear, as mentioned in #1,982

Using Cosmos ADC

Have you not seen that in your measurements?

I definitely don't think a single measurement is useful to determine overall performance - I only meant instead of a ranking based on single tone measurement (like ASR's SINAD ranking), if I had to choose what to make a ranking on, a multitone test would be more useful.
 
OP
pkane

pkane

Master Contributor
Forum Donor
Joined
Aug 18, 2017
Messages
5,732
Likes
10,413
Location
North-East
I see an increase in noise/distortion floor in my measurements compared with log-linear, as mentioned in #1,982

Using Cosmos ADC

Have you not seen that in your measurements?

I definitely don't think a single measurement is useful to determine overall performance - I only meant instead of a ranking based on single tone measurement (like ASR's SINAD ranking), if I had to choose what to make a ranking on, a multitone test would be more useful.

Using Cosmos on ADI-2 Pro DAC. There's just a little more noise/harmonics/IMD with decoherent sequence, but nothing to jump up and down about :)

1663299363029.png
 

Music1969

Major Contributor
Joined
Feb 19, 2018
Messages
4,680
Likes
2,851
Hi @pkane

Can you support PCM705k and 768kHz output rates?

My ADI-2 can support this but your program stops at 384kHz

Is it easy enough?
 

Sokel

Master Contributor
Joined
Sep 8, 2021
Messages
6,208
Likes
6,323
I don't see any more stress than usual multitone with the dec freqs,what do I do wrong?

1663313705587.png
 
Top Bottom