Skip to content

Encoding high volume low sample rate provides invalid LC3 frames #9

@Casper-Bonde-Bose

Description

@Casper-Bonde-Bose

When encoding a 400Hz sinewave at 16kHz sample rate it was observed that the codec was clipping the sine, hence volume reduced by 10% as this removed the clipping. But even with this reduction other codecs will discard the data due to invalid content in the frame.

A capture was shared with Ellisys for analysis, and their response were:

In the very first SDU of that trace, the first 40 bytes can be properly decoded with the given parameters, namely a 10ms frame duration and 16kHz sampling frequency.
For the second part, the decoder detects an impossible value in the side band information.
The number of spectral lines for this configuration is 160 (in this case identical to the number of samples per frame). That maps to a compressed "last non zeroed index" field length of 7 bits. Those 7 bits have the compressed value 97, that expands to 196. Since the "last non zeroed index" cannot be higher than the number of spectral lines, that sideband information is considered invalid and the frame not accepted.
To avoid false positives, the LC3 auto-detection requires all frames in an SDU to be decodable, which is thus not the case in this trace

The trace was using the current default settings in the unicast sample application. 32kbps, 16kHz, 10ms frames, volume: (INT16_MAX - 3000), 400Hz sine.

A volume of ~75% works around this issue (INT32_MAX - 8000). Also at 48kHz the issue do not seem to exist - even at full volume (+/-INT16_MAX).

UPDATE 2. of May 2022:
PLEASE NOTE:
When looking at this, please note that the issue occurs for HIGH volume. Above a certain gain level the LC3 encoder will start to produce invalid frames. Also please note that the nature of LC3 will introduce a "ramp-up" period where the output amplitude is not 100% even though you supply a 100% gain input signal. Hence please ensure you skip the first few frames for the analysis.
Also please note that several different combinations of frames/SDU were tested, and the issue disappears if gain is reduced - hence this issue is not related to how data is packed in to the SDU.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions