Craig Gidney
Craig Gidney

Reputation: 18296

Determining how Speex encoded audio differs from expected settings

I'm trying to integrate an application with another application that encodes audio using speex. However, when I decode audio sent from the first application to the second, I'm getting noise (not static, more like bleep-bloopy twangs).

I need to know where to look for the problem.

The first application can talk to other instances of itself. The second application can talk to other instances of itself. They just can't talk to each other.

The Speex settings are apparently mismatched, but I can't figure out which ones. I've compared the source line by line and it appears that they do the same setup. They both use narrow band mode. They both use the same parameters for enhancer (1), variable bit rate (0), quality (3), complexity (1), and sample rate (8000). The observed length of encoded frames matches, too.

In case it's any help, Here's some sample audio data, covering 6 frames from the beginning of a call (hopefully the parameters I mentioned are enough to decode it):

1dde5c800039ce70001ce7207b60000a39242d95
e8bda0cf21b6ec4629ad0f3b04290474110e70fb
1bdd3a9dfc211845e0ed90dabde11451e191186c
0ba5de5bea933ed1d3675f786947444781407e17
1bd5549fefa91b63d4968b299bf603d7e533b98c
6351b7953f4470d63bbb2b8c49be650ee89488b5
// at this point I get:
// notification: More than two wideband layers found. The stream is corrupted."

I'm at a bit of a lose. I don't know what to check next.

What are other reasons that audio data transferred from one computer to another, encoded with Speex, might end up being misinterpreted? I'm especially interested in the stupid reasons.

Upvotes: 1

Views: 388

Answers (1)

Craig Gidney
Craig Gidney

Reputation: 18296

Self-answer: Check the entire data path from end to end, with logging at each point.

The issue we were having is that the audio was being encrypted with AES CTR mode but the apps were using different endian-ness on the counter. The first 32 bytes of audio made it through, making it seem like an encoding issue by having some non-noise, but the rest of the data was garbled.

Upvotes: 1

Related Questions