andrewrk / andrewrk/libsoundio

Libsoundio : Software Latency

Open
#153 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
2.1k
Forks
254
PR merge metrics
No merged PRs in 30d

Description

I did tests with the sio_record program, to which I added the value of the software latency as argument of the main function.
This value is assigned to "instream-> software_latency" before we call ":: soundio_instream_open".
Then I added code to calculate the real latency, inside the function "read_callback (...)", as follows:

Static void read_callback (struct SoundIoInStream * instream, int frame_count_min, int frame_count_max) {
...
static double dLatency = 0.0;
dLatency = (double) (frame_count_max * instream-> layout.channel_count) / instream-> sample_rate;
static double dMaxLatency = 0.0;
static double dMinLatency = 10.0;
dMaxLatency = (dMaxLatency dLatency)? dLatency : dMinLatency;
fprintf (stderr, "Real Latency Max:% f \ nReal Latency Min:% f \ n \ n", dMaxLatency, dMinLatency);
...
}
So I did 5min tests of recording for different values of latency and for two architectures "Linux-armv7l" and "Linux-x86_64". The results of the tests are shown in the following screenshot:
![libsoundio_reallatency_vs_inputlatency](https://cloud.githubusercontent.com/assets/16650002/24718747/1ce5c45e-1a05-11e7-8b07-d3890039096d.JPG)
There is a large variation in latency due to the large difference between the min and max latency for each test.

My questions are :
1) Is this variation in latency normal and if so, what would you expect it to be? Should we not have an approximate value of the desired latency for the min and max latency?
2) Is there a way to control latency?

Thank you for your reply.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.