Wanted: util to add 2 wav files, simple command line prog needed |
![]() ![]() |
Wanted: util to add 2 wav files, simple command line prog needed |
May 2 2003, 10:48
Post
#1
|
|
![]() ReplayGain developer Group: Developer Posts: 4589 Joined: 5-November 01 From: Yorkshire, UK Member No.: 409 |
Hi,
Does anyone have (or would anyone be willing to write) a simple Dos/Win32 command line utility that can take two 16-bit .wav files, add them together, and output the sum as a third .wav file? e.g. wavadd a.wav b.wav c.wav would go through a.wav, sample by sample, adding the same sample in b.wav, and outputing the result to c.wav. This would really help with the digital radio listening test that I'm putting together. As well as the original, there are two further files that I must distribute losslessly, but since they're almost the same as the original, it would take much less space to losslessly pack the DIFFERENCE between the original and coded (giving a smaller FLAC), and then add it back to the original at the other end. I need to do this from a bat file, so need a command line utility to take care of this. Can anyone help please? Cheers, David. EDIT: all files will be stereo, 16-bit, and either 44.1kHZ or 48kHz sampled. c.wav will never clip, so this doesn't need to be checked for. wavadd needs to be a small program. This post has been edited by 2Bdecided: May 2 2003, 10:51 |
|
|
|
May 2 2003, 11:02
Post
#2
|
|
|
Group: Members Posts: 159 Joined: 30-September 01 Member No.: 75 |
Case has this tiny little commandline thingy up: http://www.saunalahti.fi/~cse/files/wavmerge.zip
To confuse you, there's also an old installer software around with the same name, that works through a GUI. |
|
|
|
May 2 2003, 11:57
Post
#3
|
|
![]() ReplayGain developer Group: Developer Posts: 4589 Joined: 5-November 01 From: Yorkshire, UK Member No.: 409 |
This sounded great, but...
I tried wavmerge a.wav b.wav c.wav where a and b were 10 second long test files, 44.1kHz 16-bit, and c.wav didn't exist. It crashed CODE WAVMERGE caused an invalid page fault in module MSVCRT.DLL at 017f:7800d203. Registers: EAX=00650078 CS=017f EIP=7800d203 EFLGS=00010246 EBX=78001ec9 SS=0187 ESP=0063fc20 EBP=0063fc3c ECX=00455844 DS=0187 ESI=00760ec2 FS=34af EDX=00000ec6 ES=0187 EDI=00000000 GS=0000 Bytes at CS:EIP: 8b 14 31 8d 1c 31 89 55 f4 8b 56 fc 89 55 f8 8b Stack dump: 7801270c 00760ec6 78001ec9 006501bc 7803b534 78001d9a 00455844 0063fc80 7800cc3f 0075000c 00760ec6 7801270c 00760e94 78001ec9 78001026 00000006 any ideas? This post has been edited by 2Bdecided: May 2 2003, 11:57 |
|
|
|
May 2 2003, 12:25
Post
#4
|
|
![]() xcLame and OggDropXPd Developer Group: Developer Posts: 3708 Joined: 30-September 01 From: Bracknell, UK Member No.: 111 |
David, are you saying that you want to add two stereo wav files together to produce a third stereo wav file? Or, two mono files to make a stereo file? I wrote a little prog to do the second of these (it's at RareWares, m2s), but it wouldn't take much to do the first, I guess.
-------------------- John
---------------------------------------------------------------- My compiles and utilities are at http://www.rarewares.org/ |
|
|
|
May 2 2003, 12:31
Post
#5
|
|
![]() Group: Members (Donating) Posts: 480 Joined: 13-October 01 From: Stuttgart Member No.: 286 |
CopyAudio of the AFsp package can concatenate WAV files.
online documentation at: http://www.tsp.ece.mcgill.ca/MMSP/Document.../AFsp/AFsp.html download at: ftp://ftp.tnt.uni-hannover.de/pub/audio/AFsp |
|
|
|
May 2 2003, 12:44
Post
#6
|
|
|
Group: Members Posts: 159 Joined: 30-September 01 Member No.: 75 |
David, depending on your windows version, the msvcrt.dll (C++ runtimes) may be outdated. More here: http://support.microsoft.com/?kbid=190536
Wavmerge runs fine on this w2k sp2 work-PC. Thanks Sunhillow, I didn't know the tools you mention! |
|
|
|
May 2 2003, 12:49
Post
#7
|
|
![]() ReplayGain developer Group: Developer Posts: 4589 Joined: 5-November 01 From: Yorkshire, UK Member No.: 409 |
QUOTE (john33 @ May 2 2003 - 11:25 AM) David, are you saying that you want to add two stereo wav files together to produce a third stereo wav file? Or, two mono files to make a stereo file? I wrote a little prog to do the second of these (it's at RareWares, m2s), but it wouldn't take much to do the first, I guess. I need the first, not the second. This would perform the same process: Load A.wav into Cool Edit. Load B.wav into Cool Edit. Swich to A.wav Select All. Copy. Switch to B.wav Mix paste 100% non-inverting. Save As C.wav It sounds trivial to me, but I can't program. Subhillow, I don't want to concatenate, but maybe CopyAudio will do the job - I'll try. Cheers, David. |
|
|
|
May 2 2003, 12:53
Post
#8
|
|
![]() xcLame and OggDropXPd Developer Group: Developer Posts: 3708 Joined: 30-September 01 From: Bracknell, UK Member No.: 111 |
So you basically just want ((left channel + left channel) / 2) and the same for the right channel?
-------------------- John
---------------------------------------------------------------- My compiles and utilities are at http://www.rarewares.org/ |
|
|
|
May 2 2003, 13:19
Post
#9
|
|
![]() ReplayGain developer Group: Developer Posts: 4589 Joined: 5-November 01 From: Yorkshire, UK Member No.: 409 |
I don't even want the divided by 2 - just left+left! (and right plus right).
D. |
|
|
|
May 2 2003, 13:32
Post
#10
|
|
![]() ReplayGain developer Group: Developer Posts: 4589 Joined: 5-November 01 From: Yorkshire, UK Member No.: 409 |
The Microsoft Download didn't help with wavmerge. I wonder what's happening there?
Anyway, CopyAudio will do the job perfectly - thanks Sunhillow. This does exactly what I want: copyaudio --chanA="A+C" --chanB="B+D" a.wav b.wav c.wav I've just got to figure out how little of the AFsp distribution I can get away with including in the download. Even the exe itself seems quite large for the job I want it to do. So, if anyone can come up with a working 4.5kB (ish) file to do the same job, that would be even better! Cheers, David. |
|
|
|
May 2 2003, 13:51
Post
#11
|
|
|
Group: Developer (Donating) Posts: 2041 Joined: 19-October 01 From: Finland Member No.: 322 |
I hadn't tested wavmerge under Win98, it seemed to crash there but work properly under NT. I fixed the bug, redownload using same link.
|
|
|
|
May 2 2003, 13:55
Post
#12
|
|
![]() ReplayGain developer Group: Developer Posts: 4589 Joined: 5-November 01 From: Yorkshire, UK Member No.: 409 |
Thanks Case - that works now.
But now I see that it concatenates - I want to add! Cheers, David. |
|
|
|
May 2 2003, 13:57
Post
#13
|
|
|
Group: Developer (Donating) Posts: 2041 Joined: 19-October 01 From: Finland Member No.: 322 |
Sorry about that, I didn't read the whole thread, the crash caught my attention. I made Wavmix the other day, if your files have 44 byte headers it should work.
|
|
|
|
May 2 2003, 14:30
Post
#14
|
|
![]() ReplayGain developer Group: Developer Posts: 4589 Joined: 5-November 01 From: Yorkshire, UK Member No.: 409 |
QUOTE (Case @ May 2 2003 - 12:57 PM) I made Wavmix the other day, if your files have 44 byte headers it should work. Perfect!!!! If no problems crop up, that's what I'll use - it's exactly what I'm looking for. Thanks Case. Are there any known "issues" with this? Cheers, David. |
|
|
|
May 2 2003, 14:39
Post
#15
|
|
|
Group: Developer (Donating) Posts: 2041 Joined: 19-October 01 From: Finland Member No.: 322 |
QUOTE (2Bdecided @ May 2 2003 - 04:30 PM) Thanks Case. Are there any known "issues" with this? You're welcome It will work fine on most common wavs with 44 byte header, if you extract files from CDs or use Cool Edit to write wavs there won't be issues. Foobar and dBPowerAMP both write 2 bytes longer headers which will not be handled correctly and mixed wav will have two wrong bytes in its header. I have been too lazy to improve it. |
|
|
|
May 2 2003, 15:00
Post
#16
|
|
![]() ReplayGain developer Group: Developer Posts: 4589 Joined: 5-November 01 From: Yorkshire, UK Member No.: 409 |
That'll be fine for my purpose. Thanks for replying.
|
|
|
|
May 2 2003, 15:11
Post
#17
|
|
|
Group: Members Posts: 159 Joined: 30-September 01 Member No.: 75 |
Looks like your 'files' folder has many little goodies to discover, Case! Did you ever describe them somewhere or are they just waiting to be discovered?
Wavmix even can do inverse mixing, something I couldn't figured out with SoXmix. Edit: David I'd be curious how that filesize reduction will end up with your method. Also wonder how you prevent people accidentaly (or purposely) playing the artefact files and start judging on that... This post has been edited by HansHeijden: May 2 2003, 16:07 |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 24th May 2013 - 14:50 |