Author Topic: Audio clicking at end of playback  (Read 431 times)

daniel2

  • Guest
Audio clicking at end of playback
« on: 27 Jul '17 - 20:22 »
This only occurs when using bass tempo stream (with bass_fx). At the end of playback, there is sometimes an audible click / pop sound. It doesn't do it every time, but a lot of the time.

daniel2

  • Guest
Re: Audio clicking at end of playback
« Reply #1 on: 27 Jul '17 - 21:02 »
It seems this may be related to the buffer - especially with bass_fx.  Some other audio effects I have repeat a v small part of the audio - which I think is the exact same issue as this.  When I reduce buffer to 100ms and the update period to 5 (not sure if latter was needed), the clicking and other weirdness goes away.

Is there a recommended update period / buffer when CPU usage is not a concern?  Because from what I can see, even v small buffer and update has negligible effect on a modern CPU.

daniel2

  • Guest
Re: Audio clicking at end of playback
« Reply #2 on: 27 Jul '17 - 22:32 »
No, it's more than that.

When the buffer is slightly smaller than the file, I get the clicking. So if a buffer is 500ms and the effect is 520ms... there is an audible click. If the buffer is larger than the file - no ill effects with playback. I think this may be some sort of bug with how bass_fx is working with bass.  There's definitely some sort of issue here.

daniel2

  • Guest
Re: Audio clicking at end of playback
« Reply #3 on: 27 Jul '17 - 23:25 »
Additional:  The buffer's size can probably be smaller or larger... it just can't be within a certain margin in relation to the size of the file.  It's almost certainly a buffer v bass_fx v bass issue.  I can supply examples, if needed.

daniel2

  • Guest
Re: Audio clicking at end of playback
« Reply #4 on: 28 Jul '17 - 05:10 »
Sorry for all the updates, but testing has been ongoing.  It seems that the issue exists with or without bass_fx (though I think it's worse with it).  Certain effects have artifacts due to a buffer issue(?).

https://drive.google.com/open?id=0B43luAxFZKC-NXgxSlVWMjFMdDA

This one should show the issue with default values.  You may need to play it a few times to hear the distortion at the end. 

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Audio clicking at end of playback
« Reply #5 on: 28 Jul '17 - 13:11 »
When the buffer is slightly smaller than the file, I get the clicking. So if a buffer is 500ms and the effect is 520ms... there is an audible click. If the buffer is larger than the file - no ill effects with playback. I think this may be some sort of bug with how bass_fx is working with bass.  There's definitely some sort of issue here.

What about if you double (or more) the length of the file (eg. duplicate the data in a sample editor), do you get the problem then? Also, does it happen even if don't set any BASS_ATTRIB_TEMPO/PITCH/FREQ attribute values, ie. the tempo is left at 100%?

daniel2

  • Guest
Re: Audio clicking at end of playback
« Reply #6 on: 28 Jul '17 - 17:18 »
If there is more silence at the end, it wont do it, but thats just because the length v buffer size ratio is altered. Other effects of similar length to machine gun will have clicking at end. But not every time as stated. It gets worse with bassfx but its there without. Setting tempo to 5% with bassfx gets rid of it but 10% may bring it back. So i def think this is some sort of buffering issue. Could it also be a bass issue with my soundcard? Its audigy 2 platinum ex. Still..
 Google's player doesnt create that clicking nor does adobe audition.

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Audio clicking at end of playback
« Reply #7 on: 28 Jul '17 - 17:42 »
If it's happening even without the tempo processing, please see if you can reproduce it with the pre-compiled BASSTEST.EXE example included in the BASS package (C\BIN folder). Try both the "Stream" and "Sample" playback options.

Also, are you sure the problem still happens even if there is silence at the end of the file, eg. if you remove some data from the start and add silence at the end to keep the length the same?

There shouldn't be any real difference between using OGG and WAV files, but you could also try playing a WAV version of the file, just in case.

You could also try the latest BASS build and see if that makes any difference:

   www.un4seen.com/stuff/bass.zip

daniel2

  • Guest
Re: Audio clicking at end of playback
« Reply #8 on: 28 Jul '17 - 19:12 »
I managed to replicate the error with the bin folder precompiled version in the same way - it does take a lot of goes before the artifact is heard (maybe one in 30) - but like I say this issue can happen more or less frequently depending on file or buffer size. And just plain "randomness".

Next, I tested your new bass.dll with delphi simple test program.  It still does it.

Next, I tried adding silence to end but keeping file size the same.  You were right. It does it even when I added 4410 (0.1s) silence to end of it. It also does it with wav.

Here is an example of what it sounds like using the original effect with the precompiled version:

https://drive.google.com/file/d/0B43luAxFZKC-YzlCSGQ5ejlrSk0/view?usp=sharing

As you can hear, the 3rd time (it actually took about 20) the effect is used, it has added data to the end of the file, which is audible. If you look at the shape of the waveform that has been added in error, it does look to be the same shape as the start of the effect (with some sort of added distortion).


daniel2

  • Guest
Re: Audio clicking at end of playback
« Reply #9 on: 29 Jul '17 - 00:34 »
Lastly, it does get a lot better when I use


BASS_SetConfig(
    BASS_CONFIG_UPDATEPERIOD,
    100);


BASS_SetConfig(
    BASS_CONFIG_BUFFER,
    200
);


BASS_SetConfig(
    BASS_CONFIG_UPDATETHREADS,
    2
);

So perhaps the extra update thread helps here?  The bug is obviously still going to be there though - and it is bound to still turn up until the underlying cause is dealt with.

daniel2

  • Guest
Re: Audio clicking at end of playback
« Reply #10 on: 29 Jul '17 - 12:26 »
Yup. Still there. However, i had a friend test same precompiled test program. 100  and no distortion. So this depends on hardware or windows too

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Audio clicking at end of playback
« Reply #11 on: 31 Jul '17 - 17:45 »
So perhaps the extra update thread helps here?  The bug is obviously still going to be there though - and it is bound to still turn up until the underlying cause is dealt with.

I don't think the extra update thread would affect it. Are you sure leaving BASS_CONFIG_UPDATETHREADS at 1 makes it worse?

Anyway, I will try to think of what could be causing the problem. I may need to send you a debug version (please confirm that the address you entered is correct).

daniel2

  • Guest
Re: Audio clicking at end of playback
« Reply #12 on: 1 Aug '17 - 02:34 »
The email addy is correct, yes.  The update threads only changes it so another different sized sample is affected.  It isn't really fixing anything.  You are v likely going to have to send the debug version as I think this is a very unique issue...  my two mates tested my prog 100 times with zero ill effects.

Dan

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Audio clicking at end of playback
« Reply #13 on: 2 Aug '17 - 17:23 »
I forgot to ask earlier, did you also get the problem when using the BASSTEST example's "Sample" playback option, or only when using the "Stream" playback option?

daniel2

  • Guest
Re: Audio clicking at end of playback
« Reply #14 on: 2 Aug '17 - 23:14 »
I havent checked sample version, but I have checked stream with mem = true.