This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

the method to overcome the noise of VA5505 's audio signal processing demo's discontinuty( noise)

In the VA5505's audio example, when you played your own audio signal to the codec, and then transfer it into DSP to do a lowpass filtering , you will hear some unexpected noise mixed in your filtered output audio signal if you use a earphone to hear it .

The noise you hear is a result of the block processing required by the FFT. The stream of audio samples is broken into blocks, and processed as blocks, then recombined into a single stream prior to output. The Constant Overlap and Add (COLA) method used to recombine blocks, but there is a small discontinuity between blocks causing periodic noise.

 Overlap-add have to do with accounting for FFT periodicity when applied to segmented or non-periodic data, for example when performing convolution or correlation in the frequency domain. In such case, perfect reconstruction of segmented data is required so overlap-add is applied to time domain data *after* inverse FFT.

Overlap *prior* to FFT, done in the time domain and used in STFT analysis (as one example), is more basic. Normally overlap is combined with a time domain window (Hamming, Hanning, Blackman, etc) to avoid "edge noise"; i.e. noise effects due to arbitarily segmenting continuous time domain data (like speech or other audio). Typically a combination like 50% overlap and Hanning window is used... this eliminates wide-band noise due to segmentation, while still allowing each time domain sample to "contribute equally" to the final STFT result (i.e. compensate for window weighting). The tradeoff is some loss in frequency domain precision.  (if there are some point that is not  proper, we like to discuss and improve it )


  • Which "VA5505" audio example do you refer to? could you be specific?

    Thanks

    wen

  • Kieran,

    I agree with what you have said about using windows with COLA to minimize noise between blocks of samples.

    Are you modifying the FFT Filter Demo code to fix this noise issue?

    It is available online: http://c5505-ezdsp.googlecode.com/files/VC5505_FFT_Filter_Demo_2010-05-11.zip

    I am willing to assist you with these changes to get rid of that noise.

    Let me know.

    Regards,
    Mark

  • i'm new to signal processing, and i will try my best to do this .  and i 'll put on the things that i feel it's useful to solve this problem. and also i will put on my puzzle

    first, i think , i should use Matlab to do the simulation . then do it on my dsp  and  one for all., all for one,

    Example of frame-based processing: ()
    %          INC=20                                           % set frame increment
    %          NW=INC*2                                     % oversample by a factor of 2 (4 is also often used)
    %          S=cos((0:NW*7)*6*pi/NW);        % example input signal
    %          W=sqrt(hamming(NW+1)); W(end)=[];      % sqrt hamming window of period NW
    %          F=enframe(S,W,INC);                  % split into frames
    %          ... process frames ...
    %          X=overlapadd(F,W,INC);              % reconstitute the time waveform (omit "X=" to plot waveform)

    %    Copyright (C) Mike Brookes 1997
    %      Version: $Id: enframe.m,v 1.7 2009/11/01 21:08:21 dmb Exp $ ( extract from the Matlab )

    thanks

  • %enframe with hamming wondow's square root , hop size = window length
    [SampleSig, Fs, Bits] = readwav('1.wav');
    SampleSig = SampleSig(:,1);        
    %INC = 257;                          %帧移 hop size
    %NW = INC*2;                         %窗长=514 window size
    INC = 514;                           %hop size
    NW = INC;                            %window length  = hop size
    W=sqrt(hamming(NW+1)); W(end)=[];    %create hamming window's squre root
    F = enframe(SampleSig,W,INC);        %enframing with hamming window's squre root
    [frameNum,frameLen] = size(F);       %get the frame count and frame length

    %design the lowpass filter with cutoff frequency 6000Hz, sampling frequency 48kHz and the tap is 511
    % All frequency values are in Hz.
    Fs = 48000;      % Sampling Frequency
    Order = 511;     % Order
    Fc   = 6000;     % Cutoff Frequency
    flag = 'scale';  % Sampling Flag
    % Create the window vector for the design algorithm.
    win = hamming(Order+1);
    % Calculate the coefficients using the FIR1 function.
    b  = fir1(Order, Fc/(Fs/2), 'low', win, flag);  %b in Z plain
    Hd = dfilt.dffir(b);
    [H,w] = freqz(Hd,Order);                        %change coeffients in Z plain into coeffients in frequency

    fftLen = NW+Order-1;                            %fft length
    H = [H',zeros(1,fftLen-Order)];                 %
    frameInFreq = zeros(frameNum, fftLen);    % save fft transform
    outputInFreq = zeros(frameNum,fftLen);        
    outputInTime = zeros(frameNum,fftLen);       

    %fft-lowpass filter-ifft
    for i = 1:frameNum
       frameInFreq(i,:) = fft(F(i,:),fftLen);                         %fft transform
       outputInFreq(i,:) = frameInFreq(i,:).* H;               %filtering,
       outputInTime(i,:) = real( ifft(outputInFreq(i,:),fftLen) );   %ifft                                                                                            
    end


    % synthesis the frame signal
    W=sqrt(hamming(fftLen+1)); W(end)=[]; 
    overlapLen = Order-1;
    frameOutput = overlapadd(outputInTime,W,fftLen-overlapLen);  %overlapadd
    %sound(SampleSig.*0.8,Fs);
    sound(frameOutput.*15,Fs);   % amplify the volume of output signal

    as the above method , it still has a little period noise,  and now , i want to use hop size is half of the window legth to enframe, and then do a lowpass filtering,  now i have a problen on how to synthesis the frame filtered,?  if we still use the previous overlap-add moethod, the output is even worse.

    thanks

  • i used the matlab to simulate the overlaping enframe with the hop size = window size/4, the result is better, however , you can heard still a little bit noise, and as the following red shows, if you change the hop size to be INC = NW/8 or INC = NW/16, the result will get more better, but this will also bring out an another problem, the more overlaping in enframing, the more momory it needs for the matlab to calculate. in my computer, when i change to INC = NW/8, the matlab says "out of memory" and i think, this problem will show again, if you use the DSP to do it . so i think a balance is needed between the real time demands, storing volume and reducing this noise.

    %分帧有重叠,加hamming窗.
    [SampleSig, Fs, Bits] = readwav('1.wav');
    SampleSig = SampleSig(:,1);        
    NW = 512;                           %窗长=215 window size
    INC = NW/4;                         %帧移 hop size = 512/4
    %W=sqrt(hamming(NW+1)); W(end)=[];    %create hamming window's squre root
    W=hamming(NW+1); W(end)=[];         %hamming窗 create hamming window and squre root it
    F = enframe(SampleSig,W,INC);       %分帧、加窗 enframe with hamming window
    [frameNum,frameLen] = size(F);      %求帧个数、帧长度 get the frame number and frame length = window size

    %design the lowpass filter with cutoff frequency 6000Hz, sampling frequency 48kHz and the tap is 511
    % All frequency values are in Hz.
    Fs = 48000;      % Sampling Frequency
    Order = 511;     % Order
    Fc   = 6000;     % Cutoff Frequency
    flag = 'scale';  % Sampling Flag
    % Create the window vector for the design algorithm.
    win = hamming(Order+1);
    % Calculate the coefficients using the FIR1 function.
    b  = fir1(Order, Fc/(Fs/2), 'low', win, flag);  %b在Z域
    Hd = dfilt.dffir(b);
    [H,w] = freqz(Hd,Order);                        %转化到频域 change coeffients in Z plain into coeffients in frequency

    fftLen = NW+Order-1;                            %fft长度 fft length
    H = [H',zeros(1,fftLen-Order)];                 %使H是行向量
    frameFilterInFreq = zeros(frameNum, fftLen);     %保存滤波后信号(在频域)
    %frameFilterInTime = zeros(frameNum,fftLen);
    outputInFreq = zeros(frameNum,fftLen);          
    outputInTime = zeros(frameNum,fftLen);         

    %fft-lowpass filter-ifft
    for i = 1:frameNum
       frameFilterInFreq(i,:) = fft(F(i,:),fftLen);                  %fft transform
       outputInFreq(i,:) = frameFilterInFreq(i,:).* H;               %filtering,时域卷积=频域乘积
       outputInTime(i,:) = real( ifft(outputInFreq(i,:),fftLen) );   %ifft                                                                                            
    end
    %合成输出
    %W=sqrt(hamming(fftLen+1)); W(end)=[];    %create hamming window's squre root
    W=hamming(fftLen+1); W(end)=[]; 
    overlapLen = Order-1+3*NW/4;
    frameOutput = overlapadd(outputInTime,W,fftLen-overlapLen);  %overlapadd
    %sound(SampleSig.*0.8,Fs);
    %sound(frameOutput.*12,Fs);