Discussion:
Android NDK OpenSL Buffer Sample and Noise Crackle
umut caliskan
2014-05-16 13:49:47 UTC
Permalink
Hi,
i am developing a recording and playing audio android sample application.
I have a samsung galaxy nexus.
I m using opensl and use a circular buffer implementation from Victor
Lazzarini's sample. (http://audioprograming.wordpress.com/)
I saw the buffer samples of my phone is 144 and it has 44100 sampling rate.
When i set the buffer sample equal to 144 and sample rate 44100, Output
sound crackle and distorting sound.

when i was buffer sample equals to 1200 +, i heard normal sound but
latency occurs..

Do you have any idea? What is the optimum sample rate and buffer samples.
Or any sample other real time audio processing like recording and playing?
--
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 android-***@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk.
For more options, visit https://groups.google.com/d/optout.
Glenn Kasten
2014-06-05 02:00:52 UTC
Permalink
Sorry for my delay in replying. Which software build are you on?
(I think you can get this from Settings / About phone)
Can you please include the output of shell command
dumpsys media.audio_flinger
(this command now includes statistics that may help to
understand the noise, but I'm not sure if your build includes the
statistics)
Post by umut caliskan
Hi,
i am developing a recording and playing audio android sample application.
I have a samsung galaxy nexus.
I m using opensl and use a circular buffer implementation from Victor
Lazzarini's sample. (http://audioprograming.wordpress.com/)
I saw the buffer samples of my phone is 144 and it has 44100 sampling rate.
When i set the buffer sample equal to 144 and sample rate 44100, Output
sound crackle and distorting sound.
when i was buffer sample equals to 1200 +, i heard normal sound but
latency occurs..
Do you have any idea? What is the optimum sample rate and buffer samples.
Or any sample other real time audio processing like recording and playing?
--
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 android-***@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk.
For more options, visit https://groups.google.com/d/optout.
umut caliskan
2014-06-07 15:04:14 UTC
Permalink
Hi Glenn, thanks for reply.

i run the Audio Buffer Size app from store and run this app. The result is;
sample rate 44.1kHz and buffer size :144

My system is build on Android 4.2.2 version, BaseBand version : I515.10
V.FK01 / I515.10 V.FK02 ,
Kernel version 3.0.31 g9f818de ***@vpbs1.mtv.corp.google.com #1 and
build numberJDQ39

i run this command adb shell media.audio_flinger and output is :


Clients:

pid: 378

pid: 567

Global session refs:

session pid count

6 567 1

1337 378 1

1338 378 1

1339 378 1

1901 378 1

2004 378 1

Hardware status: 0

Standby Time mSec: 3000


Output thread 0x41bb2370 internals

last write occurred (msecs): 179294

total writes: 385626

delayed writes: 0

blocked in write: 0

suspend count: 0

mix buffer : 0x41bba608

Fast track availMask=0x40

io handle: 2

TID: 398

standby: 1

Sample rate: 44100

HAL frame count: 144

Normal frame count: 864

Channel Count: 2

Channel Mask: 0x00000003

Format: 1

Frame size: 4


Pending setParameters commands:

Index Command


Pending config events:


AudioMixer tracks: 0000005f

FastMixer command=COLD_IDLE writeSequence=4629472 framesWritten=333321984

numTracks=1 writeErrors=0 underruns=151604 overruns=27308

sampleRate=44100 frameCount=144 measuredWarmup=76.3 ms,
warmupCycles=2

mixPeriod=3.27 ms

Simple moving statistics over last 3.1 seconds:

wall clock time in ms per mix cycle:

mean=3.26 min=0.09 max=6.65 stddev=1.10

raw CPU load in us per mix cycle:

mean=194 min=0 max=397 stddev=55

Fast tracks: kMaxFastTracks=8 activeMask=0x1

Index Active Full Partial Empty Recent Ready

0 yes 531 0 134 full 1440

1 no 0 0 0 full 0

2 no 507 0 250 empty 0

3 no 134 2 779 empty 0

4 no 283 0 805 empty 0

5 no 536 0 142 empty 0

6 no 478 0 337 empty 0

7 no 665 1 782 empty 0

State queue observer: stateChanges=6449

