Measuring the frequency response of an audio system

From ShawnReevesWiki
Jump to navigationJump to search
Showing the frequency response of the Bose 802C System Controller, both in full-range for 802 speakers, and biamplified for a 302 and 802 speaker system.

Sweep signal method

Sweep signal analysis using MATAA

Use Mat's Audio Analyzer, a plugin for Matlab and GNU Octave, installed in ~/MATLAB/. [1] Set up your computer to output to the system you want to test, like an equalizer; or an amplifier, speaker, and microphone.

In Octave/Matlab, generate a set of audio samples, sweeping from 22Hz to 22000Hz in 10 seconds:

[sweepvalues,t]=mataa_signal_generator('sweep_exp_smooth,44100,10,[22,22000]);

Optionally, reduce the amplitude of the resulting signal to avoid clipping later in the process:

sweepvalues=0.5*sweepvalues;

Save the values in a file to be used for tests:

sweepfile=mataa_signal_to_TestToneFile(sweepvalues,'~/MATLAB/mataa/test_signals/sweep_44100_10s_22Hz-22000Hz');

Run the signal out your soundcard's output while recording the input into an array:

[responseSignal, inputSignal, t] = mataa_measure_signal_response(sweepfile,44100,1,1);

Get just the one side of the stereo signal. you might use the other side to bypass the system, going straight from the output to the input, as a control for the soundcard:

responseLeft=responseSignal(:,1);

Get the absolute value of the envelope of the sound:

envelope=abs(mataa_signal_analytic(responseLeft));

Get the maximum of the envelope, which we will arbitrarily correspond to 0dB; or, if you want a consistent baseline for comparing responses, choose a value once for all. Omitting the semicolon allows us to review the result:

ceiling=max(envelope)

Ten times the log-base-ten of the envelope represents the decibel level of the response:

envelope_dB=10*log(envelope/ceiling)/log(10);

Save the envelope as a file:

save TestEnvelope_dB.txt envelope_dB;

The file will include a header describing the type of data, escaped by pound symbols, followed by the data:

# Created by Octave 3.8.1, Mon Feb 08 14:00:23 2016 EST
# name: envelope
# type: matrix
# rows: 441000
# columns: 1
 -6.29766324379
 -5.44543646246
 -5.33669190019
 ...

You can thin the data with awk, in this example taking only every thousandth line of the file:

awk 'NR %1000 ==0{print log($0)+2.4}' TestEnvelope_dB.txt > TestEnvelope_dB_thin.txt

References