Skip to content

Commit

Permalink
Audio: Multiband-DRC: Fix paths after move of scripts
Browse files Browse the repository at this point in the history
The paths to topology and sof-ctl blobs are updated. The paths
to other setup scripts (common, crossover, drc, eq) are set with
a new helper function multiband_drc_paths.m.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
  • Loading branch information
singalsu authored and kv2019i committed Sep 10, 2024
1 parent fce09fc commit 1a27843
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 16 deletions.
4 changes: 0 additions & 4 deletions src/audio/multiband_drc/tune/drc_gen_quant_coefs.m
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
function drc_coefs = drc_gen_quant_coefs(num_bands, sample_rate, params);

addpath ../drc

for i = 1:num_bands
coefs = drc_gen_coefs(params(i), sample_rate);
drc_coefs(i) = drc_generate_config(coefs);
end

rmpath ../drc

end
20 changes: 12 additions & 8 deletions src/audio/multiband_drc/tune/example_multiband_drc.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ function example_multiband_drc()

function export_multiband_drc(prm)

multiband_drc_paths(true);

% Set the parameters here
tplg1_fn = sprintf("../../topology/topology1/m4/multiband_drc_coef_%s.m4", prm.name); % Control Bytes File
tplg2_fn = sprintf("../../topology/topology2/include/components/multiband_drc/%s.conf", prm.name); % Control Bytes File
sof_tools = '../../../../tools';
tplg1_fn = sprintf("%s/topology/topology1/m4/multiband_drc_coef_%s.m4", sof_tools, prm.name); % Control Bytes File
tplg2_fn = sprintf("%s/topology/topology2/include/components/multiband_drc/%s.conf", sof_tools, prm.name); % Control Bytes File
% Use those files with sof-ctl to update the component's configuration
blob3_fn = sprintf("../../ctl/ipc3/multiband_drc/%s.blob", prm.name); % Blob binary file
alsa3_fn = sprintf("../../ctl/ipc3/multiband_drc/%s.txt", prm.name); % ALSA CSV format file
blob4_fn = sprintf("../../ctl/ipc4/multiband_drc/%s.blob", prm.name); % Blob binary file
alsa4_fn = sprintf("../../ctl/ipc4/multiband_drc/%s.txt", prm.name); % ALSA CSV format file
blob3_fn = sprintf("%s/ctl/ipc3/multiband_drc/%s.blob", sof_tools, prm.name); % Blob binary file
alsa3_fn = sprintf("%s/ctl/ipc3/multiband_drc/%s.txt", sof_tools, prm.name); % ALSA CSV format file
blob4_fn = sprintf("%s/ctl/ipc4/multiband_drc/%s.blob", sof_tools, prm.name); % Blob binary file
alsa4_fn = sprintf("%s/ctl/ipc4/multiband_drc/%s.txt", sof_tools, prm.name); % ALSA CSV format file

endian = "little";

Expand Down Expand Up @@ -116,6 +119,8 @@ function export_multiband_drc(prm)
drc_params(4).band_lower_freq = prm.band_lower_freq(4) / nyquist;

% Generate Emphasis/Deemphasis IIR filter quantized coefs struct from parameters


[emp_coefs, deemp_coefs] = iir_gen_quant_coefs(iir_params);

% Generate Crossover quantized coefs struct from parameters
Expand All @@ -128,7 +133,6 @@ function export_multiband_drc(prm)
drc_coefs = drc_gen_quant_coefs(num_bands, sample_rate, drc_params);

% Generate output files
addpath ../common

% Convert quantized coefs structs to binary blob
blob8 = multiband_drc_build_blob(num_bands, enable_emp_deemp, emp_coefs, ...
Expand All @@ -145,6 +149,6 @@ function export_multiband_drc(prm)
sof_ucm_blob_write(blob4_fn, blob8_ipc4);
alsactl_write(alsa4_fn, blob8_ipc4);

rmpath ../common
multiband_drc_paths(false);

end
4 changes: 0 additions & 4 deletions src/audio/multiband_drc/tune/iir_gen_quant_coefs.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@
bits_gain = 16; % Q2.14
qf_gain = 14;

addpath ../eq

quant_coefs = cell(1, 2);
for i = 1:length(coefs)
coef = cell2mat(coefs(i));
Expand All @@ -88,8 +86,6 @@

quant_coefs = cell2mat(quant_coefs);

rmpath ../eq

end

function [bq1, bq2] = stage_gain_adjust(prev_bq1, prev_bq2)
Expand Down
33 changes: 33 additions & 0 deletions src/audio/multiband_drc/tune/multiband_drc_paths.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
function multiband_drc_paths(enable)

% multiband_drc_paths(enable)
% enable - set to true to enable needed search path
% set to false to disable the search paths
%

% SPDX-License-Identifier: BSD-3-Clause
%
% Copyright (c) 2024, Intel Corporation. All rights reserved.

common = '../../../../tools/tune/common';
crossover = '../../../../tools/tune/crossover';
drc = '../../../../tools/tune/drc';
eq = '../../../../tools/tune/eq';
# After #9215 merge use this:
# crossover = '../../crossover/tune';
# After #9188 merge use this:
# drc = '../../drc/tune';
# After #9187 merge use this:
# eq = '../../eq_iir/tune';
if enable
addpath(common);
addpath(crossover);
addpath(drc);
addpath(eq);
else
rmpath(common);
rmpath(crossover);
rmpath(drc);
rmpath(eq);
end
end

0 comments on commit 1a27843

Please sign in to comment.