Author Topic: Audio "clicks" on re-play while playing  (Read 162 times)

Couin

  • Posts: 126
Audio "clicks" on re-play while playing
« on: 19 Nov '24 - 02:09 »
Hi :)

Is there a simple way to reduce or ride off audio clicks that can occur on re-play while playing ? (Listen the attached recording -and don't laugh about the sound itself AHAH)

I would not use fade out of BASS_ChannelSlideAttribute because it would add some latency to re-play.

I think that without this, it is propbably impossible, but in case of a secret tip :)

Thanks :D

Ian @ un4seen

  • Administrator
  • Posts: 26172
Re: Audio "clicks" on re-play while playing
« Reply #1 on: 19 Nov '24 - 16:30 »
By default, BASS will ramp-in when starting playback and ramp-out when stopping to prevent such "clicks", so you could try just stopping and waiting briefly for the ramp-out before resuming at the new position. Something like this:

Code: [Select]
BASS_ChannelStop(stream); // stop the stream
Sleep(10); // wait 10ms for ramp-out
BASS_ChannelSetPosition(stream, ...); // set new position
BASS_ChannelStart(stream); // resume

Another option is to crossfade the old and new positions using BASS_ChannelSlideAttribute, but you would need 2 streams for that: one to fade-out and one the fade-in at the same time.

Couin

  • Posts: 126
Re: Audio "clicks" on re-play while playing
« Reply #2 on: 24 Nov '24 - 16:05 »
Hi Ian,

Sorry for delay ton feed back, thanks for answer :)

Creating a second stream and alternate between then could be a idea, but in my case, would require a lot of code changing, because there is not only one stream and there ar also a lot of things around them.

Just with Sleep (even with a larger delay) did not resolved the problem, I had to combinate with BASS_ChannelSlideAttribute and also make sleep longer than slide:
Code: [Select]
Call BASS_ChannelSlideAttribute(chan, BASS_ATTRIB_VOL, 0, 10)
Sleep (20)
Call BASS_ChannelStop(chan)
It finally not add very perceptible latency on repeat.

Ian @ un4seen

  • Administrator
  • Posts: 26172
Re: Audio "clicks" on re-play while playing
« Reply #3 on: 25 Nov '24 - 12:14 »
Just with Sleep (even with a larger delay) did not resolved the problem...

That's strange. Do you have playback buffering disabled via the BASS_ATTRIB_BUFFER option? That will prevent ramping-out (because there's no buffered data for it). Otherwise, can you post a short lossless (eg. WAV or FLAC) recording of it to confirm whether it is ramping-in/out properly?