ita_dsp_design_filters.m 718 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

Fs = 44100;

Hd = ita_dsp_third_octave_filterbank_iir_lowpass_coefficients( Fs, 14.1 )
ita_dsp_third_octave_filterbank_iir_band_coefficients( Fs, 14.1, 17.8 ) % 16 Hz band
% ...
ita_dsp_third_octave_filterbank_iir_highpass_coefficients( Fs, 17780 )

%% Export to C/C++ header using std::vector

copyfile( 'ITADSPThirdOctaveFilterbankCoefficients.proto.h', 'ITADSPThirdOctaveFilterbankCoefficients.h' );
fd = fopen( 'ITADSPThirdOctaveFilterbankCoefficients.h', 'wt' );
fseek( fd, '### stub code ###' );
fprintf( fd, 'std::vector< float > vfITADSPThirdOctaveFilterbankCoefficients = {' );
fprintf( fs, '%.9g', length( Hd.sosMatrix ), h( 1 ) );
fprintf( fd, ',\n %.9g', h( 2:end ) );
fprintf( fd, '};\n');
fclose( fd );