Author Topic: BASS_FX_BFX_PITCHSHIFT  (Read 416 times)

rv

  • Posts: 192
BASS_FX_BFX_PITCHSHIFT
« on: 7 Jun '17 - 00:51 »
Hello,

When using this FX in realtime, the sound is crackling

I am using wasapi exclusive with a very low latency of 5ms, and the mp3 stream is playing trough a mixer

I am using BASS_ASYNCFILE

Is it possible to add buffer / delay few milliseconds the mp3 playing, to allow the FX to do its job without crackeling?




Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS_FX_BFX_PITCHSHIFT
« Reply #1 on: 7 Jun '17 - 16:11 »
The latest BASSmix build has an asynchronous splitter option that you could try (put a splitter between the source and the mixer):

   www.un4seen.com/stuff/bassmix.zip

The new async stuff is the BASS_ATTRIB_SPLIT_ASYNCBUFFER and BASS_ATTRIB_SPLIT_ASYNCPERIOD options. The former sets how much data to asynchronously buffer from the source, and the latter limits how much data to request from the source each time. Both values are in seconds, and can be adjusted (via BASS_ChannelSetAttribute) at any time. Setting BASS_ATTRIB_SPLIT_ASYNCBUFFER to 0 disables asynchronous buffering (that's the default).

rv

  • Posts: 192
Re: BASS_FX_BFX_PITCHSHIFT
« Reply #2 on: 9 Jun '17 - 16:33 »
Hello Ian,

I have tried many things on what you have suggested, but can't make it working, and also can't find any exemple on this Split Async buffer....

Can you please write some line of code to explain what is your idea to differ a bit the starting of the mp3 to allow the BASS_FX_BFX_PITCHSHIFT FX to be playing without crakeling at low wasapi latency ?

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS_FX_BFX_PITCHSHIFT
« Reply #3 on: 9 Jun '17 - 17:43 »
You could try something like this:

Code: [Select]
splitter=BASS_Split_StreamCreate(decoder, BASS_STREAM_DECODE, NULL); // create a splitter for the MP3 decoder
BASS_ChannelSetAttribute(splitter, BASS_ATTRIB_SPLIT_ASYNCPERIOD, 0.05); // set its async period to 50ms
BASS_ChannelSetAttribute(splitter, BASS_ATTRIB_SPLIT_ASYNCBUFFER, 0.2); // set its async buffer to 200ms
BASS_Mixer_StreamAddChannel(mixer, splitter, 0); // plug it into the mixer

rv

  • Posts: 192
Re: BASS_FX_BFX_PITCHSHIFT
« Reply #4 on: 11 Jun '17 - 00:49 »
This does not change anything. it delays the starting but it seems that the FX processing is still applied on playing time, and is crackeling

        Dim tp As New BASS_BFX_PITCHSHIFT
        tp.fPitchShift = 0.9  ' 1= no change
        tp.lChannel = -1
        tp.lFFTsize = 2048 '8192 for best quality
        tp.lOsamp = 8 ' 32 for best quality

        BASS_FXSetParameters(_tempoStreamHandle, tp)
        BASS_ChannelSetAttribute(splitter, BASS_ATTRIB_FREQ, 44100 / 0.9)

Any other ideas?  I can't apply this BASS_BFX_PITCHSHIFT without hearing crackelings

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BASS_FX_BFX_PITCHSHIFT
« Reply #5 on: 12 Jun '17 - 17:11 »
The effect should be set on the source/decoder stream rather than the splitter, to have the effect applied when data is decoded rather than when it is mixed. If that is what you are already doing, then are you certain that the problem is related to using a small output buffer, eg. does it go away when you use a larger buffer? Also, what does BASS_WASAPI_GetCPU say when the problem is happening?