v.trivedi
v.trivedi

Reputation: 11

Concatenate .Wav file by their header into 1 Temp File

How do i concatenate .Wav files's header into one Temp file. I am trying to merge multiple segments of Telephone call. And in Database this all Segments will have same call ID because it is one call but multiple segments.

Upvotes: 1

Views: 130

Answers (1)

Genti Saliu
Genti Saliu

Reputation: 2723

See this CodeProject article: http://www.codeproject.com/Articles/35725/C-WAV-file-class-audio-mixing-and-some-light-audio

The relevant part is the class WAVFile.cs - the merging of two WAV files is implemented in its method MergeAudioFiles (line 1326).

This gist contains WAVFile.cs. Other things which are useful:

  • The header of a WAV file is created inside the Create method (starting from line 441, as per the WAV format specification, see Wikipedia or the full specification)
  • the header of a WAV file is read/loaded in the Open method (line 93).
  • you can set additional metadata in the optional INFO section, http://www.robotplanet.dk/audio/wav_meta_data has a pretty nice overview. This is not implemented in the class referenced above.

To create a temporary file (MSDN):

string tempFileName = Path.GetTempFileName();

Upvotes: 3

Related Questions