Need Help with Precision Spectrum Analyzer

skrasms's icon

I need a program for getting precise frequency response data. I am testing external hardware and need a lot of graph data I can throw around and manipulate in MATLAB/Excel. Since I only care about the audio range, it makes the most sense to work with my soundcard. RightMark Audio Analyzer's sine sweep analyzer is what I've been using lately for guesstimates, but it has too many limitations:

*Not customizable in terms of sweep range
*Can't be scripted
*No control of external devices
*No CSV output (so easily done in Max!)
*No ASIO support
*No phase response handling from the sweep
*Not stable, it crashes very often for me

So I want to make a Max patch that does the job and addresses all of these issues. The first problem is getting accurate level measurements of sine wave amplitude. My first thought was to use the average~ rms object:

Max Patch
Copy patch and select New From Clipboard in Max.

...but that is only really accurate when the sine wave frequency is an integer division of the sample rate. When that condition isn't met, the averaging isn't synchronized to the sine wave and oscillating error appears. At low frequencies that error can be bad even with very large sample settings on the average~ object. Is there a better way?

Also, is there an easy way to calculate phase difference?

Any help would be awesome. I hope to keep the project as "open" as possible with all the code available to everyone.

Luke Hall's icon

Perhaps have a look at Tristan Jehans' [loudness~] external which is included in the CNMAT package.

lh

skrasms's icon

I just looked it up, but it seems to be OSX only. Is there anything cross-platform?

The average~ object isn't behaving well at all for me at low frequencies. Here is an example:

Max Patch
Copy patch and select New From Clipboard in Max.

mzed's icon

Quote: skrasms wrote on Sat, 18 October 2008 22:26
----------------------------------------------------
> I just looked it up, but it seems to be OSX only. Is there anything cross-platform?
>

Windows loudness:

mz

skrasms's icon

Windows Loudness really doesn't want to work on my system. It doesn't recognize the version of fftw3.dll that I have.

Tj Shredder's icon

Aaron Faulstich schrieb:
> The average~ object isn't behaving well at all for me at low
> frequencies. Here is an example:

What is wrong with it? Your snapshot~ is like a sample & hold for your
slow changing signal. I'd call it an expected result... (Think, that no
matter how many cycles you average, it wouldn't change anything in the
result you have more or less the same change at both ends. A sine wave
is not a statistical signal...)

Stefan

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com