google / google/lyra

Android example - magic numbers

Open
#70 7 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
4k
Forks
368
PR merge metrics
No merged PRs in 30d

Description

Hi,
I'm currently creating a PTT app which uses encode and decode [API](https://github.com/google/lyra#api) in realtime.
After implementation enc/dec methods via JNI, I can hear that the decoded voice is slightly distorted, like someone is speaking at 0.9x speed - slower sound.
As I'm creating the app, I'm also looking into your example app and there I can see a lot of "Magic" numbers - numbers without any meaning and explanation/comment.
So it would be great if you can find any reasonable explanation why you chose some of those numbers in buffers for microphone and speaker, so that I can follow those principles and change my app accordingly to that. I can only presume that they "best fitted".

I'm particularly curious about following numbers:

1. AudioTrack [buffer size](https://github.com/google/lyra/blob/main/android_example/java/com/example/android/lyra/MainActivity.java#L145)
2. AudioRecord [buffer size](https://github.com/google/lyra/blob/main/android_example/java/com/example/android/lyra/MainActivity.java#L188)
3. micData [length](https://github.com/google/lyra/blob/main/android_example/java/com/example/android/lyra/MainActivity.java#L101)

Thanks in advance.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.