GSM_OPTION(3)
๐ GSM_OPTION(3) โ the gsm_option era ๐
okay bestie, welcome to the gsm_option(3) page from the Library Functions Manual ๐ธ this is where you get to poke at all the little knobs and switches inside the gsm library that you'd literally never touch for a normal day of encoding. but when you do need them? iconic. let's go ๐
โจ NAME โจ
gsm_option โ customizing the GSM 06.10 implementation ๐
๐ฆ SYNOPSIS ๐ฆ
#include "gsm.h"
int gsm_option(handle, option, valueP);
gsm handle;
int option;
int * valueP;
๐ธ DESCRIPTION ๐ธ
so the gsm library is an implementation of the final draft GSM 06.10 standard for full-rate speech transcoding โ that's a lossy speech compression algorithm, fyi, lossy as in it throws stuff away on purpose and that's fine, that's the whole vibe.
The gsm_option() function lets you set and query all kinds of options or flags that you do not need for regular GSM 06.10 encoding or decoding, but that might be of interest in special cases. special-case girlies, this one's for you ๐
The second argument to gsm_option tells it which parameter you wanna change or query. The third argument is either:
- a null pointer, in which case the current value of that parameter gets returned to you, or
- a pointer to an integer holding the value you want to set, in which case the previous value comes back. cute little two-way street ๐ซถ
The following options are defined:
๐ GSM_OPT_VERBOSE โ verbosity level ๐ฃ๏ธ
This one is only supported if the library was compiled with debugging turned on. It may be used by developers of compression algorithms to aid debugging. The verbosity level can be changed at any time during encoding or decoding. no cap.
๐ฅ GSM_OPT_FAST โ faster compression algorithm โก
This implementation offers a not strictly standard-compliant, but faster compression algorithm that is compatible with the regular method and does not noticably degrade audio quality. slay.
The value passed to
gsm_option(handle, GSM_OPT_FAST, & value)
functions as a boolean flag: if it is zero, the regular algorithm will be used; if not, the faster version will be used.
the availability of this option depends on the hardware used ๐ญ if it is not available,gsm_optionwill return-1on an attempt to set or query it. rude, but okay.
This option can be set any time during encoding or decoding.
โ๏ธ GSM_OPT_LTP_CUT โ enable, disable, or query the LTP cut-off optimization ๐
During encoding, the search for the long-term correlation lag forms the bottleneck of the algorithm. (it's giving main character of the slow parts.) The ltp-cut option enables an approximation that disregards most of the samples for purposes of finding that correlation, and hence speeds up the encoding at a noticable loss in quality. trade-offs, bestie, trade-offs.
The value passed to
gsm_option(handle, GSM_OPT_LTP_CUT, & value)
turns the optimization on if nonzero, and off if zero.
This option can be set any time during encoding or decoding; it will only affect the encoding pass, not the decoding. so decoding girlies, don't even worry about it ๐
๐ต GSM_OPT_WAV49 โ WAV-style byte ordering ๐ง
A WAV file of type #49 contains GSM 06.10-encoded frames. Unfortunately, the framing and code ordering of the WAV version are incompatible with the native ones of this GSM 06.10 library. (incompatible!! the audacity.)
The GSM_OPT_WAV49 option turns on a different packing algorithm that produces alternating frames of 32 and 33 bytes (or makes it consume alternating frames of 33 and 32 bytes โ note the opposite order of the two numbers, that detail matters fr fr) which, when concatenated, can be used in the body of a WAV #49 frame.
It is up to the user program to write a WAV header, if any; neither the library itself nor the toast program produce complete WAV files. so don't come for us about missing headers ๐
The value passed to
gsm_option(handle, GSM_OPT_WAV49, & value)
functions as a boolean flag: if it is zero, the library's native framing algorithm will be used; if nonzero, WAV-type packing is in effect.
This option should be used before any frames are encoded. Whether or not it is supported at all depends on a compile-time switch, WAV49.
Both the option and the compile time switch are new to the library as of patchlevel 9, and are considerably less tested than the well-worn rest of it. (new girl on the block, be gentle ๐ญ)
Thanks to Jeff Chilton for the detective work and first free implementation of this version of the GSM 06.10 encoding. king behaviour ๐
๐ GSM_OPT_FRAME_CHAIN โ query or set the chaining byte โ๏ธ
Between the two frames of a WAV-style encoding, the GSM 06.10 library must keep track of one half-byte that is technically part of the first frame, but will be written as the first four bits of the second. half a byte. living on the edge.
This half-byte are the lowest four bits of the value returned by, and optionally set by,
gsm_option(handle, GSM_OPT_FRAME_CHAIN, & value)
This option can be queried and set at any time. whenever, wherever ๐ฆ
๐ข GSM_OPT_FRAME_INDEX โ query or set the current frame's index in a format's alternating list of frames ๐งฎ
The WAV #49 framing uses two alternating types of frames. Which type the next GSM-coded frame belongs to can be queried, or, when decoding, announced, using
gsm_option(handle, GSM_OPT_FRAME_INDEX, & value)
For WAV-style framing, the value should be 0 or 1; the first frame of an encoding has an index of 0. At library initialization, the index is set to zero. ๐
The frame index can be queried and set at any time. Used in combination with the GSM_OPT_FRAME_CHAIN option, it can be used to position on arbitrary GSM frames within a format like WAV #49 (not accounting for the lost internal GSM state). so yes you can teleport around frames, just know something gets left behind ๐
โญ RETURN VALUE โญ
gsm_option() returns -1 if an option is not supported, and the previous value of the option otherwise. simple. elegant. periodt. ๐
๐ BUGS ๐
Please direct bug reports to jutta@pobox.com and cabo@tzi.org. (email era iconique, they're literally waiting for your tea ๐ซถ)
๐ SEE ALSO ๐
and that's the whole page, bestie ๐ this came straight out of the Library Functions Manual and it's signed off as GSM_OPTION(3) โ go forth, query your options, set your flags, and remember: the half-byte is real. bye ๐โจ
๐ฆ where this page comes from
- alpine 3.22: gsm-doc 1.0.22-r3 ยท TU-Berlin-2.0
- alpine 3.23: gsm-doc 1.0.23-r0 ยท TU-Berlin-2.0
- alpine 3.24: gsm-doc 1.0.23-r0 ยท TU-Berlin-2.0
- arch rolling: gsm 1.0.24-1 ยท custom
- centos-stream 10: gsm-devel 1.0.22-8.el10 ยท tu-berlin-2.0
- centos-stream 9: gsm-devel 1.0.19-6.el9 ยท MIT
- centos-stream 9: gsm-devel 1.0.19-6.el9 ยท MIT
- fedora 43: gsm-devel 1.0.23-1.fc43 ยท tu-berlin-2.0
- fedora 43: gsm-devel 1.0.23-1.fc43 ยท tu-berlin-2.0
- fedora 44: gsm-devel 1.0.24-2.fc44 ยท tu-berlin-2.0
- fedora 44: gsm-devel 1.0.24-2.fc44 ยท tu-berlin-2.0
- nixos 26.05: gsm 1.0.24
- nixpkgs unstable: gsm 1.0.24
- opensuse-leap 16.0: libgsm-devel 1.0.22-160000.3.2 ยท ISC
- opensuse-leap 16.0: libgsm-devel 1.0.22-160000.3.2 ยท ISC
- opensuse-leap 16.0: libgsm-devel 1.0.22-160000.3.2 ยท ISC
- opensuse-leap 16.0: libgsm-devel 1.0.22-160000.3.2 ยท ISC
- Copyright 1992-1995 by Jutta Degener and Carsten Bormann, Technische
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms