Project

General

Profile

Gapk » History » Version 14

fixeria, 07/16/2018 04:46 PM

1 5 fixeria
h1. GAPK (GSM Audio Pocket Knife)
2 1 laforge
3 4 fixeria
{{>toc}}
4
5
The GAPK (GSM Audio Pocket Knife) is a project, the product of which is a core library (libosmogapk) and a command-line tool (osmo-gapk) for conversions 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.
6 1 laforge
7
h2. Supported Codecs
8
9 6 fixeria
|_.Codec|_.Description|_.Implementation|
10
|pcm|Raw PCM signed 16bits samples|native|
11 7 fixeria
|hr|GSM 06.20 Half Rate codec|libgsmhr[1] (GSM 06.06 reference code)|
12 6 fixeria
|fr|GSM 06.10 Full Rate codec (classic gsm codec)|libgsm|
13
|efr|GSM 06.60 Enhanced Full Rate codec|opencore-amr|
14 1 laforge
|amr|GSM 26.061 Adaptive Multi Rate codec|opencore-amr|
15 7 fixeria
16 8 fixeria
[1] Note: due to the licensing problems, the GSM 06.06 reference *code is not included* as a part of GAPK. Moreover, the reference implementation has some additional problems, such as relatively low performance and poor code quality (lots of warnings, global state variables). Passing the _--enable-gsmhr_ configuration flag will enable the source code downloading, patching and compilation.
17 1 laforge
18
h2. Supported Formats
19
20
|_.Format|_.Description|
21
|amr-efr             |Classic .amr file containing EFR (=AMR 12.2k) data|
22
|gsm                 |Classic .gsm file format (and RTP payload for FR according to RFC3551)|
23
|hr-ref-dec          |3GPP HR Reference decoder code parameters file format|
24
|hr-ref-enc          |3GPP HR Reference encoder code parameters file format|
25
|racal-hr            |Racal HR TCH/H recording|
26
|racal-fr            |Racal FR TCH/F recording|
27
|racal-efr           |Racal EFR TCH/F recording|
28
|rawpcm-s16le        |Raw PCM samples Signed 16 bits little endian|
29
|ti-hr               |Texas Instrument HR TCH/H buffer format|
30
|ti-fr               |Texas Instrument FR TCH/F buffer format|
31
|ti-efr              |Texas Instrument EFR TCH/F buffer format|
32
|amr-opencore        |Input format to libopencore-amrnb|
33
|rtp-amr             |RTP payload for AMR according to RFC4867|
34
|rtp-efr             |RTP payload for EFR according to RFC3551|
35
|rtp-hr-etsi         |RTP payload for HR according to ETSI TS 101 318|
36
|rtp-hr-ietf         |RTP payload for HR according to IETF RFC5993|
37
38 9 fixeria
h2. Source Code
39
40
You can find the source code in git:
41
* http://git.osmocom.org/gapk/ (cgit web interface)
42
* @git clone git://git.osmocom.org/gapk@ for cloning the repository
43
44 14 fixeria
h2. Dependencies
45
46
The only mandatory dependency of GAPK is [[libosmocore:libosmocore]]. Make sure you have the latest version and update it if required.
47
48
Optional libraries:
49
50
* libalsa - ALSA sound capture / playback support,
51
* opencore-amrnb - AMR and EFR codec support,
52
* libgsm - FR codec support.
53
54
Install them using the package manager of your distribution, e.g. for Debian-based systems:
55
56
<pre>
57
$ apt-get install libasound2-dev libopencore-amrnb-dev libgsm1-dev
58
</pre>
59
60
for Arch Linux:
61
62
<pre>
63
$ pacman -S alsa-lib opencore-amr gsm
64
</pre>
65
66 1 laforge
h2. Common use cases
67
68 11 fixeria
h3. Conversion between different codecs / formats
69
70 12 fixeria
First of all, make sure that required codecs are supported by your build:
71 11 fixeria
72
<pre>
73
$ osmo-gapk -h
74
...
75
Supported codecs:
76 12 fixeria
 name	fmt enc dec		description
77
  pcm	 *         		Raw PCM signed 16 bits samples
78
   hr	 *   *   * 		GSM 06.20 Half Rate codec
79
   fr	 *   *   * 		GSM 06.10 Full Rate codec (classic gsm codec)
80
  efr	 *   *   * 		GSM 06.60 Enhanced Full Rate codec
81
  amr	 *   *   * 		GSM 26.071 Adaptive Multi Rate codec
82 11 fixeria
...
83 12 fixeria
</pre>
84
85 13 fixeria
Example: converting .gsm (GSM FR codec) file to .amr (GSM EFR codec AMR 12.2k):
86 12 fixeria
87
<pre>
88
$ osmo-gapk -i input_file.gsm -f gsm -g amr-efr -o output_file.amr
89 11 fixeria
</pre>
90
91 1 laforge
h3. RTP sink with audio playback on sound card
92
93 10 fixeria
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:
94 1 laforge
95
<pre>
96 10 fixeria
$ osmo-gapk -I 0.0.0.0/30000 -f rtp-amr -A default -g rawpcm-s16le
97 2 laforge
</pre>
98
99
where
100
* *@-I 0.0.0.0/30000@* indicates the IP adddress (any) and UDP port (30000) to bind to and receive RTP frames on
101
* *@-f rtp-amr@* indicates the codec. Use *@gsm, rtp-efr, rtp-amr, rtp-hr-etsi or rtp-hr-ietf@* depending on your use case
102
* *@-A default@* is the alsa hardware device name (default is the default sound card)
103
104 3 laforge
h2. Contact / Mailing List
105
106
The project is too small to have it's own mailing list.  Instead, we use the openbsc@lists.osmocom.org mailing list ("subscribe":http://lists.osmocom.org/mailman/listinfo/OpenBSC). Please observe the [[cellular-infrastructure:Mailing_List_Rules]].
107
108 2 laforge
h2. Authors
109
110
@gapk@ as written by Sylvain Munaut with contributions from Harald Welte. 
111
112
It uses external libraries for the actual audio codecs, such as @libgsm@, @libopencore-amrnb@ nd the ETSI reference implementation for GSM-HR.
Add picture from clipboard (Maximum size: 48.8 MB)