This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

For Opus applications, is an Audio DAC chip required?

Hi, guys. I'm trying to work with Opus applications using PCA10056 v1.0. In order to play Opus fils using the nRF52840,

do I need audio DAC + audio amplifier to create sound on a 3.5mm headphone jack or 1W 8 Ohm speakers?

For instance, adding TI's TLV320DAC3101 (32-bit Low-Power Stereo Audio DAC With Stereo Class-D Speaker Amplifier) is mandatory for playing Opus files?

Or using nRF52840's PDM (Pulse density modulation interface) / PCM will do the job so that I only need the audio amplifier?

Parents
  • Hi,

    Opus is an audio CODEC, it is not related to the conversion of digital to analog signals. There might exist dedicated codec chips that include DACs as well, but you can also use any other device that has I2S/PDM input and feed it with a decoded audio signal. It is also possible to output audio using PWM, but the quality of this is typically not very good.

    We have a software implementation of Opus compression in our Smart Remote 3 reference design, but this does not use decompression. Note that compressing/decompressing audio in real-time in software can be very CPU demanding, especially with higher bitrates.

    Best regards,
    Jørgen

  • A0. Yes, see the answer of the developer in this post.

    A1. In Smart Remote, the microphone captures data in PCM format, which is coded with Opus before transmitting over BLE. You should be able to do something similar the other way.

    A2. The Amplifier you mention seems to support this nicely: "The digital audio interface automatically recognizes up to 35 different PCM and TDM clocking schemes which eliminates the need for I2C programming."

  • Now I'm getting used to Opus a little bit. Thanks, Jørgen!

    In Smart Remote, the microphone captures data in PCM format, which is coded with Opus before transmitting over BLE. You should be able to do something similar the other way.

    In my case, what I want to do is

    - nRF52840 reads the SD card via SPI to get the OPUS file (file size will be near 5kBytes.)

    (I want to store multiple OPUS files and I have to consider the file size)

    - nRF52840 decodes this file

    - nRF52840 sends the decoded data via I2S

    - MAX98357A amp makes the speaker play sounds

    May I double check these before closing;

    Q0. As you pointed from the datasheet that

    "The digital audio interface automatically recognizes up to 35 different PCM and TDM clocking schemes which eliminates the need for I2C programming."

    does this mean the decoded data has to become a PCM format, just like the microphone transmitting example,

    before sending this via I2S? Maybe if you mention which function

    http://opus-codec.org/docs/opus_api-1.2/group__opus__decoder.html#ga7d1111f64c36027ddcb81799df9b3fc9

    like 

    opus_decode(), opus_decode_float()
    would be grateful.

    Q1. Speaking about PCM(Pulse-code modulation) and TDM(Time-division multiplexing)

    35 different PCM and TDM clocking schemes which eliminates the need for I2C programming.

    whereas if I choose a chip like

    TLV320DAC3100 Low-Power Stereo Audio DAC With Audio Processing and Mono Class-D Speaker Amplifier

    does this mean I have to configure clock frequencies or other parameters via I2C?

    Since this is my first time working with Opus applications, I'm pondering multiple times what to choose.

    Thanks for your help.

  • Matthew K said:
    does this mean the decoded data has to become a PCM format

    The output from opus is PCM format, either floating point or integer, based on which decode function you use.

    Matthew K said:
    does this mean I have to configure clock frequencies or other parameters via I2C?

    Yes, it seems that many amplifiers need to be configured via I2C. 

  • Thanks. 2 last things before closing this.

    The output from opus is PCM format, either floating point or integer, based on which decode function you use.

    This sounds like CELT (Constrained Energy Lapped Transform) vs SILK vs hybrid problem.

    - Since I'm a beginner, choosing a hybrid method seems tough. Most Opus file I have inside the SD card has a length of 30 seconds max, which is mostly speeches (saying go right, turn left on NY street, etc).

    If I pick the priority of small size as possible, which algorithm should I choose; CELT / SILK?

    - CELT vs SILK vs hybrid;

    considering the algorithm I choose, do you mean I have to use a different decoding function?

    Also, these algorithms create different output; floating point / integer?

  • I would recommend that you check out the presentation and slides on the bottom of the Opus page. It seems that SILK would be the best choice for your application.

    Matthew K said:
    considering the algorithm I choose, do you mean I have to use a different decoding function?

    No, as mentioned in this thread:

    2. The Opus decoder does not need additional information to know which algorithm was used to encode the current frame. In the original Opus code (https://opus-codec.org/) there is a function opus_packet_get_mode() which checks if the frame was encoded with CELT or SILK. 

    Matthew K said:
    Also, these algorithms create different output; floating point / integer?

    The algorithms should provide the same output, but the code base can produce both a fixed-point and a floating-point output. This is from their FAQ:

    "If you're targeting an embedded/mobile platform, chances are the fixed-point build will be faster, so make sure you're using --enable-fixed-point or defining FIXED_POINT in the build system."

Reply
  • I would recommend that you check out the presentation and slides on the bottom of the Opus page. It seems that SILK would be the best choice for your application.

    Matthew K said:
    considering the algorithm I choose, do you mean I have to use a different decoding function?

    No, as mentioned in this thread:

    2. The Opus decoder does not need additional information to know which algorithm was used to encode the current frame. In the original Opus code (https://opus-codec.org/) there is a function opus_packet_get_mode() which checks if the frame was encoded with CELT or SILK. 

    Matthew K said:
    Also, these algorithms create different output; floating point / integer?

    The algorithms should provide the same output, but the code base can produce both a fixed-point and a floating-point output. This is from their FAQ:

    "If you're targeting an embedded/mobile platform, chances are the fixed-point build will be faster, so make sure you're using --enable-fixed-point or defining FIXED_POINT in the build system."

Children
No Data
Related