WaveAudio: how to mix recording and playback sounds

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

WaveAudio: how to mix recording and playback sounds

Postby u2227 » May 30th, 2010, 11:09 am

Hello please help with WaveAudio.
I need to record voice from microphone, and play audio at the same time, and the played audio and voice should be mixed together into the recorded stream. I was reading the documentation carefully and inspecting the existing components, but I cannot find how to achieve this.

Thank you
u2227
Member
Member
 
Posts: 1
Joined: May 30th, 2010, 9:17 am

Re: WaveAudio: how to mix recording and playback sounds

Postby Kambiz » May 30th, 2010, 10:47 pm

The Mix method of TWaveStreamAdapter class can mix PCM waves of the same format.

For example:

Code: Select all
function MixWaveFiles(const Src1, Src2, Dest: String): Boolean;
var
  W1, W2, WM: TWaveFile;
begin
  W1 := TWaveFile.Create(Src1, fmOpenRead or fmShareDenyWrite);
  W2 := TWaveFile.Create(Src2, fmOpenRead or fmShareDenyWrite);
  WM := TWaveFile.Create(Dest, fmCreate);
  Result := WM.Mix([W1, W2])
  WM.Free;
  W2.Free;
  W1.Free;
end;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 1 guest

cron