Code covered by the BSD License  

Highlights from
Echo Canceller Workbook targeting a dsPIC

image thumbnail

Echo Canceller Workbook targeting a dsPIC

by

 

22 Jan 2008 (Updated )

This set of models and word documents show an echo canceller development workflow.

ec_data_single.m
%% Echo Cancellation Data Specification (Single Precision)

% This file is best navigated using "Show cell titles"
% Note that this is an m-script which means all variables
% are evaluated in the base workspace.
%
% Signal Objects Note:
% Since multiple signals in model will have this name it is 
% important to explicitly resolve these signals in the model's
% Configuration Parameters Dialog
%     Diagnostics -> Data Validity -> Explicit Only
%   Copyright 2008 The MathWorks, Inc.

%% Model parameters
pic_frame_size = 80;
Fs = 8000;
Ts = 1/Fs;
mpt_dimensions = [pic_frame_size 1];
ec_length = 24;
ec_window_len = 256;   % 256/8000 = 32 msec should be long enough to capture echo energy.

%% Input Signal: rin_linear
rin_linear = mpt.Signal;
rin_linear.SamplingMode ='Frame based';
rin_linear.Dimensions = mpt_dimensions;
rin_linear.Description = 'Far End Voice';
rin_linear.DataType = 'single';
rin_linear.RTWInfo.StorageClass = 'Auto';

%% Input Signal: sin_linear
sin_linear = mpt.Signal;
sin_linear.SamplingMode ='Frame based';
sin_linear.Dimensions = mpt_dimensions;
sin_linear.Description = 'Near end voice plus echo';
sin_linear.DataType = 'single';
sin_linear.RTWInfo.StorageClass = 'Auto'; 

%% Input Signal: sout_linear
sout_linear = mpt.Signal;
sout_linear.SamplingMode ='Frame based';
sout_linear.Dimensions = mpt_dimensions;
sout_linear.Description = 'Echo Cancelled Output (near end)';
sout_linear.DataType = 'single';
sout_linear.RTWInfo.StorageClass = 'Auto';

%% Input Signal: Echo Cancellor Weights (Wts)
Wts = mpt.Signal;
Wts.SamplingMode ='Sample based';
Wts.Dimensions = ec_length;
Wts.Description = 'Echo Cancellor Taps';
Wts.DataType = 'single';
Wts.RTWInfo.StorageClass = 'Auto';

%% Input Signal: enable
enable = mpt.Signal;
enable.SamplingMode = 'Sample based';
enable.Dimensions = 1;
enable.Description = 'Enable the Echo Canceller';
enable.DataType = 'single';
enable.RTWInfo.StorageClass = 'Auto';

%% Input Signal: mu
mu = mpt.Signal;
mu.SamplingMode = 'Sample based';
mu.Dimensions = 1;
mu.Description = 'Echo Canceller Step Size';
mu.DataType = 'single';
mu.RTWInfo.StorageClass = 'Auto';

%% Input Signal: reset
reset = mpt.Signal;
reset.SamplingMode = 'Sample based';
reset.Dimensions = 1;
reset.Description = 'Clear the echo canceller taps to all zeros';
reset.DataType = 'single';
reset.RTWInfo.StorageClass = 'Auto';

%% speaker to mic parms
spkr_to_mic_delay = 2;
spkr_to_mic_filt = spkr_to_mic_filt_24;
ideal = spkr_to_mic_filt.Numerator;
spkr_to_mic_gain = 1;

%% talker to mic parms
talker_to_mic_delay = 1;
talker_to_mic_filt = near_to_mic_filt_ws_0p6;
talker_to_mic_gain = 1;

Contact us