Author Topic: "poping" sound when Channel is freed.  (Read 3583 times)

ken

  • Posts: 739
"poping" sound when Channel is freed.
« on: 8 Apr '10 - 08:40 »
Hi Ian,

Senario:

Application that plays two mp3 at the same time using BASS, BASSMIX and BASS_ASIO. (and Bass.NET)

I Init BASS, add ASIO, create a mixer and attach two channels. When stopping one channel (ChannelSlideAttribute) I get a big "poping" sound when the channel is freed on the other playing channel. I use BASS_STREAM_AUTOFREE on BASS_Mixer_StreamAddChannel. Same if I don't use BASS_STREAM_AUTOFREE and using BASS_StreamFree I get the "poping sound" on the other channel.


I hade this problem for some time now and to not hear the "pop" I have to set ASIO buffer very high like 4096. But then I somehow installed a old version of BASS.dll (2.4.3.1) then the "poping sound" is gone, I can even have low ASIO buffer like 128

I have latest versions of bassmix and bassasio dll's

Any ideas?

/Ken

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: "poping" sound when Channel is freed.
« Reply #1 on: 8 Apr '10 - 13:14 »
What is the exact BASS.DLL version that you are using? If it is the 2.4.5 release version, I suspect the latest "stuff" will help...

   www.un4seen.com/stuff/bass.dll

In 2.4.5, BASS_StreamFree has a delay, which could cause problems for low-latency stuff like yours. It has since been removed/reduced.

ken

  • Posts: 739
Re: "poping" sound when Channel is freed.
« Reply #2 on: 8 Apr '10 - 18:47 »
What is the exact BASS.DLL version that you are using? If it is the 2.4.5 release version, I suspect the latest "stuff" will help...

   www.un4seen.com/stuff/bass.dll

In 2.4.5, BASS_StreamFree has a delay, which could cause problems for low-latency stuff like yours. It has since been removed/reduced.


Yes! This new version of BASS works realy good, looks like the "pops" are gone, Thanks Ian.

Is there any way that I can add a buffer on a MP3 playback on "BASS_StreamCreateFileUser" or "BASS_Mixer_StreamAddChannel" for more stable playback (files on a server)?

I don't want to increse ASIO buffer since I use "live input" and need low latency on thoose

Here is how I do "live input"
Code: [Select]
_asioIn.SetFullDuplex(0, BASSFlag.BASS_STREAM_DECODE, false);
_inpCh = _asioIn.OutputChannel

BassMix.BASS_Mixer_StreamAddChannel(OutputMixer, _inpCh, BASSFlag.BASS_MIXER_DOWNMIX | BASSFlag.BASS_STREAM_AUTOFREE);



ken

  • Posts: 739
Re: "poping" sound when Channel is freed.
« Reply #3 on: 11 Apr '10 - 10:50 »

Can I add a buffer to a stream without set higher buffer to ASIO, I get "shopping metalic sound" when doing other stuff (sometime when open another application) running on Windows7 32-bit.

 

radio42

  • Posts: 4576
Re: "poping" sound when Channel is freed.
« Reply #4 on: 11 Apr '10 - 11:18 »
The Bass.Net AsioHandler uses a push stream to create a full duplex stream when the "SetFullDuplex" method is called.
So when calling "SetFullDuplex" you might use the last (3rd) parameter to create a 'buffered' push stream.
See the docs for more info.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: "poping" sound when Channel is freed.
« Reply #5 on: 12 Apr '10 - 14:21 »
Is there any way that I can add a buffer on a MP3 playback on "BASS_StreamCreateFileUser" or "BASS_Mixer_StreamAddChannel" for more stable playback (files on a server)?

I don't want to increse ASIO buffer since I use "live input" and need low latency on thoose

What you could do is place a push stream (BASS_StreamCreate + STREAMPROC_PUSH) between the MP3 and the mixer, ie. the MP3 feeds the push stream, which in turn feeds the mixer. That allows you to move the MP3 processing out of the ASIO driver's thread, by having a worker thread decode data from the MP3 and feed it (via BASS_StreamPutData) to the push stream. The worker thread can use the BASS_StreamPutData return value to know how much data is buffered, and so regulate its processing rate.

ken

  • Posts: 739
Re: "poping" sound when Channel is freed.
« Reply #6 on: 12 Apr '10 - 15:23 »

What you could do is place a push stream (BASS_StreamCreate + STREAMPROC_PUSH) between the MP3 and the mixer, ie. the MP3 feeds the push stream, which in turn feeds the mixer. That allows you to move the MP3 processing out of the ASIO driver's thread, by having a worker thread decode data from the MP3 and feed it (via BASS_StreamPutData) to the push stream. The worker thread can use the BASS_StreamPutData return value to know how much data is buffered, and so regulate its processing rate.

OK, sounds good. Is there and code snipps on how to do this with BASS_StreamPutData, preferly in C#?

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: "poping" sound when Channel is freed.
« Reply #7 on: 13 Apr '10 - 14:31 »
Not C# I'm afraid, but here is some example code that you could adapt...

   https://www.un4seen.com/forum/?topic=10714.msg74483#msg74483