The code contains some m-language syntax that is not supported
by Matlab. The code lines are changed to compatible with both
Octave and Matlab. The blobs computation is not changed.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch re-structures function example_multiband_drc() to
let it generate multiple differentiated configurations. The
computation of blob is moved to new function export_multiband_drc().
The script now generates default (same as before) and pass-through
blobs.
Inside the function the paths for tplg1 and tplg2 are updated as
well as locations of data blobs for sof-ctl. The run of export
function creates blobs for both tplg1 and tplg2 with SOF IPC
versions three and four.
check_create_dir() common function is added to avoid error with
missing directory for export and for warning message about
already existing directory that just using mkdir() would do.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The script example_crossover.m is converted to export 2, 3, and 4
way crossover configurations for tplg1 and tplg2.
The crossover parameters like number of sinks, pipeline ids of
sinks, sample rate, and band limits are added to generate blob
filenames.
The changes include fixes for running the script with Matlab in
addition to Octave.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch enables running example_drc.m script with Matlab.
The endifs are changed to end. And mixed usage of endfunction
and end is corrected to just end. The unnecessary
semicolons from function declarations are deleted.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch changes a bit structure of example_drc to export
conveniently several different blobs. The changed script
exports configurations blobs for disabled and enabled mode.
Two functions for IPC4 and topology2 compatibility are
generalized from EQ to common directory. The EQ and other
tools will be updated to later to use the common get_abi()
and tplg2_write() functions.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds export format for header file that alsa-utils
uses. Automatic generation is much more convenient than hand
editing when there is update need.
The patch also contains some cleanup of unused code and small
code improvement. There are no changes to exported coefficients
values.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
No more need for hard-coded blob header, sof-ctl provides
an up-to-date header so better to use it.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Use of isempty() instead of length() to the check for non-empty
variable can avoid warnings in executing code in Matlab.
The unnecessary print of variable to console is removed. E.g.
struct bs, or biquad transfer function zeros vector a.
In system() command no need to store the console output, just
check the return status.
In switch-case statements no need for comma after case and
otherwise.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch contains the changes to export EQ blobs in both tplg1
IPC3 and tplg2 IPC4 formats.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This fprintf() with missing %d causes in Matlab and octave
messed up console output. This fix prints filter order
if this issue happens. This could be caused by too high
filter specification request that was not possible to reach.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This change aligns the gains in all other conversions sets
with IPC4 that already has the same setting. The max gain of a
converter is 0 dB. It also avoids the issue of 1 dB lower gain
in 2-stage vs. 1-stage conversions.
This changes only the generate scripts. The coefficients need a
separate patch.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch updates the SRC coefficients generator scripts with
add of parameter cfg.thdn that is the min. THD+N performance. The
target gain is set to 0 dB for all conversions to be generated.
in src_param.m the default stop-band is relaxed from 70 dB to 63 dB.
It can be done because the THD+N performance check will step up the
attenuation. The default lower attenuation saves RAM in easy
simple fractions conversions.
The main change is in src_generate.m. The conversions matrix is
two pass. In the first pass the converters are designed and the
converter for same fraction and other bandwidth parameters with
highest performance is preserved. In the second pass the table
of converters is constructed and the size of filters and buffers
and other information like MCPS estimate are collected.
Other changes include reduction of plots made during batch design
and remove of some commented out code.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This test uses module interface for eq_fir.
The use of decoded 16 bit FIR blob coefficients decreases a lot
the mismatch between float reference FIR vs. SOF fixed point
implementation.
This patch adds the script tools/tune/eq/cmocka_data_eq_fir.m that
generates the files cmocka_fir_coef_2ch.h and cmocka_fir_ref.h.
The script debug_files_plot.m can be used to visualize the unit
test result and error for data that is generated if macro
DEBUG_FILES is defined.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Andrula Song <xiaoyuan.song@intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
The increase of non-32bit aligned blob sizes needs to be removed
because it can cause mismatch of blob binary header vs. actual
size. Instead error if blob size is not multiple of four bytes.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds initial version of MFCC setup tool setup_mfcc.m. It
outputs a configuration topology macro file that matches the current
Matlab concept code. The configuration can be tested in testbench
with the supplied scripts run_mfcc.sh and decode_ceps.m.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds script tools/tune/fft/export_twiddle.m. Since
the data in original twiddle.h differs by one LSB in few
items the file is replaced with one generated with the script.
The identifier 32 is added to header name and variables names
as preparation to add 16 bit FFT version.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Patch a0ff2bb277 added field .gain to configuration data for
src_generate() but the previous generator scripts were not
updated to set it. This patch fixes in them the error about
undefined gain by setting it to previous -1 dB default.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch updates the SRC tool to export same guidance for
Doxygen as added by a previous patch for coefficients
header files. The added comments to begin and end are:
/** \cond GENERATED_BY_TOOLS_TUNE_SRC */
/** \endcond */
The impacted headers remain identical so they don't need update.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds the Kconfig option COMP_SRC_IPC4_FULL_MATRIX and
adds handling to src.c. Testbench build was changed to use this
largest matrix.
The coefficients were generated with script src_ipc4_int32.m. The
new sample rates were added to test script src_test.m.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
There's need to have a 0 dB gain SRC conversion matrix while
earlier all defaulted to -1 dB. With this change the parameter
cfg.gain can be used with src_generate() function.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch helps to pass the code style check in generated header
file src_<profile>_<data type>_table.h. The error was:
CHECK: Please use a blank line after function/struct/union/enum
declarations
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch forces open of every plot to the same picture window.
Earlier version could open hundreds of windows and freeze the
computer.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The test scripts missed test component keyword change from e.g.
eqiir to eq-iir. Due to this the process_test() failed for IIR and
FIR for gain and frequency response due to wrong result expect.
The expected result is retrieved with the blob decode function. It
can be also used manually to check the filters defined in the
blob. The help texts in the decode functions needed fix. Also some
usage examples were added.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The previous patch increased the FIR length but it also triggered
a numerical issue in FIR design with long minimum phase filters. The
filter became essentially a band-stop filter and causes difficulties
in test of EQ component. Also the equalizer sounds subjectively
bad. The fix is to change the design to linear phase that always
converges.
Fixes: 0d296ce7d1
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The tdfb_controls.m4 is changed for better 15 degree control enum
spacing for beam direction. The file is with this change dedicated
for line arrays with physical limitation to -90 to +90 degrees that
is just achievable with 16 max. enum values.
The new tdfb_controls360.m4 uses the previous 30 degree spacing for
360 degrees arrays such as circular. The pipeline macros for 360
degrees are added to pipelines macros. The difference is only include
of 360 degrees controls version.
The topology development CMakeList.txt is changed to build topologies
with TDFB with single dual mono -90 to +90 degree angle steerable
beam. The stereo dual beam setup files are preserved and updated but
currently used only for testbench test for more complex configuration.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds legend to plot since it was difficult to see to
which play/capture channel which curve corresponded to. In script
selftest case a label called Reference is added to the legend.
Also an indentation issue is fixed in the script.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The 3s wait was not enough long time to wait for recording to complete
before copy for analysis so the wait is increased to 5s. The total
recording lengths were variable and not same 7s for a completed
recording.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch increases end marker seek length from 3s to 5s to
allow more drift for arecord and aplay timing for test signal.
The captured waveform is now always plotted and when start
and end markers are found the test signal is plotted with green
color.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The script mls_freq_resp.m has worked previously with Octave
while failed with Matlab because it does not have source
command. This patch ads function get_config() that reads
the configuration file, evaluates it, and returns the
needed variable.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch contains improvements to TDFB setup scripts and examples
those are related to sound direction estimation. The changes are add
of 15 degree angle spacing to enum control, add of rotated noise sound
create for sound direction testing in simulated acoustics.
The example line, circular, and xyz array scripts are updated for single
dual mono beam that is controllable in 15 degree or 30 degree steps. All
the two beam design examples are moved into example_two_beams.m.
The patch also contains noise field covariance matrix diagonal load
increase to -40 dB. I noticed uneven frequency response in some
designs due to numerical instability. The increased diagonal load makes
the automatic design procedure more robust at minimal hit in noise
suppression performance.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The loudness EQ is changed to 250 taps to create large IPC
message type. It also improves subjective quality of this
effect with better bass response. The earlier version was
made very short to fit the that time IPC size limit.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Change the default slot mapping from L_lo-L_hi-R_lo-R_hi to
L_lo-R_lo-L_hi-R_hi so slot 0/1 is for woofer and slot 2/3 is for
tweeter.
Signed-off-by: Brent Lu <brent.lu@intel.com>
This patch adds for the IIR equalized component a test with
comparison 100 ms of Octave generated output to output of the
component. The test signal is a full scale chirp signal. The
IIR response is both amplifying and attenuating to trigger as
much as possible issues with internal overflows.
All test data was generated by Octave script
cmocka_data_eq_iir.m. Re-run of script updates the used header
files the in cmocka tests directory.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Added singular value decomposition algorithm
for diagonal matrix calculation. Added filters for side
lobe artifacts.
Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
This patch adds topologies sof-apl-nocodec-demux-eq-2ch4ch.tplg and
sof-apl-nocodec-demux-eq-4ch4ch.tplg. Playback of 2ch creates 4ch
output in format L_lo, L_hi, R_lo, and R_hi. An example band-split
at 2 kHz is configured for EQ processing. The low band contains
an additional 80 Hz high-pass.
The pipeline was tested in UP2 device. The nocodec topology enables
an useful SPP loopback mode. The capture PCM is connected to DAI
loopback so this pipeline can be tested with simultaneous 2ch aplay
and 4ch arecord.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The change for topology1 was missing from various tuning
and testing scripts those access binary blob data from
topology m4 directories.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Topologies 1.0 location has been changed. This update allows the
tool to create the files into correct path.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The delay-and-sum beamformer has highest white noise gain (WNG)
performance. It's good id suppressing microphone self noise. The
beam is steered with pure delay adjust in the all-pass filter
bank. Default type is still super directive. Use DSB or SDB
as beamformer type to select.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Matlab does not support isfile(), so another command is used to
check if a file exists. The new way works both in Octave and Matlab.
The bf_defaults.m is fixed to properly initialize empty strings
to cell arrays. It's needed with minimal command like usage
as shown in SOF Docs examples.
In bf_design.m the num_filters determination is moved after array
helpers because other than line and circle do not use mic_n parameter.
The bug resulted to zero num_filters.
In bf_merge.m the unused bf3 and bf4 are removed.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch essentially adds support for steer_az/steer_el to be
vector instead of scalar. The beam off preset is added by default
automatically for N-channel in N-channel out configurations. Microphone
(x,y,z) coordinates are passed in to blob for direction of arrival
reporting.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch fixes the incorrect delaying of simulation input signal to
microphones. Instead of delaying the old code advanced the input the
more the larger the input is. E.g. It caused the tests for line arrays
to show a mirrored beam pattern.
The num_filters is replaced by mic_n (microphones count). It is the
correct count to use here though usually filters count is the same.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The plots help to understand beamformer channel filters characteristic.
Frequency response is usually all-pass type and group delays match
the delays need to time-align the waveforms from steer angle.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch improves the beamformer performance (vs. tap count) by
shifting the extract window location for IFFT output by mean of
all impulse responses center. Previously the first filter was centered
and other filters were more towards start or end of impulse response.
The change helps to cope with smaller filter length with larger size
arrays with steer angles those spread the impulse response further
away time-wise from each other.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
To support exist function - fullfile() path addition is to prevent Matlab (differently than Octave)
to give false positive with some other directory location with it's search path
Added correction to isempty.
Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
This commit adds the tools to generate the control bytes for the
multiband_drc component. To generate the control bytes, run the
example_multiband_drc.m script.
To tweak the parameters modify the values in example_multiband_drc.m
and run it.
Signed-off-by: Pin-chih Lin <johnylin@google.com>