Discussion:
AudioTrack - Clicking Sound
Business Talk
2009-12-15 13:37:35 UTC
Permalink
I am getting this clicking sound when playing static pcm data. Anybody
out there is having the same problem? This is not the data issue. I am
sure of it.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
niko20
2009-12-15 15:14:51 UTC
Permalink
Hi,

I use AudioTrack for several projects and haven't had a problem.

However, as I was learning to use it, I had lots of small issues
related to:

1. Not filling the buffer correctly as you think - double check your
code. Even if you are missing one PCM sample you will get a click.

2. If using a streaming buffer AudioTrack, you have to keep the buffer
full. If you have any gaps you will get clicks.

I'd say the problem is in your code somewhere. You probably have some
off by one error or negative/positive error or missing a couple of
samples, or such.

Also never hurts to load your PCM data into Audacity to double check
how it sounds.

-niko
Post by Business Talk
I am getting this clicking sound when playing static pcm data. Anybody
out there is having the same problem? This is not the data issue. I am
sure of it.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Business Talk
2009-12-15 19:00:28 UTC
Permalink
Niko,

I have redone all the test pcm files using the Audiocity and the click
is still there. Maybe it’s the driver. I have my development
environment on a virtual server. I am creating the track in a static
mode so there should not be any gaps. since it’s one track per pcm. I
will keep digging.

I have one question; do you have any performance experience with
manipulating the pcm date at the run time with regard to the data
synthesis, such as changing the pitch at run. I would hate to spent
time to find out that it not on the current platforms

For example, I need pcm data representing a C note in octave 3 and
octave 4. I can do it two ways;


1. have two separate pcm files, or

2. have one pcm data representing the middle C in octave 4 and than
manipulate the pitch to create the C in the lower octave.
Post by niko20
Hi,
I use AudioTrack for several projects and haven't had a problem.
However, as I was learning to use it, I had lots of small issues
1. Not filling the buffer correctly as you think - double check your
code. Even if you are missing one PCM sample you will get a click.
2. If using a streaming buffer AudioTrack, you have to keep the buffer
full. If you have any gaps you will get clicks.
I'd say the problem is in your code somewhere. You probably have some
off by one error or negative/positive error or missing a couple of
samples, or such.
Also never hurts to load your PCM data into Audacity to double check
how it sounds.
-niko
Post by Business Talk
I am getting this clicking sound when playing static pcm data. Anybody
out there is having the same problem? This is not the data issue. I am
sure of it.- Hide quoted text -
- Show quoted text -
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
MarkNZ
2009-12-15 23:01:31 UTC
Permalink
Do you need to use files?
I have been generating audio at run time using the java math sine
function to create an array of short, then playing it with audio
track. Perfomance has been fine, I have been testing on an HTC tattoo.
The only problem I have found is when I record the the data being
played, write it to SD card and plot it in MATLAB, There is a large DC
offset that decays quickly at the start of playback. I'm still trying
to figure out the cause of it however this may not bother you.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Business Talk
2009-12-21 17:34:20 UTC
Permalink
Mark,

Yours is a golden tip. In a long run using files is out of the
question, considering the size of the application it would generate.
Your approach is definitely the way to go. I just have no experience
in the sound synthesis, Specifically synthesizing instrument sounds.
Do you have any documentation (links) to point me to. I will have to
look into a simple synthesizer running on android. Any code examples
you could share?

I appreciate your advice,
Roman
Post by MarkNZ
Do you need to use files?
I have been generating audio at run time using the java math sine
function to create an array of short, then playing it with audio
track. Perfomance has been fine, I have been testing on an HTC tattoo.
The only problem I have found is when I record the the data being
played, write it to SD card and plot it in MATLAB, There is a large DC
offset that decays quickly at the start of playback. I'm still trying
to figure out the cause of it however this may not bother you.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Business Talk
2009-12-21 18:49:25 UTC
Permalink
Mark,

I have just wrote a simple oscillator that generates the data and it
plays fine. But as you know, it is a long way to synthesizing an
instrument sound. I would appreciate any references on the sound
synthesis and most of all code examples. Any libraries with a small
footprint maybe.

Thanks
Post by Business Talk
Mark,
Yours is a golden tip. In a long run using files is out of the
question, considering the size of the application it would generate.
Your approach is definitely the way to go. I just have no experience
in the sound synthesis, Specifically synthesizing instrument sounds.
Do you have any documentation (links) to point me to. I will have to
look into a simple synthesizer running on android. Any code examples
you could share?
I appreciate your advice,
Roman
Post by MarkNZ
Do you need to use files?
I have been generating audio at run time using the java math sine
function to create an array of short, then playing it with audio
track. Perfomance has been fine, I have been testing on an HTC tattoo.
The only problem I have found is when I record the the data being
played, write it to SD card and plot it in MATLAB, There is a large DC
offset that decays quickly at the start of playback. I'm still trying
to figure out the cause of it however this may not bother you.- Hide quoted text -
- Show quoted text -
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Business Talk
2010-01-04 17:56:09 UTC
Permalink
After, repeated effort at sound synthesis I have decided to go back to
pre=generated sounds. It's much too computationally expensive. My
question is; does AudioTrack use pure pcm of it uses wave. I have this
clicking sound and I think it's because I am using wave and the wave
is pcm plus same header data. Maybe this header causes the clicking
sound.
Post by MarkNZ
Do you need to use files?
I have been generating audio at run time using the java math sine
function to create an array of short, then playing it with audio
track. Perfomance has been fine, I have been testing on an HTC tattoo.
The only problem I have found is when I record the the data being
played, write it to SD card and plot it in MATLAB, There is a large DC
offset that decays quickly at the start of playback. I'm still trying
to figure out the cause of it however this may not bother you.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Loading...