File: tprede.c

package info (click to toggle)
codec2 1.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 121,056 kB
  • sloc: ansic: 414,118; sh: 2,612; objc: 2,574; python: 2,105; cpp: 2,091; asm: 683; makefile: 598
file content (53 lines) | stat: -rw-r--r-- 980 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
   tpre_de.c
   David Rowe
   Sep 24 2012

   Unit test to generate the combined impulse response of pre & de-emphasis filters.

     pl("../unittest/out48.raw",1,3000)
     pl("../unittest/out8.raw",1,3000)

   Listening to it also shows up anything nasty:

     $ play -s -2 -r 48000 out48.raw
     $ play -s -2 -r 8000 out8.raw

  */

#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include "lpc.h"

#define N                        10
#define F                        10

int main() {
    FILE  *fprede;
    float  Sn[N], Sn_pre[N], Sn_de[N];
    float  pre_mem = 0.0, de_mem = 0.0;
    int    i, f;

    fprede = fopen("prede.txt", "wt");
    assert(fprede != NULL);

    for(i=0; i<N; i++)
	Sn[i] = 0.0;

    Sn[0]= 1.0;

    for(f=0; f<F; f++) {
	pre_emp(Sn_pre, Sn, &pre_mem, N);
	de_emp(Sn_de, Sn_pre, &de_mem, N);
	for(i=0; i<N; i++) {
	    fprintf(fprede, "%f\n", Sn_de[i]);
	}
	Sn[0] = 0.0;
    }

    fclose(fprede);

    return 0;
}