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!

Parents
  • Hi,

    It is great to hear that you are interested in Nordic's Smart Remote reference design. Please find the answers to your questions below.

    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)

    Smart remote can be configured to use OPUS as an audio codec and it sends audio over BLE. Note that nRFready Smart Remote 3 for nRF52 Series is a reference design and its code is not available within the SDK package. You can find more information on how to obtain the source code on the Smart Remote product page.

    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?

    OPUS library is compiled within the Smart Remote project. You don't need to copy any OPUS related files as Smart Remote sources come with them included.

    If you are working on your own project, you will have to create your own design (i.e. which components are used and how they are integrated together).

    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?

    Smart Remote sources have project files prepared to be used with Keil and GCC. You don't need to compile OPUS out of Smart Remote tree as OPUS files will be compiled along with other sources. To have all Smart Remote features build in you will however have to obtain the AirMotion library (please refer to product documentation). This library is not needed for OPUS nor BLE so if you are interested in audio transmission only you will not need it.

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

    The sdk_config header file contains project configuration (i.e. set of options that define how project sources are built and which features are compiled in and with what properties). Makefile is a file that tells make (a tool) how to convert source code into binaries. The same sdk_config header file can be used for different project construction environments (e.g. GCC, Keil, IAR, SES, etc). Makefile is specific for make and describe dependencies between different files within a project.

    I hope this will help you to get started.

    Kind regards,

    Pawel

Reply
  • Hi,

    It is great to hear that you are interested in Nordic's Smart Remote reference design. Please find the answers to your questions below.

    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)

    Smart remote can be configured to use OPUS as an audio codec and it sends audio over BLE. Note that nRFready Smart Remote 3 for nRF52 Series is a reference design and its code is not available within the SDK package. You can find more information on how to obtain the source code on the Smart Remote product page.

    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?

    OPUS library is compiled within the Smart Remote project. You don't need to copy any OPUS related files as Smart Remote sources come with them included.

    If you are working on your own project, you will have to create your own design (i.e. which components are used and how they are integrated together).

    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?

    Smart Remote sources have project files prepared to be used with Keil and GCC. You don't need to compile OPUS out of Smart Remote tree as OPUS files will be compiled along with other sources. To have all Smart Remote features build in you will however have to obtain the AirMotion library (please refer to product documentation). This library is not needed for OPUS nor BLE so if you are interested in audio transmission only you will not need it.

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

    The sdk_config header file contains project configuration (i.e. set of options that define how project sources are built and which features are compiled in and with what properties). Makefile is a file that tells make (a tool) how to convert source code into binaries. The same sdk_config header file can be used for different project construction environments (e.g. GCC, Keil, IAR, SES, etc). Makefile is specific for make and describe dependencies between different files within a project.

    I hope this will help you to get started.

    Kind regards,

    Pawel

Children
  • Thanks for the reply Pawel.

    Did I read correctly that I would have to purchase the nRF ready Smart Remote 3 (300$) in order to obtain the reference design?

    Unfortunately that would be a bit too much for my project budget.

    So to rephrase my questions:

    1. How do I get from the folder structure above to a project with BLE capabilities? Or asked differently: How do I integrate the opus codec in an existing BLE SDK project?

  • Hi,

    Yes, firmware and source code is available after purchase of the reference design.

    Going back to your question. That is a question on how you would like to have you project organized.

    Assuming that you have everything except the OPUS library, you will have to either:
    - modify the project files to tell tool to build OPUS sources together with your project, or
    - build the library out of your project tree (e.g. with make provided with OPUS) and later link your project against this library (again you will have to change project files to tell linker where the library is located).

    Changing project files depends on what tool you do use.

    Kind regards,

    Pawel

  • Thanks,

    Building externally seems to be the more straightforward solution for me.

    (e.g. with make provided with OPUS)

    Can you clarify on that? do I try to build this library in Segger ES inside a new project with the provided make files?

    Or outside Segger ES? in that case which tools do I need to build an application externally for an nRF 52832? (On Windows 10, Segger using gcc compiler, language standard gnu99)

    I assume I need to compile it with gcc somehow.

    Best,

    Nick

  • Hi,

    I am not familiar with Segger but most such tools use their proprietary project files. I expect it should be possible to import Makefile based project. I don't know if it is automated though.

    In general as long as toolchains are compatible (use the same ABI and the same format for object files) you should be able to compile library with one tool and link it later with the other.

    If, as you say, SES is using GCC than you can use make pointing to the same GCC that SES uses. Usually this is done by specifying CROSS_COMPILE env variable but it really depends on how Makefile was written (please refer to OPUS documentation where I expect it is explained).

    There are Windows ports of GNU tools and you can install one of them if you want to obtain make and build library directly from Makefile.

    My personal suggestion is to use Linux when you create your projects using GNU tools (make, GCC, etc). It is much easier this way and build is done faster too.

    Kind regards,

    Pawel

  • 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

Related