Skip to content

Reading samples from stream #17

Answered by pschatzmann
uutzinger asked this question in Q&A
Discussion options

You must be logged in to vote

In general: The API operates with bytes and not samples!

When reading data it is recommended to use a multiple of the sample size * channels to make sure that full frames are received. In any case the result of the readBytes() should be used to determine the number of effectively returned bytes. But in most cases this corresponds to the requested number of bytes since I am using blocking reads in most of the cases.

Since the bits per sample can be 16 or 32, good values would be 1024, 512, 256, 128 and 64 bytes since this will return full samples both for mono and stereo. The same applies when you have the possibility to define an buffer size.

So to answer your question: I expect that you …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@uutzinger
Comment options

Answer selected by pschatzmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants