Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3877

Re: Join WAV /AIFF files

$
0
0

I’m trying to merge WAV files and I found this code posted by Wayne Golding:

Sub JoinWaveFiles(InFile1 As FolderItem, InFile2 As FolderItem, OutFile As FolderItem)
Dim InData1 As MemoryBlock
Dim InData2 As MemoryBlock
Dim bsIn As BinaryStream

// Read the files into memory
bsIn = BinaryStream.Open(InFile1)
InData1 = bsIn.Read(bsIn.Length)
bsIn.Close
bsIn = BinaryStream.Open(InFile2)
InData2 = bsIn.Read(bsIn.Length)
bsIn.Close

// Create the joined Data
Dim OutData As New MemoryBlock(InData1.Size + InData2.Size - 44)
OutData = InData1 + InData2.MidB(44)

// Update the header
Dim chunksize As Integer = OutData.Size - 8
Dim subchunksize As Integer = OutData.Size - 44

OutData.Long(4) = chunksize
OutData.Long(40) = subchunksize

// Save the joined files to disk
Dim bsOut As BinaryStream
bsOut = BinaryStream.Create(OutFile, True)
bsOut.Write(OutData)
bsOut.Close

End Sub

It successfully joins the files but there is a clicking sound after each joined file. Does anyone know what might be causing the clicks?

Thanks!

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 3877

Trending Articles