Compiling the Opus codec for ESP8266
Posted: Mon Mar 07, 2016 7:33 am
I want the opus codec (especially the decoder) on the ESP8266 because at 128 kbps should be more than enough with a cheap I2S DAC to stream audio. I think it's really important because opus would allow one to get a playlist from the internet and play music from youtube without using too much resources or play a live stream. Most web services or startups will use only the opus codec, look at Discord for instance.
The codec should be available for both RTOS and NON OS SDK with a stereo I2S output reference app (maybe play some music from youtube or soundcloud). If there are size issues the opus source could be stripped down to either the speech (low bitrate) or the celt (high bitrate) codec and if there are performance issues opus can be compiled with the fixed point implementation.
The ESP8266 running at 160 Mhz should be able to handle opus decoding.
As I remember right first I should replace malloc and free with os_alloc and os_free. (simple macro in opus).
First try: (without replacing anything) :
The codec should be available for both RTOS and NON OS SDK with a stereo I2S output reference app (maybe play some music from youtube or soundcloud). If there are size issues the opus source could be stripped down to either the speech (low bitrate) or the celt (high bitrate) codec and if there are performance issues opus can be compiled with the fixed point implementation.
The ESP8266 running at 160 Mhz should be able to handle opus decoding.
As I remember right first I should replace malloc and free with os_alloc and os_free. (simple macro in opus).
First try: (without replacing anything) :
Code: Select all
sp8266@esp8266-VirtualBox:~/opus-1.1.2$ make CC=xtensa-lx106-elf-gcc
make all-recursive
make[1]: Entering directory `/home/esp8266/opus-1.1.2'
make[2]: Entering directory `/home/esp8266/opus-1.1.2'
CC celt/bands.lo
CC celt/celt.lo
CC celt/celt_encoder.lo
CC celt/celt_decoder.lo
CC celt/cwrs.lo
CC celt/entcode.lo
CC celt/entdec.lo
CC celt/entenc.lo
...
CC src/mlp.lo
CC src/mlp_data.lo
CCLD libopus.la
/usr/bin/ld: celt/.libs/bands.o: Relocations in generic ELF (EM: 94)
/usr/bin/ld: celt/.libs/bands.o: Relocations in generic ELF (EM: 94)
/usr/bin/ld: celt/.libs/bands.o: Relocations in generic ELF (EM: 94)
/usr/bin/ld: celt/.libs/bands.o: Relocations in generic ELF (EM: 94)
/usr/bin/ld: celt/.libs/bands.o: Relocations in generic ELF (EM: 94)
/usr/bin/ld: celt/.libs/bands.o: Relocations in generic ELF (EM: 94)
/usr/bin/ld: celt/.libs/bands.o: Relocations in generic ELF (EM: 94)
/usr/bin/ld: celt/.libs/bands.o: Relocations in generic ELF (EM: 94)
/usr/bin/ld: celt/.libs/bands.o: Relocations in generic ELF (EM: 94)
/usr/bin/ld: celt/.libs/bands.o: Relocations in generic ELF (EM: 94)
celt/.libs/bands.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [libopus.la] Error 1
make[2]: Leaving directory `/home/esp8266/opus-1.1.2'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/esp8266/opus-1.1.2'
make: *** [all] Error 2