Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

FFT-based Audio Analyzer

Post any examples or modules that you want to share here

Re: FFT-based Audio Analyzer

Postby steph_tsf » Mon Jul 22, 2013 12:09 pm

Tronic wrote:I believe that the delay is generated by use of a card that is not ASIO.
Indeed. I just made a Dirac digital generator (about 3 Hz recurrent frequency) used as Gen. I'm sending the Dirac output to Line-Out, grabbing it back on Line-In. In my .fsm, I'm adding the two signals using the "Stream Add" primitive. Using the STEM examples Storage Scope, I graph the resulting signal on screen. As audio card, I'm using a CM6206 chip (multichannel audio on USB) driven by Direct Sound.

I thus see the time arrival difference between the two signals, very clearly. In my .fsm I have a 1-to-4096 samples delay that I can adjust for time-aligning the Gen Dirac with the Line-In Dirac.

There can be thousands of samples delay between the digital domain "Dirac Gen", and the "Left In" having seen the non-ASIO audio buffers, USB, DAC, ADC, again USB, and again non-ASIO buffers.

Funny (or not), while running the .fsm with audio "On", each time I'm saving the .fsm on my harddisk (file menu .. save), I see the delay changing. Doing so I can see delays of 2550 samples, 3645 samples, 3768 samples, 2744 samples, etc.

That's pure evil !
Is ASIO better?
Is ASIO okay when used through USB (multichannel audio adapter on USB)?
What about ASIO4ALL?
steph_tsf
 
Posts: 249
Joined: Sun Aug 15, 2010 10:26 pm

Re: FFT-based Audio Analyzer

Postby steph_tsf » Thu Jul 25, 2013 12:41 pm

Here is an upgrade following Michael Anton advice:
- the mouse is now okay, always transforming into a hand when hovering the controls
- the Properties are now okay, with a clean Properties panel enabling to change the curves colours

http://www.dsprobotics.com/support/viewtopic.php?f=2&t=1590&p=7051#p7051

I added a new "open Scope" button at the bottom, displaying the time-domain signals. Currently I'm only using such modality when sending a Dirac pulse, otherwise Flowstone crashes because of CPU overload when drawing lots of lines on screen. As I wrote in the previous post, watching the time-domain waveforms using the new "open Scope" modality, I remain perplex, seeing the huge delay between "Gen" and "Right-In".

The attached screenshot is the transfer function (gain, phase, reconstructed impulse response) of a Logitech z120 speaker. As you can see, when the delays are natively equalized, using Left_In as analog loopback signal reference, the analysis is perfectly carried out, delivering clean results, actually cleaner than most commercially available analyzers. And this is using a plain and simple SWEEX SC016 USB audio card.
Attachments
FFT-based Spectrum Meter and Audio Analyzer v1.03 (standalone).png
FFT-based Spectrum Meter and Audio Analyzer v1.03 (standalone).png (47.45 KiB) Viewed 15820 times
FFT-based Spectrum Meter and Audio Analyzer v1.03 (standalone).fsm
(991.21 KiB) Downloaded 1326 times
steph_tsf
 
Posts: 249
Joined: Sun Aug 15, 2010 10:26 pm

Re: FFT-based Audio Analyzer

Postby steph_tsf » Sat Jul 27, 2013 4:09 am

Here is an update adding one channel, improving the flexibility and improving the user interface.

The Analyzer is now 5-channel, including the reference channel.

The same .fsm is now good for :
- being incorporated into your own .fsm (Barebone mode) featuring 5 signal inputs and 1 generator signal output,
- analyzing the built-in BiQuad IIR Filter used as tutorial (Software D.U.T. mode),
- analyzing any hardware D.U.T. hooked on the sound card (Hardware D.U.T. mode).

The "channel Assignment" menu is gone, superseded by the Barebone / Software D.U.T. / Hardware D.U.T. mode selector (top left).

There is a new button labelled "show Help" (bottom right) displaying the block diagram corresponding to the mode selection currently in use.
While in Hardware D.U.T. mode, the Help text is clear about the Loopback Cable that's required.

Q: Why 5 channels now?
A: Because you need 5 channels for properly analyzing a 3-way XOVER. See it in action here :
http://www.dsprobotics.com/support/viewtopic.php?f=3&t=1593

Cheers,
Steph
Attachments
FFT-based Spectrum Meter and Audio Analyzer v1.04.png
FFT-based Spectrum Meter and Audio Analyzer v1.04.png (59.29 KiB) Viewed 15794 times
FFT-based Spectrum Meter and Audio Analyzer v1.04.fsm
(840.21 KiB) Downloaded 1407 times
steph_tsf
 
Posts: 249
Joined: Sun Aug 15, 2010 10:26 pm

