AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER

553 views
Skip to first unread message

Matt Holgate

unread,
Jan 23, 2014, 6:03:28 AM1/23/14
to andro...@googlegroups.com
Hi,

The documentation for this property states:

"Used as a key for getProperty(String) to request the native or optimal output buffer size for this device's primary output stream, in decimal PCM frames."

I just wondered when playing stereo audio, whether I should double this value for my buffer size?

i.e. is a PCM frame a set of samples for each channel, or just a sample for a single channel?

Thanks
Matt.

Philippe Simons

unread,
Jan 23, 2014, 2:37:31 PM1/23/14
to android-ndk
1 frame size = sample size * channels,

ie: a stereo frame of shorts samples is 32bits (16 * 2)
and a buffer of 100 stereo frame of shorts is 400 bytes (4 * 100)

regarding the the PROPERTY_OUTPUT_FRAMES_PER_BUFFER, I've assumed that's the size in frames, not in bytes.
Your buffer size is PROPERTY_OUTPUT_FRAMES_PER_BUFFER * frame size (in byte).

I hope it's clear, If I'm wrong please correct me.

Philippe


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk.
For more options, visit https://groups.google.com/groups/opt_out.

Glenn Kasten

unread,
Jan 24, 2014, 9:59:55 AM1/24/14
to andro...@googlegroups.com
Loki / Philippe is correct; see this page, section "Digital audio" for
how we use terms such as "sample" and "frame":

Matt Holgate

unread,
Feb 4, 2014, 9:55:09 AM2/4/14
to andro...@googlegroups.com
Brilliant, that's really helpful, thanks!

Matt.
Reply all
Reply to author
Forward
0 new messages