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.

PPS BiQuad and MatLab

Other Parts Discussed in Thread: PCM3070

Anyone having a MatLab Script to convert MatLab SOS with Gain representation to PPS BiQuad coefficients they can share ?

  • Hi, Jesper,\

    I don't think so... We do have TIBQ, a small s/w utility that helps calculate the values, and most of our GUIs also calculate the required values for biquads.

    -d2 

  • Hi Don and others.

    Added some ML scripts that might be usefull.

    Can i ask you to elaborate a bit on the internal precision in the BiQuads implemented in the PCM3070 and others. How wide (# of bits)  is the accumulator and multipliers ?

    Also a function to import text files to the BiQuad coefficients as for the FIR coeffs would be very useful. Is there a way to do this, or can you perhaps consider to implement this in next PPS version ?

     

    BR

    Jesper

    *************************************************************

    % Script to convert MatLab SOS (Single order section) description to PPS
    % BiQuad coefficients:
    %
    % This script is usable in under the conditions that the ML filter is
    % designed with the A0 coeff = to 1. This is the case for most ML design
    % methodes.
    % Gain factor in MatLab filter representation is not included in this
    % script. Most of the ML design algorithms can return values twhere the
    % gain is embedded in the SOS description.
    % Also the coefficient limitations of +/- 1 in PPS. is not handled by this
    % script.
    %
    % JGK 20111022

     

    % Generate filter

    Fs = 44100;

    F=[0 3000/(Fs/2) 6000/(Fs/2) 1]; % Between DC and Fs/2

    M=[0 1 1 0];

    N=8;

    yulewalk(N,F,M);

    [b,a]=yulewalk(N,F,M);

    s=tf2sos(b,a);

     

    % Plot filter

    [h,w]=freqz(b,a,256,Fs);

    semilogx(w,20.*log10(abs(h))); grid;

     

    % Change BiQuad coeffs to PPS format.

    [i,~]=size(s);

    if i == sum(s(:,4))

        ppssos=s(:,[1 2 3 5 6]);

        for n=1:i

            ppssos(n,:)=ppssos(n,:).*[1 0.5 1 -0.5 -1];

        end

        format('long');

        fprintf('%s\n','B0 - B1 - B2 - A1 - A2')

        ppssos

    else

        fprintf('%s\n','A0´s not equal to 1')

    end

    **********************************************************************
    % MatLab fir to PPS exampel
    % JGK 20111022
    % Make a filter
    F = [0 0.3  0.4 0.6  0.7 1]; 
    A = [0  0.01   1  1  0.01 0];
    Num = firls(64,F,A);
    % Plot response
    Fs = 48000;
    [H,w] = freqz(Num,1,256,Fs);
    semilogx(w, 20*log10(abs(H))); grid;
    % Store coefficients in a file which imports to PPS
    fid = fopen('pps_fir_coeff.txt','w');
    for i=1:length(Num)
    fprintf(fid,'%s%d %1.10f\n', 'b',i-1,Num(i));
    end
    fclose(fid);
    ***********************************************************************

  • Hi, Jesper,

    i believe the data path is 32 bits wide in this device.

    As for importing biquads, can you use the I2C memory tool? You would have to correctly format the text file, but it might not be that hard...

    -d2