YaK:: Kicking the tires : CODEC2 | [Changes] [Calendar] [Search] [Index] [PhotoTags] |
[ For more about CODEC2, start with https://en.wikipedia.org/wiki/Codec_2 and https://www.tapr.org/pdf/DCC2011-Codec2-VK5DGR.pdf ]
Here's how I took a test audio file (from the N6NFI repeater 9am talk net) (8000 samples per second), encoded it with CODEC2 at various bitrate configs, and decoded them again.
The CODEC2 c2enc and c2dec commands use PCM (1 channel, 8000 rate, s16le format) as input and output. So I had to first convert the sample qso.ogg file into qso.pcm.
Then so you can hear the results, I converted the final decodes back into .ogg files that many browsers can play.
# Input is in qso.ogg. Convert it into raw PCM qso.pcm. $ mplayer -ao pcm:nowaveheader:file=qso.pcm -format s16le qso.ogg [AO PCM] File: qso2.pcm (RAW PCM) PCM: Samplerate: 8000Hz Channels: Mono Format s16le [AO PCM] Info: Faster dumping is achieved with -benchmark -vc null -vo null -ao pcm:fast [AO PCM] Info: To write WAVE files use -ao pcm:waveheader (default). AO: [pcm] 8000Hz 1ch s16le (2 bytes per sample) Video: no video Starting playback... A: 567.8 (09:27.8) of 567.8 (09:27.7) 0.0% # You can play the PCM file with the paplay command: $ paplay --rate=8000 --channels=1 --format=s16le --raw qso.pcm # Encode at various bitrates. $ ( set -x ; for x in 3200 2400 1600 1400 1300 1200 700 700B; do time c2enc $x qso.pcm qso.codec2-$x ; done ) # Then decode. $ ( set -x ; for x in 3200 2400 1600 1400 1300 1200 700 700B; do time c2dec $x qso.codec2-$x qso.out-$x.pcm ; done ) $ paplay --rate=8000 --channels=1 --format=s16le --raw qso.out-3200 $ paplay --rate=8000 --channels=1 --format=s16le --raw qso.out-700 # Convert the output PCM files to OGG. $ (set -x ; for x in qso.out-*.pcm ; do oggenc --raw --raw-bit=16 --raw-chan=1 --raw-rate=8000 --raw-endianness=0 -o $x.ogg $x ; done ) $ ls -ls qso.* 1000 -rw-r--r-- 1 strick eng 1023205 Mar 21 23:28 qso.ogg 8872 -rw-r--r-- 1 strick eng 9084928 Mar 21 23:29 qso.pcm 84 -rw-r--r-- 1 strick eng 85170 Mar 21 23:32 qso.codec2-1200 100 -rw-r--r-- 1 strick eng 99365 Mar 21 23:31 qso.codec2-1300 100 -rw-r--r-- 1 strick eng 99365 Mar 21 23:31 qso.codec2-1400 112 -rw-r--r-- 1 strick eng 113560 Mar 21 23:31 qso.codec2-1600 168 -rw-r--r-- 1 strick eng 170340 Mar 21 23:31 qso.codec2-2400 224 -rw-r--r-- 1 strick eng 227120 Mar 21 23:31 qso.codec2-3200 56 -rw-r--r-- 1 strick eng 56780 Mar 21 23:32 qso.codec2-700 56 -rw-r--r-- 1 strick eng 56780 Mar 21 23:32 qso.codec2-700B 8872 -rw-r--r-- 1 strick eng 9084800 Mar 21 23:33 qso.out-1200.pcm 8872 -rw-r--r-- 1 strick eng 9084800 Mar 21 23:32 qso.out-1300.pcm 8872 -rw-r--r-- 1 strick eng 9084800 Mar 21 23:32 qso.out-1400.pcm 8872 -rw-r--r-- 1 strick eng 9084800 Mar 21 23:32 qso.out-1600.pcm 8872 -rw-r--r-- 1 strick eng 9084800 Mar 21 23:32 qso.out-2400.pcm 8872 -rw-r--r-- 1 strick eng 9084800 Mar 21 23:32 qso.out-3200.pcm 8872 -rw-r--r-- 1 strick eng 9084800 Mar 21 23:33 qso.out-700.pcm 8876 -rw-r--r-- 1 strick eng 9084800 Mar 21 23:33 qso.out-700B.pcm 1488 -rw-r--r-- 1 strick eng 1522743 Mar 22 00:21 qso.out-1200.pcm.ogg 1472 -rw-r--r-- 1 strick eng 1507117 Mar 22 00:21 qso.out-1300.pcm.ogg 1476 -rw-r--r-- 1 strick eng 1510418 Mar 22 00:21 qso.out-1400.pcm.ogg 1476 -rw-r--r-- 1 strick eng 1507987 Mar 22 00:21 qso.out-1600.pcm.ogg 1476 -rw-r--r-- 1 strick eng 1508638 Mar 22 00:21 qso.out-2400.pcm.ogg 1456 -rw-r--r-- 1 strick eng 1490898 Mar 22 00:21 qso.out-3200.pcm.ogg 1412 -rw-r--r-- 1 strick eng 1442390 Mar 22 00:21 qso.out-700B.pcm.ogg 1344 -rw-r--r-- 1 strick eng 1375254 Mar 22 00:21 qso.out-700.pcm.ogg |
If you use Chrome, Firefox, or Opera, you should be able to listen to the *.ogg files. In Crome, if you click on the .ogg file and it downloads, then right-click the download and select 'Open'.
Input:
Encoded-then-decoded Outputs:
Input to encoder (converted to PCM from qso.ogg):
Encoded codec2 files:
Decoded PCM files:
(last modified 2019-03-22) [Login] |