The G SM A udio P ocket K nive (GAPK) is a small command-line tool that supports conversion between the various GSM related codecs (HR/FR/EFR/AMR) and PCM audio. It supports many different formats for the codec frames, including ETSI and IETF standardized formats, as well as vendor-specific formats like those found in the TI Calypso DSP (see OsmocomBB) and those of Racal 6103/6113 GSM test equipment.

Supported Codecs

Codec Description
pcm Raw PCM signed 16bits samples
hr GSM 06.20 Half Rate codec
fr GSM 06.10 Full Rate codec (classic gsm codec)
efr GSM 06.60 Enhanced Full Rate codec
amr GSM 26.061 Adaptive Multi Rate codec

Supported Formats

Format Description
amr-efr Classic .amr file containing EFR (=AMR 12.2k) data
gsm Classic .gsm file format (and RTP payload for FR according to RFC3551)
hr-ref-dec 3GPP HR Reference decoder code parameters file format
hr-ref-enc 3GPP HR Reference encoder code parameters file format
racal-hr Racal HR TCH/H recording
racal-fr Racal FR TCH/F recording
racal-efr Racal EFR TCH/F recording
rawpcm-s16le Raw PCM samples Signed 16 bits little endian
ti-hr Texas Instrument HR TCH/H buffer format
ti-fr Texas Instrument FR TCH/F buffer format
ti-efr Texas Instrument EFR TCH/F buffer format
amr-opencore Input format to libopencore-amrnb
rtp-amr RTP payload for AMR according to RFC4867
rtp-efr RTP payload for EFR according to RFC3551
rtp-hr-etsi RTP payload for HR according to ETSI TS 101 318
rtp-hr-ietf RTP payload for HR according to IETF RFC5993

Common use cases

RTP sink with audio playback on sound card

You can run gapk as a RTP sink, i.e. listening to a given UDP port for incoming RTP frames, decoding them from their respective audio codec and then playing them back via your computers' sound card.

$ gapk -I -f rtp-amr -A default -g rawpcm-s16le
  • -I indicates the IP adddress (any) and UDP port (30000) to bind to and receive RTP frames on
  • -f rtp-amr indicates the codec. Use gsm, rtp-efr, rtp-amr, rtp-hr-etsi or rtp-hr-ietf depending on your use case
  • -A default is the alsa hardware device name (default is the default sound card)

Source Code

You can find the source code in git:

Contact / Mailing List

The project is too small to have it's own mailing list. Instead, we use the mailing list (subscribe). Please observe the Mailing_List_Rules.


gapk as written by Sylvain Munaut with contributions from Harald Welte.

It uses external libraries for the actual audio codecs, such as libgsm, libopencore-amrnb nd the ETSI reference implementation for GSM-HR.