AudioTransportSource clicking bug


#1

Hey

I'm using the AudioTransportSource class to play and loop audio files.

However I'm finding that after stopping the audio file halfway though and then restarting it, it appears that a very small chunk of the last part that was played can be heard when you restart the file.

This is most noticable when playing an audio file with a silent begining, stopping the file while there is something playing, and then when you restart it there is a notiable click at the start. However the click doesn't happen if you stop the audio file on a silent part, or if you let the audio file ply all the way though.

Any thoughts? Is this a bug, or could I be doing something wrong to get this behaviour?


#2

you described two scenarios, 1. 'chunks of last part played can be heard' and 2. 'a click is heard'

If (1) is occurring, that is quite odd, and probably a mistake on your end. But, if it is only (2), this makes complete sense. If you start playing audio that starts far enough from a zero-crossing, then you will hear a click. It's the speaker jumping from 0 to whatever the value of the first sample is. Doing a very short fade in on start, and fade out on stop, will resolve that issue.


#3

If you start playing audio that starts far enough from a zero-crossing, then you will hear a click. It's the speaker jumping from 0 to whatever the value of the first sample is.

I don't think this is the issue, unless I'm not understanding you completely. The first time I play any sample it is fine. If I stop a sample in a silent section and the restart it, it is fine. But if I stop the sample while there is some sound and then restart it, then I hear a click. That's why I suggested that maybe what I'm hearing is a very small chunk of the last part that was played - I can't really think what else could be going on.


#4

Your attempt to redescribe the problem still indicates the problem is what I described. 'the first time I play any sample' means the playback is starting at the very begining, yes? and in that case, presumably, the sample was created correctly, so it starts at silence (ie '0'). 'if I stop a sample in a silent section' also indicates that that playback will also start with silence (ie. '0'). 'if I stop the sample where there is some sound' indicares that you are not in silence, and the first sample that plays when you restart will make the speaker jump to that value. And, jumping from 0 to a large enough value, will result in a 'click' as the speaker cone makes that jump. I know part of the problem of describing this to you, is that I am not doing a very good job, so hopefully someone else can jump in and give you a better description. But, in the end, if you want to start playback from arbitrary places in a sample, without a click, you will need to implement a very short fade in.


#5

Ahh sorry, I get you now. That makes sense... not sure why I was struggling to figure that out now. Thanks!