State queue mutator: pushDirty=6449 pushAck=3224 blockedSequence=748

Output thread 0x41bb2370 stream volumes in dB:

0:-18, 1:-24, 2:-21, 3:-37, 4:-14, 5:-6, 6:0, 7:-24, 8:-18, 9:-37

Output thread 0x41bb2370 tracks

Name Client Type Fmt Chn mask Session mFrCnt fCount S M F SRate L dB
R dB Server User Main buf Aux Buf Flags Underruns

F 2 378 1 1 0x00000001 1339 144 3456 S 0 1 44100 -Inf
-Inf 0x00000000 0x00000000 0x41bba608 0x00000000 0x83 0

F 5 378 1 1 0x00000001 1337 144 3456 S 0 1 44100 -Inf
-Inf 0x00000000 0x00000000 0x41bba608 0x00000000 0x83 0

F 3 378 1 1 0x00000001 1901 4 3456 S 0 1 44100 -Inf
-Inf 0x00000000 0x00000000 0x41bba608 0x00000000 0x83 0

F 4 378 1 1 0x00000001 1338 144 3456 S 0 1 44100 -Inf
-Inf 0x00000000 0x00000000 0x41bba608 0x00000000 0x83 0

F 1 567 0 1 0x00000001 6 0 288 I 0 0 44100 -10
-10 0x00000000 0x00000000 0x41bba608 0x00000000 0x8b 0

F 7 378 1 1 0x00000001 2004 144 3456 S 0 1 44100 -Inf
-Inf 0x00000000 0x00000000 0x41bba608 0x00000000 0x83 0

Output thread 0x41bb2370 active tracks

Name Client Type Fmt Chn mask Session mFrCnt fCount S M F SRate L dB
R dB Server User Main buf Aux Buf Flags Underruns

Normal mixer raw underrun counters: partial=0 empty=134


- 0 Effect Chains:


Output thread 0x41bc6cf8 internals

last write occurred (msecs): 171439719

total writes: 0

delayed writes: 0

blocked in write: 0

suspend count: 0

mix buffer : 0x41bcef90

Fast track availMask=0xfe

io handle: 3

TID: 399

standby: 1

Sample rate: 44100

HAL frame count: 976

Normal frame count: 976

Channel Count: 2

Channel Mask: 0x00000003

Format: 1

Frame size: 4


Pending setParameters commands:

Index Command


Pending config events:


AudioMixer tracks: 00000000

FastMixer not initialized

State queue observer: stateChanges=0

State queue mutator: pushDirty=0 pushAck=0 blockedSequence=0

Output thread 0x41bc6cf8 stream volumes in dB:

0:-10, 1:-22, 2:0, 3:-22, 4:-4.5, 5:-26, 6:0, 7:-22, 8:-22, 9:-22

Output thread 0x41bc6cf8 tracks

Name Client Type Fmt Chn mask Session mFrCnt fCount S M F SRate L dB
R dB Server User Main buf Aux Buf Flags Underruns

Output thread 0x41bc6cf8 active tracks

Name Client Type Fmt Chn mask Session mFrCnt fCount S M F SRate L dB
R dB Server User Main buf Aux Buf Flags Underruns

Normal mixer raw underrun counters: partial=0 empty=0
Post by Glenn Kasten
Sorry for my delay in replying. Which software build are you on?
(I think you can get this from Settings / About phone)
Can you please include the output of shell command
dumpsys media.audio_flinger
(this command now includes statistics that may help to
understand the noise, but I'm not sure if your build includes the
statistics)
Post by umut caliskan
Hi,
i am developing a recording and playing audio android sample application.
I have a samsung galaxy nexus.
I m using opensl and use a circular buffer implementation from Victor
Lazzarini's sample. (http://audioprograming.wordpress.com/)
I saw the buffer samples of my phone is 144 and it has 44100 sampling rate.
When i set the buffer sample equal to 144 and sample rate 44100, Output
sound crackle and distorting sound.
when i was buffer sample equals to 1200 +, i heard normal sound but
latency occurs..
Do you have any idea? What is the optimum sample rate and buffer samples.
Or any sample other real time audio processing like recording and playing?
--
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 android-***@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk.
For more options, visit https://groups.google.com/d/optout.
Loading...