|
Mickael
Posts: 60
|
 |
« on: 4 May '08 - 00:41 » |
Quote
|
Hello, I want to increase (boost) the sound of some MP3 recorded too low (Ripp from Vinyl ..) Here is my code, but it does not work .. procedure TForm1.plus12dbClick(Sender: TObject); var vol: BASS_FX_DSPVOLUME; begin
BASS_FX_DSP_GetParameters(m1, BASS_FX_DSPFX_VOLUME, @vol); vol.fLeft := vol.fLeft + 12; vol.fRight := vol.Right + 12; BASS_FX_DSP_SetParameters(m1, BASS_FX_DSPFX_VOLUME, @vol);
end;
Thanks, Mickael.
|
|
|
|
|
Logged
|
|
|
|
|
Chris
Posts: 1507
|
 |
« Reply #1 on: 4 May '08 - 08:14 » |
Quote
|
Hi + 12 ??? Looks like a little bit to much The Values goes from 0.0 to 1.0 So it must be something like this vol.fLeft := vol.fLeft + (20 * Log10( 0.12 / 1.0));
Cheers Chris
|
|
|
|
« Last Edit: 4 May '08 - 08:28 by Chris »
|
Logged
|
|
|
|
|
Mickael
Posts: 60
|
 |
« Reply #2 on: 4 May '08 - 14:07 » |
Quote
|
Hello. procedure TForm1.plus12dbClick(Sender: TObject); var vol: BASS_FX_DSPVOLUME; begin
BASS_FX_DSP_GetParameters(m1, BASS_FX_DSPFX_VOLUME, @vol); vol.fLeft := vol.fLeft + (20 * Log10( 0.12 / 1.0)); vol.fRight := vol.fRight + (20 * Log10( 0.12 / 1.0)); BASS_FX_DSP_SetParameters(m1, BASS_FX_DSPFX_VOLUME, @vol);
end;
It does not work. The sound is still as low .. 
|
|
|
|
|
Logged
|
|
|
|
|
Chris
Posts: 1507
|
 |
« Reply #3 on: 4 May '08 - 16:01 » |
Quote
|
Hi which value does vol.fLeft return ??
|
|
|
|
|
Logged
|
|
|
|
|
big_gun
Posts: 342
|
 |
« Reply #4 on: 5 May '08 - 08:56 » |
Quote
|
Have you considered doing an auto-gain FX on the track? See BassFX in the documentation
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15276
|
 |
« Reply #5 on: 5 May '08 - 13:46 » |
Quote
|
Here is my code, but it does not work ..
The BASS_FX_DSPFX_VOLUME parameter is linear, so you would need to translate the dB value first... vol = pow(10, db/20);
|
|
|
|
|
Logged
|
|
|
|
|
Mickael
Posts: 60
|
 |
« Reply #6 on: 5 May '08 - 14:24 » |
Quote
|
Hello Ian, My code is: procedure TForm1.plus12dbClick(Sender: TObject); var vol: BASS_FX_DSPVOLUME; db : Integer; begin
BASS_FX_DSP_GetParameters(m1, BASS_FX_DSPFX_VOLUME, @vol); db := 12; // TEST vol.fLeft := vol.fLeft + pow(10, db/20); vol.fRight := vol.fRight + pow(10, db/20); BASS_FX_DSP_SetParameters(m1, BASS_FX_DSPFX_VOLUME, @vol);
end;
[Error] Unit1.pas(3113): Identificateur non déclaré : 'pow' Pow is not recognized into Delphi... ?
|
|
|
|
|
Logged
|
|
|
|
|
Bert
Posts: 159
|
 |
« Reply #7 on: 5 May '08 - 14:42 » |
Quote
|
Try: power(10, db/20);
|
|
|
|
|
Logged
|
|
|
|
|
Mickael
Posts: 60
|
 |
« Reply #8 on: 5 May '08 - 15:08 » |
Quote
|
procedure TForm1.plus12dbClick(Sender: TObject); var vol: BASS_FX_DSPVOLUME; db : Integer; begin
BASS_FX_DSP_GetParameters(m1, BASS_FX_DSPFX_VOLUME, @vol); db := 12; // TEST vol.fLeft := vol.fLeft + power(10, db/20); vol.fRight := vol.fRight + power(10, db/20); BASS_FX_DSP_SetParameters(m1, BASS_FX_DSPFX_VOLUME, @vol);
end;
not functions .. :-(
|
|
|
|
|
Logged
|
|
|
|
|
Chris
Posts: 1507
|
 |
« Reply #9 on: 5 May '08 - 17:04 » |
Quote
|
Hi by the way BASS_BFX_VOLUME = record lChannel : Integer; // BASS_BFX_CHANxxx flag/s or 0 for global volume control fVolume : FLOAT; // [0....1....n] linear end;
from where does the vol.left/vol.right come ?? Cheers Chris
|
|
|
|
|
Logged
|
|
|
|
|
Chris
Posts: 1507
|
 |
« Reply #10 on: 5 May '08 - 17:41 » |
Quote
|
Hi I did here a quick test and it will working absolute correct. In my situation its a mp3 File vol[1].fVolume will return 1.0 power(10, 12/20) will return 3.98107170553497
thats also correct(3 DB is the double-Value of the Volume Cheers Chris
|
|
|
|
|
Logged
|
|
|
|
|
Mickael
Posts: 60
|
 |
« Reply #11 on: 5 May '08 - 17:44 » |
Quote
|
sorry, I do not understand what I do. 
|
|
|
|
|
Logged
|
|
|
|
|
Chris
Posts: 1507
|
 |
« Reply #12 on: 5 May '08 - 17:55 » |
Quote
|
hi try this private DSPVol : BASS_FX_DSPVOLUME;
procedure Start; begin //here the channel create,play stuff BASS_FX_DSP_Set(Channel, BASS_FX_DSPFX_VOLUME, 1); end;
procedure TForm1.plus12dbClick(Sender: TObject); begin BASS_FX_DSP_GetParameters(Channel, BASS_FX_DSPFX_VOLUME, @DSPVol); DSPVol.fVolume := DSPVol.fVolume + power(10, 12/20); DSPVol.lChannel := BASS_FX_DSP_CHANALL; BASS_FX_DSP_SetParameters(Channel, BASS_FX_DSPFX_VOLUME,@DSPVol);
Cheers Chris
|
|
|
|
« Last Edit: 5 May '08 - 18:45 by Chris »
|
Logged
|
|
|
|
|
Mickael
Posts: 60
|
 |
« Reply #13 on: 6 May '08 - 12:11 » |
Quote
|
ok i'm testing this night
|
|
|
|
|
Logged
|
|
|
|
|
Ian @ un4seen
Administrator
Posts: 15276
|
 |
« Reply #14 on: 6 May '08 - 14:20 » |
Quote
|
sorry, I do not understand what I do.  It looks like you are possibly using an old BASS/BASS_FX version? As Chris points out, the effect's parameter structure is different in 2.4. Btw, you should just replace the current setting, not add to it, ie. there is no need for the "GetParameters" call.
|
|
|
|
|
Logged
|
|
|
|
|