Re: FFT-based Audio Analyzer

Postby steph_tsf » Sat Jul 27, 2013 11:54 am

More about the Software D.U.T. mode.

See the attached Block Diagram.
You can view it while running the Analyzer, activating the "show Help" button (bottom right).
If you get another block diagram, it means that you are running another Analyzer mode.
Please select the appropriate Analyzer mode using the Mode Selector (top left).

Let's go back to the Block Diagram.
On the left side we select the signal that will be conveyed into the Software D.U.T. We get the choice between:
- exploiting the built-in Generator
- exploiting the sound card Left In (this is the Left Analog-to-Digital converter of your sound card)
- exploiting the sound card Right In (this is the Left Analog-to-Digital converter of your sound card)
The D.U.T. can thus be fed by digital-domain signals coming from the Generator, or Speech and Music realtime grabbed by the sound card.

The 3-to-1 selector output feeds :
- the Software D.U.T. input
- the ch1 Analyzer input
This way, the Analyzer gets his Reference signal. One need to tell the Analyzer that ch1 needs to be considered as Reference signal. This is done in the Analyzer control panel, setting the "reference" to ch1.

In this particular case, the Software D.U.T. consists on a BiQuad IIR Filter. For controlling it, we need to specify five parameters using five knobs :
- Fc is the resonance frequency to be set anywhere between 100 Hz and 10 kHz
- Q is the resonance factor (quality factor) to be set anywhere between 0.001 and 4 (a zero value would produce a Math overflow)
- LPF is the Lowpass contribution to be set anywhere between -1.0 and +1.0
- BPF is the Bandpass contribution to be set anywhere between -1.0 and +1.0
- BPF is the Highpass contribution to be set anywhere between -1.0 and +1.0
Double-clicking on a knob resets its to the median position.

Quite important to know is that the control box hosting the five knobs is relying on the Bilinear Transform, defining the way the p-domain (analog BiQuad built using two integrator) gets mapped to the z-domain (digital BiQuad built using two delay cells).

A popular Bilinear Transform implementation for BiQuad IIR filters, is the one published by Robert Bristow-Johnson (the RBJ Audio EQ Cookbook) here http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt.

The BiQuad IIR Filter output feeds the ch2 Analyzer input.

One need to tell the Analyzer that ch2 needs to be analyzed and plotted. This is done in the Analyzer control panel, with ch2 attribute set to "Analyzer". Actually, as only ch2 needs to be plotted, all the other channels (ch1, ch3, ch4, ch5) need to have their attribute set to "Off".

One need to tell the Analyzer that ch2 Impulse Response needs to be computed and plotted. This is done in the Analyzer control panel, setting "impulse" to ch2.

Looking again to the block diagram, we see the sound card Digital-to-Analog section receiving two signals. Doing so you can listen what's happening through your PC headphone or speakers :
- Left Out delivers the reference signal (D.U.T. input signal)
- Right Out delivers the filtered signal (D.U.T. output signal)

Specifying a pure Lowpass (LPF = +1.0 while BPF and HPF are set to zero), you will realize the kind of error the Bilinear Transform exhibits, with Fc set past 4 kHz.
Configure the Generator. Select the Pink Noise, with a -20 dB amplitude.
You should hear the Generator through your PC speakers or headphones.
Configure the IIR BiQuad filter used as Software D.U.T.
Select the Generator as source.
Set Fc to 4000 Hz and Q to 0.707.
Set LPF to +1.00, leaving BPF HPF to zero.
You should hear the IIR BiQuad filtered signal through your PC speakers or headphones.
Start the Analyzer, specifying a 0.50 sec. timebase and a 4096 samples FFT length.
Look the Gain asymptot plot. This is not -12 dB/octave anymore.
For restoring a proper -12 dB/octave asymptot, the HPF contribution needs to be set to -0.021.
This is the kind of knowledge the Analyzer can deliver to you. Pretty amazing, isn't?
Check the ch2 Phase plot also, selecting "Gain Phase" instead of "Gain" in the Analyzer control panel.
Mostly, I'm using the "True Segments" rendering for the Gain and Phase plots. I like it.
Check also the ch2 Impulse Response. For that one I'm using the "True bars" rendering.

The blue vertical bar showing on the Block Diagram is a mute line, setting the audio to zero when the Software D.U.T. mode is not in use. It has no effect on the measurements.
Attachments
Software D.U.T.png
Software D.U.T.png (31.15 KiB) Viewed 15787 times
steph_tsf
 
Posts: 249
Joined: Sun Aug 15, 2010 10:26 pm

Previous

Return to User Examples

Who is online

Users browsing this forum: No registered users and 35 guests

cron