1GSM(3)                     Library Functions Manual                     GSM(3)
2
3
4

NAME

6       gsm_create, gsm_destroy, gsm_encode, gsm_decode — GSM 06.10 lossy sound
7       compression
8

SYNOPSIS

10       #include "gsm.h"
11
12       gsm gsm_create();
13
14       void gsm_encode(handle, src, dst)
15       gsm handle;
16       gsm_signal src[160];
17       gsm_frame dst;
18
19       int gsm_decode(handle, src, dst)
20       gsm handle;
21       gsm_frame src;
22       gsm_signal dst[160];
23
24       void gsm_destroy(handle)
25       gsm handle;
26

DESCRIPTION

28       Gsm is an implementation of the final  draft  GSM  06.10  standard  for
29       full-rate speech transcoding.
30
31       gsm_create()  initializes  a  gsm pass and returns a 'gsm' object which
32       can  be  used  as  a  handle  in  subsequent  calls  to   gsm_decode(),
33       gsm_encode() or gsm_destroy().
34
35       gsm_encode()  encodes an array of 160 13-bit samples (given as gsm_sig‐
36       nal's, signed integral values of at least 16 bits) into a gsm_frame  of
37       33  bytes.  (gsm_frame is a type defined as an array of 33 gsm_bytes in
38       gsm.h.)
39
40       gsm_decode() decodes a gsm_frame into an array of  160  13-bit  samples
41       (given  as  gsm_signals),  which  sound  rather like what you handed to
42       gsm_encode() on the other side of the wire.
43
44       gsm_destroy() finishes a gsm pass and frees all storage associated with
45       it.
46
47   Sample format
48       The following scaling is assumed for input to the algorithm:
49          0  1                             11 12
50          S..v..v..v..v..v..v..v..v..v..v..v..v..*..*..*
51       Only the top 13 bits are used as a signed input value.
52       The output of gsm_decode() has the three lower bits set to zero.
53

RETURN VALUE

55       gsm_create()  returns  an  opaque  handle  object  of type gsm, or 0 on
56       error.  gsm_decode() returns -1 if the passed frame is invalid, else 0.
57

EXAMPLE

59       #include "gsm.h"
60
61       gsm handle;
62       gsm_frame buf;
63       gsm_signal sample[160];
64       int cc, soundfd;
65
66       play() {  /* read compressed data from standard input, write to soundfd */
67
68            if (!(handle = gsm_create())) error...
69            while (cc = read(0, (char *)buf, sizeof buf)) {
70                 if (cc != sizeof buf) error...
71                 if (gsm_decode(handle, buf, sample) < 0) error...
72                 if (write(soundfd, sample, sizeof sample) != sizeof sample)
73                      error...
74            }
75            gsm_destroy(handle);
76       }
77
78       record() {     /* read from soundfd, write compressed to standard output */
79
80            if (!(handle = gsm_create())) error...
81            while (cc = read(soundfd, sample, sizeof sample)) {
82                 if (cc != sizeof sample) error...
83                 gsm_encode(handle, sample, buf);
84                 if (write(1, (char *)buf, sizeof buf) != sizeof sample)
85                      error...
86            }
87            gsm_destroy(handle);
88       }
89

BUGS

91       Please direct bug  reports  to  jutta@cs.tu-berlin.de  and  cabo@cs.tu-
92       berlin.de.
93

SEE ALSO

95       toast(1), gsm_print(3), gsm_explode(3), gsm_option(3)
96
97
98
99                                                                        GSM(3)
Impressum