BASS_ChannelGetLevel(Ex) latency

Started by Couin,

Couin

Hi,

I'm about making some changes about microphone input, to add an Echo effect.
So I need also to change how VU meters and Talk Over (turning ON the Mic input volume when threshold level is reached).

Here is my code :
rchan = BASS_RecordStart(rdevinfo.freq, 2, 0, 0, 0)

For nSplit = 0 To 1
Splitrchan(nSplit) = BASS_Split_StreamCreate(rchan, BASS_STREAM_DECODE, ByVal 0)
Next nSplit

Call BASS_ChannelSlideAttribute(Splitrchan(0), BASS_ATTRIB_VOLDSP, 0, 10)

rchanfx = BASS_FX_TempoCreate(Splitrchan(0), BASS_STREAM_DECODE Or BASS_FX_FREESOURCE)

Dim echo As BASS_DX8_ECHO
Dim fxrchan As Long

fxrchan = BASS_ChannelSetFX(rchanfx, BASS_FX_DX8_ECHO, 10)
Call BASS_FXGetParameters(fxrchan, echo)
echo.fFeedback = 50
echo.fWetDryMix = 50
echo.lPanDelay = 0
echo.fLeftDelay = 500
echo.fRightDelay = 500
Call BASS_FXSetParameters(fxrchan, echo)

Call BASS_Mixer_StreamAddChannel(MixerMic, rchanfx, BASS_MIXER_CHAN_BUFFER)

Splitrchan(0) is for turning ON/OFF the Mic ( with Call BASS_ChannelSlideAttribute(Splitrchan(0), BASS_ATTRIB_VOLDSP,... ) before FX.
Splitrchan(1) is for permanent measuring the Mic input for the Talk Over.
Because I don't want to turn off the echo when I turn off the Mic.

And in a timer:
Call BASS_ChannelGetLevelEx(Splitrchan(1)... 'For Talk Over
...
Call BASS_ChannelGetLevelEx(rchanfx... 'For Mic after FX

But there is around 2 seconds of delay for the Talk Over, I mean the Talk Over, it turns ON 2 seconds after hitting the Mic cartridge.

I pretty to have already seen this problem but after search on my archives and on the forum, I don't retreive the solution, to avoid this delay.

BASS_ATTRIB_BUFFER on Splitrchan did not resolved the problem.

An idea ?

Thanks :D


Couin

I created another mixer and I send Splitrchan(1) to this mixer, and it looks the delay gone.

I the device setup here is the code I added:
MixerNull = BASS_Mixer_StreamCreate(44100, 2, BASS_SAMPLE_FLOAT Or BASS_MIXER_NONSTOP)
Call BASS_ChannelSetAttribute(MixerNull, BASS_ATTRIB_BUFFER, 0)
Call BASS_ChannelStart(MixerNull)

After Call BASS_ChannelSlideAttribute(Splitrchan(0), BASS_ATTRIB_VOLDSP, 0, 10), I added:
Call BASS_Mixer_StreamAddChannel(MixerNull, Splitrchan(1), BASS_MIXER_CHAN_BUFFER)
And for measure (for Talk Over):Call BASS_Mixer_ChannelGetLevelEx(Splitrchan(1), ...And it looks ok with no delay.

I will keep this solution, unless there is a better way to do :)

Ian @ un4seen

Quote from: CouinBut there is around 2 seconds of delay for the Talk Over, I mean the Talk Over, it turns ON 2 seconds after hitting the Mic cartridge.

I pretty to have already seen this problem but after search on my archives and on the forum, I don't retreive the solution, to avoid this delay.

BASS_ATTRIB_BUFFER on Splitrchan did not resolved the problem.

An idea ?

It looks like you're on the right track with setting BASS_ATTRIB_BUFFER=0, but that can't be applied to "Splitrchan" because it's a decoding channel (BASS_STREAM_DECODE), which means it has no playback buffer. It could instead be applied to "MixerMic", which has the playback buffer.

Couin

Hi Ian

For Talk Over (based on level detection of input device), I need to pick the level before applying the volume on Splitrchan(0). That's why I would get the Splitrchan(1) level, but earing it from the output.
MixerMic receive the channel (rchanfx) where echo is applyed after applying volume (because I do'nt want to cut the echo when I turn the volume off of the input).