annotate TOOLS/alaw-gen.c @ 16137:23b7f5476b61

we do not read from dmpi, so it doesn't have to be readable
author reimar
date Thu, 28 Jul 2005 15:47:30 +0000
parents 714bc8aadb68
children f15f95c2671a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
1 #include <stdio.h>
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
2 #include <stdlib.h>
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
3
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
4 // sox -t raw -A -r 8000 -b alaw.alaw -t sw alaw.out
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
5
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
6 int main(){
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
7 int i;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
8 FILE *f;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
9
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
10 f=fopen("alaw.dat","wb");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
11 for(i=0;i<256;i++) fwrite(&i,1,1,f);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
12 fclose(f);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
13
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
14 system("sox -t raw -A -r 8000 -b alaw.dat -t sw alaw.out");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
15
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
16 printf("// Generated by TOOLS/alaw-gen.c\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
17
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
18 printf("\nshort alaw2short[]={\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
19
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
20 f=fopen("alaw.out","rb");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
21 for(i=0;i<256;i++){
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
22 signed short x;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
23 fread(&x,2,1,f);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
24 printf("%6d",x);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
25 if(i!=255) putchar(',');
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
26 if((i&7)==7) printf("\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
27 }
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
28 fclose(f);
880
714bc8aadb68 missing semicolon fixed
arpi_esp
parents: 879
diff changeset
29 printf("};\n");
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
30
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
31 system("sox -t raw -U -r 8000 -b alaw.dat -t sw alaw.out");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
32
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
33 printf("\nshort ulaw2short[]={\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
34
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
35 f=fopen("alaw.out","rb");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
36 for(i=0;i<256;i++){
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
37 signed short x;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
38 fread(&x,2,1,f);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
39 printf("%6d",x);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
40 if(i!=255) putchar(',');
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
41 if((i&7)==7) printf("\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
42 }
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
43 fclose(f);
880
714bc8aadb68 missing semicolon fixed
arpi_esp
parents: 879
diff changeset
44 printf("};\n");
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
45
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
46
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
47 }