annotate doc/AMR-EFR-conversion @ 183:452c1d5a6268

libgsmefr BFI w/o data: emit zero output after decoder reset In real-life usage, each EFR decoder session will most likely begin with lots of BFI frames before the first real frame arrives. However, because the spec-defined home state of the decoder is speech rather than CN, our regular logic for BFI w/o data would have to feed pseudorandom noise to the decoder (in the "fixed codebook excitation pulses" part), which is silly to do at the beginning of the decoder session right out of reset. Therefore, let's check reset_flag_old, and if we are still in the reset state, simply emit zero output.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 03 Jan 2023 00:12:18 +0000
parents 8eb0e7a39409
children 78739fda2856
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
136
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 We have two simple utilities that allow one to experiment with "dumb" bit-
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 shuffling conversion between AMR 12k2 and EFR codec formats, to explore
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 capabilities and limitations of this approach.
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 gsm-amr2efr reads an AMR speech recording in RFC 4867 storage format (the common
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 .amr format) and converts it to EFR in gsmx format. The AMR input to this
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 utility must consists of MR122 frames only - no other AMR modes, no SID and no
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 NO_DATA gaps. The intent is that one can take a starting speech sample in WAV
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 format, encode it into AMR with amrnb-enc from opencore-amrnb (by default that
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 utility produces MR122 encoding without DTX), and then convert the AMR output to
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 EFR with gsm-amr2efr. One can then encode the same starting-point WAV speech
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 sample with gsmefr-encode (matching official EFR from ETSI) and compare the two
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 EFR outputs. When you do this experiment, you will see that the two EFR outputs
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 will be different (you can then analyze encoded speech parameter diffs with
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 gsmrec-dump), but each version can be fed to an EFR decoder, resulting in
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 OK-sounding speech.
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 gsm-efr2amr performs the opposite conversion: it reads an EFR session recording
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 in gsmx format and converts it to AMR storage format. The input to gsm-efr2amr
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 is allowed to contain Themyscira BFI markers in addition to EFR frames; these
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 BFI markers will be turned into AMR NO_DATA frames. The same input can also
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 contain EFR SID frames - however, gsm-efr2amr will not detect them and won't
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 give them any special handling, instead they will be bit-reshuffled into MR122
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 just like EFR speech frames. The result of such "dumb" conversion is invalid
8eb0e7a39409 doc: document command line utilities
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 AMR, and when you decode it with amrnb-dec, you will hear some strange noises.