Ross

I'm not quite sure where you are going wrong but I just tested

procedure TForm1.Edit1Change(Sender: TObject);
var
  db, code: Integer;
  r: double;
begin
  val(edit1.text,db,code);
  R := exp(db/10*ln(10));
  edit2.Text := FloatToStr(R);
end;

Which works a treat it gives me 0.5011 for -3 and 1.99 for 3

Neven



----- Original Message -----
From: "Ross Levis" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Thursday, March 06, 2003 8:42 PM
Subject: Re: [DUG]: db calculation


> This gives me roughly 0.2511, not 0.5 with -3db
>
> Cheers,
> Ross.
>
> Neven MacEwan wrote:
>
> >Ross
> >
> >exp() is a natural log, ie exponential of e,  not exponential of 10
> >Delphi has a log10 function but no Exp10 function I can see so
> >To do this you do use
> >
> >exp(db/10*ln(10))
> >
> >HTH
> >
> >Neven
> >----- Original Message -----
> >From: "Ross Levis" <[EMAIL PROTECTED]>
> >To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
> >Sent: Thursday, March 06, 2003 4:54 PM
> >Subject: Re: [DUG]: db calculation
> >
> >
> >
> >
> >>Hi
> >>
> >>This formula doesn't seem to work.  The 20 should be 10 as Neven pointed
> >>out but I believe a -3db reduction should take 65535 to 32767 but it's
> >>not close.  Any ideas?
> >>
> >>Cheers,
> >>Ross.
> >>
> >>Nello Sestini wrote:
> >>
> >>
> >>
> >>>         (db/20)
> >>>P1 = P2  e
> >>>
> >>>i.e. P1 = P2*exp(db/20)
> >>>
> >>>
> >>>not sure if this is what you are after
> >>>(and hope i haven't made some stupid mistake)
> >>>
> >>>
> >>>
> >>>-ns
> >>>http://www.roserox.co.th
> >>>
> >>>
> >>>----- Original Message -----
> >>>From: "Ross Levis" <[EMAIL PROTECTED]
> >>><mailto:[EMAIL PROTECTED]>>
> >>>To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]
> >>><mailto:[EMAIL PROTECTED]>>
> >>>Sent: Thursday, March 06, 2003 09:57
> >>>Subject: [DUG]: db calculation
> >>>
> >>>
> >>>
> >>>>Here's a maths question for you.  I've never been that good at maths,
> >>>>particularly logarithms
> >>>>
> >>>>Does anyone know the formula to alter an integer value by a particular
> >>>>db value.
> >>>>
> >>>>I'm working on an audio app and I need to alter the volume by a
> >>>>particular db setting.  The volume can be anywhere in the range 0
> >>>>(silent) to 65535 (maximum).
> >>>>
> >>>>I know that db = 20 log (P1/P2) though I've also seen the 20 at 10.
> >>>>
> >>>>
> >>>How
> >>>
> >>>
> >>>>do I get  P1 (or is it P2) to the left of the equation.
> >>>>
> >>>>Thanks,
> >>>>Ross Levis.
> >>>>
> >>>>
> >>>>
> >>>>
>
>>--------------------------------------------------------------------------
> >>
> >>
> >-
> >
> >
> >>>>    New Zealand Delphi Users group - Delphi List -
> >>>>
> >>>>
> >>>[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> >>>
> >>>
> >>>>                  Website: http://www.delphi.org.nz
> >>>>To UnSub, send email to: [EMAIL PROTECTED]
> >>>>
> >>>>
> >>><mailto:[EMAIL PROTECTED]>
> >>>
> >>>
> >>>>with body of "unsubscribe delphi"
> >>>>Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> >>>>
> >>>>
> >>>>
> >>
>
>>--------------------------------------------------------------------------
> >>
> >>
> >-
> >
> >
> >>    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >>                  Website: http://www.delphi.org.nz
> >>To UnSub, send email to: [EMAIL PROTECTED]
> >>with body of "unsubscribe delphi"
> >>Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> >>
> >>
> >>
> >>
> >
>
>---------------------------------------------------------------------------
> >    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                  Website: http://www.delphi.org.nz
> >To UnSub, send email to: [EMAIL PROTECTED]
> >with body of "unsubscribe delphi"
> >Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> >
> >
> >
>
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to