Author Topic: BASS_RecordStart and BASS_ATTRIB_VOL  (Read 390 times)

Ed1966

  • Posts: 194
BASS_RecordStart and BASS_ATTRIB_VOL
« on: 2 Sep '21 - 19:26 »
Hello,

I want to control the BASS_RecordStart volume as kind of master volume but nothing happens.

The AMixerSplitter  and AOutputSplitter default 0..2 but want to control the BASS_RecordStart input volume.

What is wrong or what to do. Don't use VST.

Code: [Select]
class function TBASSRECORD_LineMonitor.RecordAndSplitA(RecordVolume: FLOAT; RECORDINFO: BASS_RECORDINFO): Boolean;

  function StreamProc(FHandle: HSTREAM; buffer: Pointer; length: DWORD; user: Pointer): DWORD stdcall;
  begin
    Result := BASS_ChannelGetData(AGlobalRecord, buffer, length);
  end;

begin
  // Samen activeren
  ARecordStream := BASS_StreamCreate(RECORDINFO.freq, 2, BASS_STREAM_DECODE or BASS_SAMPLE_FLOAT, @StreamProc, nil);
  AGlobalRecord := BASS_RecordStart(RECORDINFO.freq, 2, BASS_SAMPLE_FLOAT, nil, nil);

  // AGlobalRecord same results
  Result := BASS_ChannelSetAttribute(ARecordStream, BASS_ATTRIB_VOL, RecordVolume); // 0..1 DOES NOT WORK?

  // Two streams; Volume will be define outside this function
  AMixerSplitter := BASS_Split_StreamCreate(ARecordStream, BASS_STREAM_DECODE, nil);
  AOutputSplitter := BASS_Split_StreamCreate(ARecordStream, 0, nil);

  Result := (BASS_ErrorGetCode = 0);
end;

Regards,
Eduard.

Chris

  • Posts: 1989
Re: BASS_RecordStart and BASS_ATTRIB_VOL
« Reply #1 on: 2 Sep '21 - 20:27 »
No the volume of playing is a other thing as the volume of recording.
you can try this
BASS_RecordSetInput(0, BASS_INPUT_ON, 0.75); // will ajust 75% of Max Volume

Ed1966

  • Posts: 194
Re: BASS_RecordStart and BASS_ATTRIB_VOL
« Reply #2 on: 3 Sep '21 - 04:30 »
That is working but reading...

"Changes made by this function are system-wide, ie. other software using the device will be affected by it. "

With multi DJ software it's not a good idea.

I use stream 'AMixerSplitter' for live broadcast and 'AOutputSplitter' to listen if needed.

The only way is set volume on AOutputSplitter or are there more options concern RecordStart?

If not I remove the line input volume settings in my program.

Greetings,
Eduard.


 

Chris

  • Posts: 1989
Re: BASS_RecordStart and BASS_ATTRIB_VOL
« Reply #3 on: 3 Sep '21 - 11:31 »
Ok , if I right understand you will have a Master Volume Slider ,
and multiple Volume Sliders for the Streams,Monitor and so on that are Kinds of the Master Volume.
So there are only 2 Ways,
1: BASS_RecordSetInput(3, BASS_INPUT_ON, 0.75); ([3] in my Case on my PC) changing the What You here Volume for Recording
2: use Bass_FX (BASS_FX_BFX_VOLUME) will Change the Volume via DSP)

but I think the best way is to set that via the first Solution to became the optimal Sound Quality.
By the way how do want to record ? via Loopback or eg Stereomix  ?



Ian @ un4seen

  • Administrator
  • Posts: 23983
Re: BASS_RecordStart and BASS_ATTRIB_VOL
« Reply #4 on: 3 Sep '21 - 16:49 »
The BASS_ATTRIB_VOL setting doesn't affect recording (unless the recording is plugged into a mixer). You can instead use the BASS_FX_VOLUME effect via BASS_ChannelSetFX, which will change the level of your recording without affecting other recordings (unlike BASS_RecordSetInput). For example, like this:

Code: [Select]
HFX volfx = BASS_ChannelSetFX(recording, BASS_FX_VOLUME, 0); // set a volume effect on the recording
BASS_FX_VOLUME_PARAM volparam = {
volume,
0,
0,
0
};
BASS_FXSetParamterts(volfx, volparam); // set the effect parameters

Please see the BASS_FX_VOLUME_PARAM documentation for parameter info.

Ed1966

  • Posts: 194
Re: BASS_RecordStart and BASS_ATTRIB_VOL
« Reply #5 on: 6 Sep '21 - 09:42 »
Thank you. I now use this one but only to adjust the record signal.

Chris: Record will be from the line-in. I use as input a external Mixer with two turntables. Old fashion.   :D
 
The real volume change is on the AOutputSplitter (see source)
Live broadcast will be done through AMixerSplitter stream.

As you can see the priority is high at 100 but that is because i use normalize, compressor, equalizer or VST when needed.
(I think they must come later, so lower priority) 

Code: [Select]
class function TBASSRECORD_LineMonitor.SetRecordVolume(AVolume: FLOAT; AEnabled: Boolean): Boolean;
// DSP/FX with higher priority are applied before those with lower.
const
  _PRIORITY = 100;
begin
  BASS_ChannelRemoveFX(ARecordStream, volfx);
  if (not AEnabled) then Exit;

  volfx := BASS_ChannelSetFX(ARecordStream, BASS_FX_VOLUME, _PRIORITY); // set a volume effect on the recording
  volparam.fTarget := AVolume;
  volparam.fCurrent := 0;
  volparam.fTime := 0;
  volparam.lCurve := 0;
  Result := BASS_FXSetParameters(volfx, @volparam); // set the effect parameters
end;

Regards,
Eduard.

Ian @ un4seen

  • Administrator
  • Posts: 23983
Re: BASS_RecordStart and BASS_ATTRIB_VOL
« Reply #6 on: 6 Sep '21 - 13:07 »
Rather than removing and setting a new BASS_FX_VOLUME effect for each volume change, I would recommend just calling BASS_FXSetParameters to change the parameters of the existing effect. You can also use the "fTime" parameter then to ramp the volume change and avoid a "click" sound.

Ed1966

  • Posts: 194
Re: BASS_RecordStart and BASS_ATTRIB_VOL
« Reply #7 on: 6 Sep '21 - 14:32 »
Thank you  :)