Spectral Subtraction in Java - using JMathLib

风流意气都作罢 提交于 2019-12-11 03:42:52

问题


i'm new to Android and DSP. i'm implementing the Spectral Subtraction algorithm thanks

my goal is to use this algorithm over a phone call stream buffer

i'm trying to figure how to implement this code from the Matlab implementation of Spectral Subtraction i am using.

Matalb code:

function Seg=segment(signal,W,SP,Window)

% SEGMENT chops a signal to overlapping windowed segments
% A= SEGMENT(X,W,SP,WIN) returns a matrix which its columns are segmented
% and windowed frames of the input one dimentional signal, X. W is the
% number of samples per window, default value W=256. SP is the shift
% percentage, default value SP=0.4. WIN is the window that is multiplied by
% each segment and its length should be W. the default window is hamming
% window.
% 06-Sep-04
% Esfandiar Zavarehei

if nargin<3
    SP=.4;
end
if nargin<2
    W=256;
end
if nargin<4
    Window=hamming(W);
end
Window=Window(:); %make it a column vector

L=length(signal);
SP=fix(W.*SP);
N=fix((L-W)/SP +1); %number of segments

Index=(repmat(1:W,N,1)+repmat((0:(N-1))'*SP,1,W))';
hw=repmat(Window,1,N);
Seg=signal(Index).*hw;

my question is should i use JMathLib in order to implement functions like "repmat" which is a matrix replication function or should i implement it in another way. remember i'm running on Android based smartphones. thanks Gilad

来源:https://stackoverflow.com/questions/10367532/spectral-subtraction-in-java-using-jmathlib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!