Get n-th harmonic of acquisition by API

I’ve been using Arta and Steps for years before I got the QA403. The Steps program was able to create a graph which plots the first 6 harmonics over frequency which is assential when designing an amplifier. I think I need the same data wich is displayed in the THD Bargraph visualizer. I could not find any sourcecode of [ThdBargraph] How can I get the n-th harmonic via the REST api after doing an acquisition? Or do I have to process the fft data myself for that?
I want to create an opensource c# program which plots this graph:

Thanks.

1 Like

I think I figured it out. I got the idea to use wireshark and see what ThdBargraph does.

I will create an application which sets the generator to a certain frequency and then I will get the harmonics by calculating the bins and get their value with PeakDbv.

1 Like

Hi @breedj, via REST you can run an acquisition, and then ask the REST server to compute the THD for you. For example, if you did the acq with a 1 kHz tone and wanted to look at all harmonics through 20k that would be:

GET localhost:9402/ThdDb/1000/20000

Note that you can adjust the stop frequency for the calc. So, if you want to look at the THD with a 100 Hz fundamental with just the harmonics up to and including 500 Hz you could issue:

GET localhost:9402/ThdDb/100/500

That would return the left/right channel THD ratio expressed in dB. You can also do ThdPct if you’d like in percent.

BTW, have you seen the REST API? Hit the link below with the QA40x app running and it should dump the entire API.

http://localhost:9402/

Thanks Matt. I’ve discovered the api and already started using it. I think it is perfect for what I like to do and easy to use. I will use PeakDbv instead of ThdDb because it does not give me the distortion of the single harmonics, only a range where the start is always the fundamental. But I have tested PeakDbv where you can specify a custom frequency range and it is perfect for what I need. And I noticed I can also use /Data/Frequency/Input and do my own calculations as well.

I will post a link to the repository of my program after I’ve have made a working version. I will first compare the results with some other systems like Audio Precision.