≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
join wav files
Posted by:
(you are not logged in)
Enter the missing letter in: "Internati?nal"
(you are not logged in)
Text:
[quote][b]drvds[/b] wrote: Hello, I am trying to use irrklang to join two wav files, but I am kind of stuck right now. For the beginning I would like to just simply attach the data segment of one wav file to itself *to practice*. For example: the input wav file might be 3 seconds long and someone says "ok", -> I want the output wavfile to be six second long with the person saying ok, twice - i hope this makes sense^^ I doubled the length and size, but something seems to be wrong with the way i duplicate the data buffer... [Code] ISoundSource* firstwav = engine->addSoundSourceFromFile("somewav.wav"); SAudioStreamFormat format1 = firstwav->getAudioFormat(); SAudioStreamFormat format2 = secondwav->getAudioFormat(); // write wave header unsigned short formatType = 1; unsigned short numChannels = format1.ChannelCount; unsigned long sampleRate = format1.SampleRate; unsigned short bitsPerChannel = format1.getSampleSize() * 8; unsigned short bytesPerSample = format1.getFrameSize() ; unsigned long bytesPerSecond = format1.getBytesPerSecond(); unsigned long dataLen = format1.getSampleDataSize(); const int fmtChunkLen = 16; const int waveHeaderLen = 4 + 8 + fmtChunkLen + 8; unsigned long totalLen = waveHeaderLen + dataLen; void* data = firstwav->getSampleData(); char* dopple = new char[dataLen*2]; char* single = (char*)data; int counter1=0; int counter2 =0; while(counter1 < dataLen ) { dopple[counter1] = single[counter1]; counter1++; } //the error should be here while(counter1 < dataLen) { dopple[counter1] = single[counter2]; counter1++; counter2++; } dataLen = dataLen *2; totalLen = waveHeaderLen + dataLen; wxFile file1; file1.Create("double.wav",true,wxS_DEFAULT); if (!file1.IsOpened()) return false; file1.Write("RIFF",4); file1.Write(&totalLen, 4); file1.Write("WAVE", 4); file1.Write("fmt ", 4); file1.Write(&fmtChunkLen, 4); file1.Write(&formatType, 2); file1.Write(&numChannels, 2); file1.Write(&sampleRate, 4); file1.Write(&bytesPerSecond, 4); file1.Write(&bytesPerSample, 2); file1.Write(&bitsPerChannel, 2); // write data file1.Write("data", 4); file1.Write(&dataLen, 4); file1.Write(dopple, dataLen); file1.Close(); [/Code][/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact