Articles   Members Online: 3
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to combine multiple wave files into a single one Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
09-Jan-04
Category
Multimedia
Language
Delphi 2.x
Views
125
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Lou Adler

Does anyone have a snippet of code in Delphi to combine multiple WAV files into 
one? I am writing a very simple text-to-speech application for Chinese 
pronounciation. I have all the wave files needed to synthesize Chinese 
pronounciation (506 files in all). Now, all I need is the ability to create one 
wave file based on a list of multiple wave files which are in a specific order.

Answer:

This one should work with any PCM format as long as all files are the same format:

1   procedure JoinWaves(FileList: TStrings; OutputFile: string);
2   {All files must be of the same format}
3   var
4     I: Integer;
5     FileSize: LongInt;
6     InStream, OutStream: TFileStream;
7   begin
8     OutStream := TFileStream.Create(OutputFile, fmCreate);
9     try
10      for I := 0 to FileList.Count - 1 do
11        if FileExists(FileList[I]) then
12        begin
13          InStream := TFileStream.Create(FileList[I], fmOpenRead);
14          try
15            if I = 0 then
16              OutStream.CopyFrom(InStream, InStream.Size)
17            else if InStream.Size > 44 then
18            begin
19              InStream.Position := 44;
20              OutStream.CopyFrom(InStream, InStream.Size - 44);
21            end;
22          finally
23            InStream.Free;
24          end;
25        end;
26      OutStream.Position := 4;
27      FileSize := OutStream.Size - 8;
28      OutStream.WriteBuffer(FileSize, SizeOf(FileSize));
29      OutStream.Position := 40;
30      FileSize := OutStream.Size - 44;
31      OutStream.WriteBuffer(FileSize, SizeOf(FileSize));
32    finally
33      OutStream.Free;
34    end;
35  end;



			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC