summaryrefslogtreecommitdiff
path: root/gr-vocoder/lib/codec2/c2enc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gr-vocoder/lib/codec2/c2enc.c')
-rw-r--r--gr-vocoder/lib/codec2/c2enc.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gr-vocoder/lib/codec2/c2enc.c b/gr-vocoder/lib/codec2/c2enc.c
index ab1ebe4387..1e2760a01f 100644
--- a/gr-vocoder/lib/codec2/c2enc.c
+++ b/gr-vocoder/lib/codec2/c2enc.c
@@ -41,11 +41,12 @@ int main(int argc, char *argv[])
FILE *fout;
short *buf;
unsigned char *bits;
- int nsam, nbit, nbyte;
+ int nsam, nbit, nbyte, gray;
- if (argc != 4) {
- printf("usage: c2enc 3200|2400|1600|1400|1300|1200 InputRawspeechFile OutputBitFile\n");
+ if (argc < 4) {
+ printf("usage: c2enc 3200|2400|1600|1400|1300|1200 InputRawspeechFile OutputBitFile [--natural]\n");
printf("e.g c2enc 1400 ../raw/hts1a.raw hts1a.c2\n");
+ printf("e.g c2enc 1300 ../raw/hts1a.raw hts1a.c2 --natural\n");
exit(1);
}
@@ -88,6 +89,14 @@ int main(int argc, char *argv[])
bits = (unsigned char*)malloc(nbyte*sizeof(char));
+ if (argc == 5) {
+ if (strcmp(argv[4], "--natural") == 0)
+ gray = 0;
+ else
+ gray = 1;
+ codec2_set_natural_or_gray(codec2, gray);
+ }
+
while(fread(buf, sizeof(short), nsam, fin) == (size_t)nsam) {
codec2_encode(codec2, bits, buf);
fwrite(bits, sizeof(char), nbyte, fout);