Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Opus implementation with BLE (SDK 14.2)

Hi,

I'm currently working on an application that collects audio data and sends it to a central device via BLE. Since audio compression has great potential to reduce power consumption, I would like to implement opus (libopus 1.2.1) on the nRF DK 52 (nRF52832). I have a couple of questions regarding that.

After downloading libopus 1.2.1 I'm left with a folder structure, including different makefiles, sourcefiles, etc.

I have some questions regarding the actual implementation into Segger Embedded Studio.

1. Is there example code available for an implementation of Opus on a Nordic chip (using both BLE and opus)? (Smart Remote apparently, but I cannot find any example code)

2. What is a normal way to go about such an implementation? Should I precompile the library and then add it to the Nordic libraries? or can I add the whole folder structure to the Segger IDE and compile it in there?

3. If I'm not mistaken I have a separate makefile for Opus either way. Do I need to merge the makefiles from the BLE Nordic example and Opus or how can I go about this?

4. Very general question, what's the relation between the sdk_config file and the makefile?

By now it's probably clear that I do not have much experience in coding for embedded systems. Just tell me if you need more details or clarifications on some things.

Thanks for the help!

  • Hi Nick,

    A library is essentially a group of functions & definitions that another program has access to & can use (see link). If you take a look at the Blinky example from SDK14.2, you can see the nRF_Libraries folder with contains the app_button.c file. Along with the c file, there is also the app_button.h header file. These two files are part of the button handling library, which allows users to use the buttons to enable some kind of functionality. The .c file contains the function implementation, while the .h file enables an interface (a way for other files to use the functions inside the .c file). By including #include "app_button.h" inside the main.c file, it is possible for the main file to call functions inside the button library.

    So I would consider making a new folder in SES for example& placing all of the OPUS files in there. You can then use the functions inside the OPUS files by for example having a header file for each function & including the header files in the main.c file. 

    Hope that helps!

    Bjørn

  • Hi Pawel,

    After some more trying, I decided to switch to linux and setup up eclipse with gcc (GNU ARM Embedded tool chain). It took some time but I think I learned some important stuff while setting up the tool chain.

    By now I managed to build the opus library using the arm gcc compiler. Unfortunately, the library is around 750kB in size. I will see if I can reduced the size using additional configure commands and I will see how much space it takes in an actual nRF application.

    Could you maybe give me some information on how Nordic implemented the opus codec and what size range I could expect?

    I'm assuming that I would probably get better results if I manually included the source files and just use the absolute necessary code. Unfortunately, the opus codec is very complicated and opus support extremely limited.

    Best,

    Nick

  • Hi Nick,

    Smart Remote 3 application fits into nRF52832 FLASH (512 KiB) together with S132 SoftDevice and DFU bootloader. Application has multiple features - Opus codec being one of them. Codec is definitely not the largest component.

    Thanks,
    Pawel

Related