I have been working on a program for recording voice conversations as a mini project.
I have the recording working 100%, my problem is that I have no idea how to encode the wav file to a mp3 file.
Here is my recording and saving code:

procedure TForm1.Button1Click(Sender: TObject);
begin
  mciSendString('OPEN NEW TYPE WAVEAUDIO ALIAS mysound', nil, 0, Handle);
  mciSendString(
    'SET mysound TIME FORMAT MS BITSPERSAMPLE 16 CHANNELS 1 SAMPLESPERSEC 16384'
      + 'BYTESPERSEC 16384', nil, 0, Handle);
  mciSendString('RECORD mysound', nil, 0, Handle);
  Timer1.Enabled := true;
  sFormLabel := 'SED-Recorder : Recording';
  Form1.Caption := sFormLabel;
  StartTime := Now;
  iDisplayNumber := 0;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  sAudioName: string;
begin
  Timer1.Enabled := False;
  mciSendString('STOP mysound', nil, 0, Handle);
  SaveDialog1.Execute();
  sAudioName := SaveDialog1.FileName;
  mciSendString(PChar('SAVE mysound "' + sAudioName + '"'), nil, 0, Handle);
  mciSendString('CLOSE mysound', nil, 0, Handle);
  ProgressBar1.Position := 0;
  ProgressBar1.Visible := True;
  Saving.Enabled := True;
end;

Yes, I was going to suggest using the Lame mp3 encoding library. Also, there is open source code out there to do this, such as is used by the ffmpeg audio/video conversion tool.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.