Exporting Loudspeaker data from MATLAB in MLSSA format for SigmaStudio

 May 10, 2019    Antonin Novak
education    education_signals    education_measurement    education_loudspeakers    education_matlab    





SigmaStudio (a graphical development tool for DSP programming) has a block called "Speaker Response: MLSSA" that can be used for tailor-made crossover design. If you make the measurement (or speaker design) in Matlab, you can export the data to the SigmaStudio using a simple Matlab code.

An example of such measured data is provided in the loudspeakers_data_example.mat file that consists of four variables: f_axis (a frequency axis vector), H1, H2, and H3 (three complex-valued acoustic pressure vectors in the frequency domain). The following Matlab code and figure demonstrate the measured loudspeaker characteristics.



load('loudspeakers_data_example.mat');

semilogx(f_axis,20*log10(abs(H1./2e-5)),'linewidth',2); hold on
semilogx(f_axis,20*log10(abs(H2./2e-5)),'linewidth',2);
semilogx(f_axis,20*log10(abs(H3./2e-5)),'linewidth',2); hold off

xlim([20 20e3]); ylim([40 90])
xlabel('Frequency [Hz]');
ylabel('Sound Pressure Level [dB SPL]'); 



Now, the SigmaStudio requires the file to be in the MLSSA format (maximum-length-sequence system analyzer, an industry standard). See more details in this doc page.

The following Matlab code shows how to export the loudspeaker data in the MLSSA format


%% save data from speaker 1
MATRIX_1 = [f_axis 20*log10(abs(H1./2e-5))  180/pi*angle(H1)].'; 

fileID = fopen('speaker_01_mlssa.txt', 'w');
fprintf(fileID,'%12s\n', '"Woofer dB SPL (8 ohms, @0.50 meters) (High)"');
fprintf(fileID,'%12s\n', '      "Hz"  "Mag (dB)"       "deg"');
fprintf(fileID,'%0.5f,   %0.5f,   %0.5f\n', MATRIX_1);
fclose(fileID);

Data from the other two loudspeakers can be exported in the same way.


%% save data from speaker 2
MATRIX_2 = [f_axis 20*log10(abs(H2./2e-5))  180/pi*angle(H2)].'; 

fileID = fopen('speaker_02_mlssa.txt', 'w');
fprintf(fileID, '%12s\n', '"Midrange dB SPL (8 ohms, @0.50 meters) (High)"');
fprintf(fileID, '%12s\n', '      "Hz"  "Mag (dB)"       "deg"');
fprintf(fileID, '%0.5f,   %0.5f,   %0.5f\n', MATRIX_2);
fclose(fileID);

%% save data from speaker 3
MATRIX_3 = [f_axis 20*log10(abs(H3./2e-5))  180/pi*angle(H3)].'; 

fileID = fopen('speaker_03_mlssa.txt', 'w');
fprintf(fileID, '%12s\n', '"Tweeter dB SPL (8 ohms, @0.50 meters) (High)"');
fprintf(fileID, '%12s\n', '      "Hz"  "Mag (dB)"       "deg"');
fprintf(fileID, '%0.5f,   %0.5f,   %0.5f\n', MATRIX_3);
fclose(fileID);