Hi

Make sure you have the MP3 header matching the wave file. For example

Sample Rate

Word Size (genaraly 16 bits that bits per sample and channel). If the wave
file has 24 bit audio you must first convert it to 16 bit audio. Don't know
if Fraunhofers MP3 Converter can manage 24 bit audio.

Stereo or non stereo.


Then there is another thing that is very good to do before you call the DLL.
And that should be done every time you call the DLL. You must make sure that
the mp3 DLL doesn't mess upp the Current Working (CW) state of the CPU. I
have added a code sample for this below. I had to add this for the
Fraunhofer MP3 DLL I made in 2001 to sort out manny different bugs.



Here's the code basicly a header file.

=============== CWState.h ==============
#ifndef __CWstate_h
# define __CWstate_h

#include <float.h>

//
// Usage of this class
//
// float __cdecl exportedDLLFuncion()
// {
//  float fResult;
//  TProtectCPU safeCWState;
//  // Save the old state and set a new state.
//
//  fResult = aCallToNonWrappedFunction( float f, int d );
//
//  //  The default destructor takes care of reseting the CW state
// }
//

class TProtectCPU
{
private:
  unsigned short cw_fpu;
  unsigned short tmp;
public:
  TProtectCPU ()
    {
    cw_fpu = _control87( 0, 0 );
    //_control87( _MCW_EM, _MCW_EM   );

    //
    //  Which parametes to use can differ from application to application,
    //  from program to program, or from DLL to DLL.
    //
    _control87(( _RC_NEAR + _PC_53 + _EM_INVALID + _EM_ZERODIVIDE +
_EM_OVERFLOW
             + _EM_UNDERFLOW + _EM_INEXACT + _EM_DENORMAL),
             _MCW_EM|_MCW_PC|_MCW_RC);
    }

  ~TProtectCPU ()
    {
    _clear87();
    _control87( cw_fpu, 0xFFFF );
    }
};

#endif
====END OF FILE ===================

Here's how to use the file

#include "CWState.h"

float foo( float f, double d, int i, char* s)
{
    TProtectCPU SafeCPU;
    //  The default constructo sets the same CW State as the DLL is compiled
with.

    //  Make the calls to the DLL here.

    //  THe automatic destructor resets the CW
}


======  END OF EXAMPLE ============

Lars Rosenberg
Developer of Rosoft Audio Tools
[EMAIL PROTECTED]

----- Original Message ----- 
From: "PGFrank - Tecnocanal" <[EMAIL PROTECTED]>
To: "Takehiro Tominaga" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Sunday, August 10, 2003 12:28 AM
Subject: RE: [mp3encoder] Scratch noise at beginning of the MP3 file


> I'm very sorry, but I don't understand what you mean.
>
> I have a program made by somebody else (I don't have the source code). I
use
> that program to convert MYSOUND.WAV to MYSOUND.MP3 and the conversion is
> perfect.
>
> I code my own program USING EXACTLY THE SAME LAME DLL and the MP3 file has
> the scratch at the beginning. I don't know what am I doing wrong.
>
> Best regards.
>
> Pablo Frank
> www.tecnocanal.com
>
>
>
>
> -----Mensaje original-----
> De: Takehiro Tominaga [mailto:[EMAIL PROTECTED]
> Enviado el: Sabado 9 de Agosto de 2003 07:16 AM
> Para: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Asunto: Re: [mp3encoder] Scratch noise at beginning of the MP3 file
>
>
> From: "PGFrank - Tecnocanal" <[EMAIL PROTECTED]>
> Subject: [mp3encoder] Scratch noise at beginning of the MP3 file
> Date: Sat, 9 Aug 2003 01:42:48 -0300
>
> > I am working with Delphi using the LAME_ENC.DLL version 3.93.1.
Everything
> > is right, except that I get a scratch noise at the beginning of the MP3
> > file.
> >
> > Can anybody help me to solve this problem?
>
> check you do not treat the header (RIFF-wav file header) as sound data and
> encode it into mp3.
> --
> Takehiro TOMINAGA // may the source be with you!
>
>
> _______________________________________________
> mp3encoder mailing list
> [EMAIL PROTECTED]
> http://minnie.tuhs.org/mailman/listinfo/mp3encoder
>


_______________________________________________
mp3encoder mailing list
[EMAIL PROTECTED]
http://minnie.tuhs.org/mailman/listinfo/mp3encoder

Reply via email to