Commit ac76077a authored by VINCENT Emmanuel's avatar VINCENT Emmanuel
Browse files

Version 2.1 - October 12, 2007

parent fbe87791
% BSS Oracle Toolbox for the computation of oracle source separation estimators.
% Version 2.1 - October 12, 2007
%
% Oracle source estimators
% bss_oracle_multifilt.m - Oracle time-domain multichannel time-invariant filtering.
% bss_oracle_monomask.m - Oracle single-channel masking using MDCT.
% bss_oracle_binmask.m - Oracle multichannel binary masking using MDCT.
% bss_oracle_pinvmask.m - Oracle multichannel masking with mixing matrix pseudo-inversion using MDCT.
% bss_oracle_bbasis_monomask.m - Oracle single-channel masking using the best adaptive CP/WP basis.
% bss_oracle_bbasis_binmask.m - Oracle multichannel binary masking using the best adaptive CP/WP basis.
% bss_oracle_bbasis_pinvmask.m - Oracle multichannel masking with mixing matrix pseudo-inversion using the best adaptive CP/WP basis.
% bss_oracle_gbasis_monomask.m - Oracle single-channel masking using the best generic CP/WP basis.
%
% Near-optimal source estimators
% bss_nearopt_multifilt.m - Oracle frequency-domain multichannel time-invariant filtering.
% bss_nearopt_monomask.m - Oracle single-channel masking using STFT.
% bss_nearopt_binmask.m - Oracle multichannel binary masking using STFT.
% bss_nearopt_pinvmask.m - Oracle multichannel masking with mixing matrix pseudo-inversion using STFT.
%
% Time-frequency transforms
% mdct.m - Modified Discrete Cosine Transform.
% imdct.m - Inverse Modified Discrete Cosine Transform.
% stft.m - Short-Term Fourier Transform.
% istft.m - Inverse Short-Term Fourier Transform.
%
% Filtering and masking functions
% apply_multifilt_temp.m - Apply time-domain multichannel time-invariant filters.
% apply_multifilt_freq.m - Apply frequency-domain multichannel time-invariant filters.
% apply_pinvmask_inst.m - Apply multichannel masks with mixing matrix pseudo-inversion using MDCT.
% apply_pinvmask_conv.m - Apply multichannel masks with mixing matrix pseudo-inversion using STFT.
%
% Auxiliary functions
% optim_coeffs.m - Oracle constrained real-valued masking coefficients for a single basis element.
% pinv_filt.m - Pseudo-inversion of a filter system.
% sdr.m - Signal to Distortion Ratio.
The files contained in the main directory and in the subdirectories doc/ and examples/ are authored by Emmanuel Vincent, Rémi Gribonval and Mark D. Plumbley and distributed under the terms of the GNU General Public License (GPL) version 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).
The music sound files contained in the subdirectory data/ are distributed under specific Creative Commons licenses. For more details about the license applying to each file, see data/LICENSES.txt.
All other files of the subdirectory data/ are license-free.
# bss_oracle
This repository contains version 2.1 of BSS Oracle dated from October 12, 2007, and previously available at http://bass-db.gforge.inria.fr/bss_oracle/.
# Purpose
BSS Oracle is a Matlab toolbox to **evaluate the best performance** achievable by a class of source separation algorithms in an evaluation framework where **reference source signals are known**. In other words, it computes the **best demixing filters** or the **best time-frequency masks** for a given mixture signal.
BSS Oracle implements oracle estimators for four classes of separation algorithms:
- multichannel time-invariant filtering,
- single-channel time-frequency masking,
- multichannel time-frequency masking,
- best basis masking.
BSS Oracle cannot separate sources blindly: it needs reference source signals to select the best separation parameters.
# Usage
Read Sections 2 and 3 of the [user guide](doc/user_guide.pdf).
Some functions of BSS Oracle (involving MDCT, CP or WP transforms) depend on the [Wavelab toolbox version 802](http://statweb.stanford.edu/~wavelab/index_wavelab802.html).
# Reproducibility
The toolbox comes with the source signals and the mixing filters used to plot the figures in [[1]](#1). To reproduce these figures, read Section 4 of the [user guide](doc/user_guide.pdf).
# References
<a id="1">[1]</a> E. Vincent, R. Gribonval, and M.D. Plumbley, ["Oracle estimators for the benchmarking of source separation algorithms"](https://hal.inria.fr/inria-00544194/document), *Signal Processing* 87(8), p. 1933-1950, 2007.
[2] E. Vincent and R. Gribonval, ["Blind criterion and oracle bound for instantaneous audio source separation using adaptive time-frequency representations"](https://hal.inria.fr/inria-00544207/document), in *Proc. IEEE Workshop on Applications of Signal Processing to Audio and Acoustics (WASPAA)*, 2007.
[3] E. Vincent, R. Gribonval, and M.D. Plumbley, [BSS Oracle Toolbox Version 2.1 - User Guide](doc/user_guide.pdf), 2007.
# License
The files contained in the main directory and in the subdirectories doc/ and examples/ are authored by Emmanuel Vincent, Rémi Gribonval and Mark D. Plumbley and distributed under the terms of the [GNU General Public License (GPL) version 2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).
The music sound files contained in the subdirectory data/ are distributed under specific Creative Commons licenses. For more details about the license applying to each file, see [data/LICENSES.txt](data/LICENSES.txt).
All other files of the subdirectory data/ are license free.
\ No newline at end of file
function Se=apply_multifilt_freq(X,W,M)
% APPLY_MULTIFILT_FREQ Apply frequency-domain demixing matrices using STFT
% with sine window.
%
% Se=apply_multifilt_freq(X,W)
% Se=apply_multifilt_freq(X,W,M)
%
% Inputs:
% X: I x T matrix containing the mixture signals
% W: J x I x (L/2+1) table containing complex demixing matrices for positive
% frequencies, with L being the length of the STFT window in samples
% M: step between successive windows in samples (must be even, a divider of
% L and smaller than L/2) (default: L/2)
%
% Output:
% Se: J x (N*M) matrix containing the demixed signals with N=ceil(T/M)
%
% Reference:
% E. Vincent, R. Gribonval and M.D. Plumbley, "Oracle estimators for the
% benchmarking of source separation algorithms," Signal Processing 87(8),
% p. 1933-1950, 2007, Section 4.4.
%
% See also stft, istft.
%%% Errors and warnings %%%
if nargin<2, error('Not enough input arguments.'); end
[I,T]=size(X);
[J,Iw,L]=size(W);
if I>T, error('Mixture signals must be in rows.'); end
if I~=Iw, error('The number of colums of the demixing matrices must be equal to the number of mixture signals.'); end
if L==2*floor(L/2), error('The number of positive frequency channels must be odd.'); end
L=2*(L-1);
if nargin<3, M=L/2; end
N=ceil(T/M);
%%% Applying demixing matrices %%%
% STFT of input data
Xf=zeros(L/2+1,N,I);
for i=1:I,
Xf(:,:,i)=stft(X(i,:),L,M);
end
% STFT of demixed signals
Sef=zeros(L/2+1,N,J);
for f=1:L/2+1,
Sef(f,:,:)=reshape(Xf(f,:,:),N,I)*W(:,:,f).';
end
% ISTFT
Se=zeros(J,N*M);
for j=1:J,
Se(j,:)=istft(Sef(:,:,j),M);
end
return;
function Se=apply_multifilt_temp(X,W)
% APPLY_MULTIFILT_TEMP Apply time-domain demixing filters.
%
% Se=apply_multifilt_temp(X,W)
%
% Inputs:
% X: I x T matrix containing the multichannel mixture signal
% W: J x I x L table containing the coefficients of the demixing filters
% (delays from -L/2+1 to L/2)
%
% Output:
% Se: J x (T+L-1) matrix containing the demixed signals
%
% Reference:
% E. Vincent, R. Gribonval and M.D. Plumbley, "Oracle estimators for the
% benchmarking of source separation algorithms," Signal Processing 87(8),
% p. 1933-1950, 2007, Section 4.1.
%%% Errors and warnings %%%
if nargin<2, error('Not enough input arguments.'); end
[I,T]=size(X);
[J,Iw,L]=size(W);
if I>T, error('Mixture signals must be in rows.'); end
if I~=Iw, error('The number of colums of the demixing filter matrix must be equal to the number of mixture signals.'); end
if L~=2*floor(L/2), error('The length of the demixing filters must be even.'); end
%%% Applying demixing filters %%%
X=[X,zeros(I,L-1)];
Se=zeros(J,T+L-1);
for j=1:J,
Se(j,:)=sum(fftfilt(reshape(W(j,:,:),I,L).',X.').',1);
end
return;
function Se=apply_pinvmask_conv(X,A,W,M)
% APPLY_PINVMASK_CONV Apply multichannel time-frequency masks
% with mixing matrix pseudo-inversion using STFT with sine window.
%
% Se=apply_pinvmask_conv(X,A,W)
% Se=apply_pinvmask_conv(X,A,W,M)
%
% Inputs:
% X: I x T matrix containing the multichannel mixture signal
% A: I x J x (L/2+1) table containing complex mixing matrices for positive
% frequencies, with L being the length of the STFT window in samples
% W: (L/2+1) x N x J table of binary coefficients indicating the source
% activity patterns with N=ceil(T/M)
% M: step between successive windows in samples (must be even, a divider of
% L and smaller than L/2) (default: L/2)
%
% Output:
% Se: I x (N*M) x J table containing the derived source images
%
% Reference:
% E. Vincent, R. Gribonval and M.D. Plumbley, "Oracle estimators for the
% benchmarking of source separation algorithms," Signal Processing 87(8),
% p. 1933-1950, 2007, Section 6.4.
%
% See also stft, istft.
%%% Errors and warnings %%%
if nargin<3, error('Not enough input arguments.'); end
[I,T]=size(X);
[Im,J,L]=size(A);
[Lw,Nw,Jw]=size(W);
if L==2*floor(L/2), error('The number of positive frequency channels must be odd.'); end
if L~=Lw, error('The number of frequency channels in the mixing matrices and the masks must be equal.'); end
L=2*(L-1);
if nargin<4, M=L/2; end
if I~=Im, error('The number of rows in the mixing matrices must be equal to the number of mixture signals.'); end
if J~=Jw, error('The number of sources in the mixing matrices and the masks must be equal.'); end
N=ceil(T/M);
if N~=Nw, error('The step between successive windows must be consistent with the number of time frames of the masks.'); end
%%% Applying multichannel masks %%%
% STFT of input data
XX=zeros(L/2+1,N,I);
for i=1:I,
XX(:,:,i)=stft(X(i,:),L,M);
end
% Source activity patterns
act=zeros(2^J,J);
for p=1:J,
act(:,p)=reshape(repmat([0 1],[2^(J-p) 2^(p-1)]),2^J,1);
end
% STFT of source images
SSe=zeros(L/2+1,N,I,J);
for p=1:2^J,
ind=find(act(p,:));
nind=length(ind);
for f=1:L/2+1,
n=find(all(reshape(W(f,:,:),N,J)==ones(N,1)*act(p,:),2));
B=pinv(A(:,ind,f));
for j=1:nind,
SSe(f,n,:,ind(j))=reshape(reshape(XX(f,n,:),length(n),I)*B(j,:).'*A(:,ind(j),f).',1,length(n),I);
end
end
end
% Source images
Se=zeros(I,N*M,J);
for i=1:I,
for j=1:J,
Se(i,:,j)=istft(SSe(:,:,i,j),M);
end
end
return;
function Se=apply_pinvmask_inst(X,A,W)
% APPLY_PINVMASK_INST Apply multichannel time-frequency masks
% with mixing matrix pseudo-inversion using MDCT with sine window.
%
% Se=apply_pinvmask_inst(X,A,W)
%
% Inputs:
% X: I x T matrix containing the multichannel mixture signal
% A: I x J real-valued mixing matrix
% W: L/2 x N x J table of binary coefficients indicating the source activity patterns
% with L being the length of the MDCT window in samples and N=ceil(T/M)
%
% Output:
% Se: I x (N*L/2) x J table containing the derived source images
%
% Reference:
% E. Vincent, R. Gribonval and M.D. Plumbley, "Oracle estimators for the
% benchmarking of source separation algorithms," Signal Processing 87(8),
% p. 1933-1950, 2007, Section 6.1.2.
%
% See also mdct, imdct.
%%% Errors and warnings %%%
if nargin<3, error('Not enough input arguments.'); end
[I,T]=size(X);
[Im,J]=size(A);
[L,Nw,Jw]=size(W);
if I~=Im, error('The number of rows of the mixing matrix must be equal to the number of mixture signals.'); end
if J~=Jw, error('The number of sources in the mixing matrix and the masks must be equal.'); end
L=L*2;
N=ceil(T/L*2);
if N~=Nw, error('The number of time frames of the masks must be consistent with the length of the mixture signals.'); end
%%% Applying multichannel masks %%%
% MDCT of input data
XX=zeros(L/2,N,I);
for i=1:I,
XX(:,:,i)=mdct(X(i,:),L);
end
% Source activity patterns
act=zeros(2^J,J);
for p=1:J,
act(:,p)=reshape(repmat([0 1],[2^(J-p) 2^(p-1)]),2^J,1);
end
% MDCT of source images
SSe=zeros(L/2,N,I,J);
for p=1:2^J,
ind=find(act(p,:));
nind=length(ind);
for f=1:L/2,
n=find(all(reshape(W(f,:,:),N,J)==ones(N,1)*act(p,:),2));
B=pinv(A(:,ind));
for j=1:nind,
SSe(f,n,:,ind(j))=reshape(reshape(XX(f,n,:),length(n),I)*B(j,:).'*A(:,ind(j)).',1,length(n),I);
end
end
end
% Source images
Se=zeros(I,N*L/2,J);
for i=1:I,
for j=1:J,
Se(i,:,j)=imdct(SSe(:,:,i,j));
end
end
return;
function [Se,W,SDR]=bss_nearopt_binmask(X,S,L,M)
% BSS_NEAROPT_BINMASK Near-optimal constrained binary time-frequency
% masks for multichannel source separation using STFT with sine window
% (coefficients derived for each time-frequency point separately).
%
% [Se,W,SDR]=bss_nearopt_binmask(X,S,L)
% [Se,W,SDR]=bss_nearopt_binmask(X,S,L,M)
%
% Inputs:
% X: I x T matrix containing the multichannel mixture signal
% S: I x T x J matrix containing the target signals (source images)
% L: length of the STFT window in samples (must be a multiple of 4)
% M: step between successive windows in samples (must be even, a divider of
% L and smaller than L/2) (default: L/2)
%
% Outputs:
% Se: I x T x J matrix containing the near-optimal estimates of the target signals
% (truncated to the same time range as the original signals)
% W: (L/2+1) x N x J table containing near-optimal masks with N=ceil(T/M)
% SDR: achieved SDR in deciBels (before truncation of the target estimates)
%
% Reference:
% E. Vincent, R. Gribonval and M.D. Plumbley, "Oracle estimators for the
% benchmarking of source separation algorithms," Signal Processing 87(8),
% p. 1933-1950, 2007, Section 6.4.
%
% See also stft, istft.
%%% Errors and warnings %%%
if nargin<3, error('Not enough input arguments.'); end
if nargin<4, M=L/2; end
[I,T]=size(X);
[Is,Ts,J]=size(S);
if T~=Ts, error('Mixture and target signals have different lengths.'); end
if I~=Is, error('Mixture and target signals have a different number of channels.'); end
if any(any(abs(X-sum(S,3)) > eps)), error('The mixture signal must be equal to the sum of the target signals.'); end
N=ceil(T/M);
%%% Computing STFT of input data %%%
XX=zeros(L/2+1,N,I);
SS=zeros(L/2+1,N,I,J);
for i=1:I,
XX(:,:,i)=stft(X(i,:),L,M);
for j=1:J,
SS(:,:,i,j)=stft(S(i,:,j),L,M);
end
end
%%% Computing near-optimal masks %%%
W=zeros(L/2+1,N,J);
% Distortion depending on the selected source
disto=zeros(L/2+1,N,J);
for j=1:J,
disto(:,:,j)=sum(abs(SS(:,:,:,j)-XX).^2,3)+sum(sum(abs(SS(:,:,:,[1:j-1 j+1:J])).^2,4),3);
end
% Constrained binary mask
[disto,ind]=min(disto,[],3);
W((1:L/2+1).'*ones(1,N)+ones(L/2+1,1)*(L/2+1)*(0:N-1)+(ind-1)*N*(L/2+1))=1;
%%% Deriving estimates of the target signals %%%
% Applying the masks
Se=zeros(I,N*M,J);
for i=1:I,
for j=1:J,
Se(i,:,j)=istft(XX(:,:,i).*W(:,:,j),M);
end
end
% SDR
SDR=sdr(reshape(Se,I*N*M,J),reshape(cat(2,S,zeros(I,N*M-T,J)),I*N*M,J));
% Truncating target signal estimates to original target length
Se=Se(:,1:T,:);
return;
function [Se,W,SDR]=bss_nearopt_monomask(x,S,L,M,mreal,mconst)
% BSS_NEAROPT_MONOMASK Near-optimal time-frequency masks for
% single-channel source separation using STFT with sine window
% (coefficients derived for each time-frequency point separately).
%
% [Se,W,SDR]=bss_nearopt_monomask(x,S,L)
% [Se,W,SDR]=bss_nearopt_monomask(x,S,L,M)
% [Se,W,SDR]=bss_nearopt_monomask(x,S,L,M,mreal)
% [Se,W,SDR]=bss_nearopt_monomask(x,S,L,M,mreal,mconst)
%
% Inputs:
% x: 1 x T vector containing the single-channel mixture signal
% S: J x T matrix containing the target signals (e.g. source images)
% L: length of the STFT window in samples (must be a multiple of 4)
% M: step between successive windows in samples (must be even, a divider of
% L and smaller than L/2) (default: L/2)
% mreal: true for real-valued masking (default)
% false for binary masking
% mconst: true when the masks are subject to a unitary sum constraint (default)
% false otherwise
%
% Outputs:
% Se: J x T matrix containing the near-optimal estimates of the target signals
% (truncated to the same time range as the original signals)
% W: (L/2+1) x N x J table containing the near-optimal masks with N=ceil(T/M)
% SDR: achieved SDR in deciBels (before truncation of the target estimates)
%
% Reference:
% E. Vincent, R. Gribonval and M.D. Plumbley, "Oracle estimators for the
% benchmarking of source separation algorithms," Signal Processing 87(8),
% p. 1933-1950, 2007, Section 5.4.
%
% See also stft, istft.
%%% Errors and warnings %%%
if nargin<3, error('Not enough input arguments.'); end
if nargin<4, M=L/2; end
if nargin<5, mreal=true; end
if nargin<6, mconst=true; end
[I,T]=size(x);
[J,Ts]=size(S);
if I>1, error('The mixture signal must be a row vector.'); end
if J>Ts, error('Target signals must be in rows.'); end
if T~=Ts, error('Mixture and target signals have different lengths.'); end
if mconst && any(abs(x-sum(S,1)) > eps), error('When computing constrained masks, the mixture signal must be equal to the sum of the target signals.'); end
if (J==2), mconst=false; end
N=ceil(T/M);
if mreal && mconst, warning('BSSOracle:IntensiveComputation','Computing constrained real-valued masks for %d\nbasis elements and %d sources. This may take some time.',(Dmax-Dmin+1)*(2^N)*K,J); end;
%%% Computing real part of STFT ratio of input data %%%
X=stft(x,L,M);
R=zeros(L/2+1,N,J);
for j=1:J,
R(:,:,j)=real(stft(S(j,:),L,M)./(X+realmin));
end
%%% Computing near-optimal masks %%%
W=zeros(L/2+1,N,J);
if mconst && mreal,
% Constrained real-valued mask
for f=1:L/2+1,
for n=1:N,
W(f,n,:)=optim_coeffs(reshape(R(f,n,:),J,1));
end
end
elseif mconst && ~mreal,
% Constrained binary mask
[val,ind]=max(R,[],3);
W((1:L/2+1).'*ones(1,N)+ones(L/2+1,1)*(L/2+1)*(0:N-1)+(ind-1)*N*(L/2+1))=1;
elseif ~mconst && mreal,
% Unconstrained real-valued mask
W=min(max(R,0),1);
else
% Unconstrained binary mask
W=(R >= .5);
end
%%% Deriving near-optimal estimates of the target signals %%%
% Applying near-optimal masks
Se=zeros(J,N*M);
for j=1:J,
Se(j,:)=istft(X.*W(:,:,j),M);
end
% SDR
SDR=sdr(Se,[S,zeros(J,N*M-T)]);
% Truncating target signal estimates to original target length
Se=Se(:,1:T);
return;
function [Se,W,SDR]=bss_nearopt_multifilt(X,S,L,M)
% BSS_NEAROPT_MULTIFILT Near-optimal demixing matrices for source separation
% by frequency-domain multichannel time-invariant filtering using STFT with
% sine window (coefficients derived for each frequency bin separately).
%
% [Se,W,SDR]=bss_nearopt_multifilt(X,S,L)
% [Se,W,SDR]=bss_nearopt_multifilt(X,S,L,M)
%
% Inputs:
% X: I x T matrix containing the multichannel mixture signal
% S: J x T matrix containing the target signals (e.g. sources or source images)
% L: length of the STFT window in samples (must be a multiple of 4)
% M: step between successive windows in samples (must be even, a divider of
% L and smaller than L/2) (default: L/2)
%
% Outputs:
% Se: J x T matrix containing the near-optimal estimates of the target signals
% (truncated to the same time range as the original signals)
% W: J x I x (L/2+1) table containing near-optimal demixing matrices
% for positive frequencies
% SDR: achieved SDR in deciBels (before truncation of the target estimates)
%
% Reference:
% E. Vincent, R. Gribonval and M.D. Plumbley, "Oracle estimators for the
% benchmarking of source separation algorithms," Signal Processing 87(8),
% p. 1933-1950, 2007, Section 4.4.
%
% See also stft, istft.
%%% Errors and warnings %%%
if nargin<3, error('Not enough input arguments.'); end
if nargin<4, M=L/2; end
[I,T]=size(X);
[J,Ts]=size(S);
if I>T, error('Mixture signals must be in rows.'); end
if J>Ts, error('Target signals must be in rows.'); end
if T~=Ts, error('Mixture and target signals have different lengths.'); end
N=ceil(T/M);
%%% Computing STFT of input data %%%
Xf=zeros(L/2+1,N,I);
for i=1:I,
Xf(:,:,i)=stft(X(i,:),L,M);
end
Sf=zeros(L/2+1,N,J);
for j=1:J,
Sf(:,:,j)=stft(S(j,:),L,M);
end
%%% Computing near-optimal demixing coefficients %%%
W=zeros(J,I,L/2+1);
for f=1:L/2+1,
% Inner products between mixture channels
G=reshape(Xf(f,:,:),N,I)'*reshape(Xf(f,:,:),N,I);
% Inner products mixture channels and targets
D=reshape(Xf(f,:,:),N,I)'*reshape(Sf(f,:,:),N,J);
% Computing near-optimal demixing coefficients
W(:,:,f)=(inv(G)*D).';
end
%%% Deriving estimates of the target signals %%%
% Applying demixing matrices
Se=apply_multifilt_freq(X,W,M);
% SDR
SDR=sdr(Se,[S,zeros(J,N*M-T)]);
% Truncating target signal estimates to original target length
Se=Se(:,1:T);
return;
function [Se,W,SDR]=bss_nearopt_pinvmask(X,S,A,Ja,M)
% BSS_NEAROPT_PINVMASK Near-optimal estimator for multichannel source
% separation of possibly convolutive mixtures by time-frequency masking and
% mixing matrix pseudo-inversion using STFT with sine window
% (activity patterns derived for each time-frequency point separately).
%
% [Se,W,SDR]=bss_nearopt_pinvmask(X,S,A)
% [Se,W,SDR]=bss_nearopt_pinvmask(X,S,A,Ja)
% [Se,W,SDR]=bss_nearopt_pinvmask(X,S,A,Ja,M)
%
% Inputs:
% X: I x T matrix containing the multichannel mixture signal
% S: I x T x J table containing the target signals (source images)
% A: I x J x (L/2+1) table containing complex mixing matrices for positive
% frequencies (may be different from the ones actually used to generate S),
% with L being the length of the STFT window in samples
% Ja: number of active sources per time-frequency point (by default or if Ja=0,
% the best number is estimated for each time-frequency point)
% M: step between successive windows in samples (must be even, a divider of
% L and smaller than L/2) (default: L/2)
%
% Outputs:
% Se: I x T x J table containing the near-optimal estimates of the target signals
% (truncated to the same time range as the original signals)
% W: (L/2+1) x N x J table of binary coefficients indicating near-optimal
% source activity patterns with N=ceil(T/M)
% SDR: achieved SDR in deciBels (before truncation of the target estimates)
%
% Reference:
% E. Vincent, R. Gribonval and M.D. Plumbley, "Oracle estimators for the
% benchmarking of source separation algorithms," Signal Processing 87(8),
% p. 1933-1950, 2007, Section 6.4.
%
% See also stft, istft.
%%% Errors and warnings %%%
if nargin<3, error('Not enough input arguments.'); end
if nargin<4, Ja=0; end
[I,T]=size(X);
[Is,Ts,J]=size(S);
[Im,Jm,L]=size(A);
if L==2*floor(L/2), error('The number of positive frequency channels must be odd.'); end
L=2*(L-1);
if nargin<5, M=L/2; end
if T~=Ts, error('Mixture and target signals have different lengths.'); end
if I~=Is, error('Mixture and target signals have a different number of channels.'); end
if I~=Im, error('The number of rows in the mixing matrices must be equal to the number of mixture signals.'); end
if J~=Jm, error('The number of columns in the mixing matrices must be equal to the number of sources.'); end
if Ja>J, error('The number of active sources must be smaller than the number of sources.'); end