Concatenating .wav files from the command

Greetings Gurus,

My objective is to *automatically* concatenate two .wav files together.

I know it's simplistic to say: cat file2.wav >> file1.wav, and I know software exists that can append one wav file to another with some manual cutting and pasting, but I'm looking for software that would allow me to *automatically* perform a concatenation of two wav files from a UNIX command line. (Actually, I'd prefer to invoke the concatenate command from a batch process set up behind a cron job.)

Does software exist for UNIX that would allow me to concatenate wav files together from the command line?  Remember, in my case, humans cannot perform the concatenation. The process has to be *completely* automated.  

---begin example---

file1.wav is a recorded message that says "This is a test"
file2.wav is a recorded message that says "of the emergency Broadcast System."

Via a batch process-- invoked by cron-- I want to automatically concatenate file2.wav to file1.wav and have the resulting concatenated .wav file say:  "This is a test of the emergency Broadcast system."

---end example---

I hope this task is  possible...Thanks for your expertise, and please email me for clarification or if you need me to expound on any issues.

Thanks.

Christian Brennan
xtian@attmail.com
christianxAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
Could you just play them in succession?
Or concatenate them once and have cron just take the concatenated file?
(doing `cat file2.wav >> file1.wav` from cron may leave you with
a pretty big file after a few days:-)

Otherwise, what sound file manipulation utilities do you have on your system?
Any of them which converts wave to raw might be used to create
concateateable files.

Or if you have no such utilities handy, I may be able to cobble together a simple Perl prog to strip headers then reconstruct them..
0
christianxAuthor Commented:
Ozo:

I converted my .wav files into .raw files using GoldWave for Windows95.  The original .wav files were crystal clear, and the converted .raw files sounded good as well.  I put my .raw files on my UNIX box.  Now, when I typed:
cat file2.raw >> file1.raw

the concatenation _did work_!!!  BUT, the sound quality after the concatenation was very, very scratchy and faint, and sounded like Thomas Edison's original Recording Machine. ;-)

You mentioned an interesting PERL script that would strip off headers in sound files.  Would this approach gaurantee the resulting concatenated file will be just as good in terms of sound quality as the seperate files before concatenation?

Thanks.
Christian.




0
christianxAuthor Commented:
Ozo:

I converted my .wav files into .raw files using GoldWave for Windows95.  The original .wav files were crystal clear, and the converted .raw files sounded good as well.  I put my .raw files on my UNIX box.  Now, when I typed:
cat file2.raw >> file1.raw

the concatenation _did work_!!!  BUT, the sound quality after the concatenation was very, very scratchy and faint, and sounded like Thomas Edison's original Recording Machine. ;-)

You mentioned an interesting PERL script that would strip off headers in sound files.  Would this approach gaurantee the resulting concatenated file will be just as good in terms of sound quality as the seperate files before concatenation?

Thanks.
Christian.




0
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

ozoCommented:
So you have two raw sound files, each of which sounds good when played,
but which sound scratchy and faint when concatenated?
(You also seem to be saying they were moved to a different machine,
do the same symptoms apply on both machines?)

Did both original .wav files have the same format?
sampleing rate, number of channels, bits per sample, big/little endian, signed/unsigned?
And were the raw files played back with the right sample rate etc.?
Does it make any difference if the concatenated raw is converted back a .wav files?
Can you convert the individual raw files back into .wav files?
Does one half of the concatenated raw file sound worse than the other?
Is there an audible discontinuity where they join?
(perhaps your audio player turned down the gain because it
noticed big jump in the middle?)

A Perl script could probably be written to compensate for most
of these problems, if we could determine what the problem was.

Is there a reason why
play file1.wav
play file2.wav
does not do what you want?

0
christianxAuthor Commented:
SUCCESS!!!

Please forget those last few problems I was having...
Everything works, I've got my batch process, and the gig is 100% automated!!!!
 
Thanks for your help.  You get an A++ :)


0
ozoCommented:
Congratulations!
So, which was the answer that worked, so I can submit it
as an official answer?
(I'm still a little worried that the batch file you described
might result in a continuously growing file1:-)
 

0
christianxAuthor Commented:
I made the mistake of saving file1.raw in an "unsigned" manner, and then saved file2.raw in a "signed" manner.  I also had
the playback rate messed up.  

In my batch process, I archive the concatenated and growing files on DAT when I'm through with them (because you're right... they will become *huge* after awhile.) Fortunately, storage space on my Production Box is not an issue, however.

Just by informing me of the .raw file contatenation ability, you were able to send me in the right direction...

Thanks Again Ozo!!!

Christian.

0
ozoCommented:
What sound file manipulation utilities do you have on your system?
Any of them which converts wave to raw might be used to create
concateateable files.
(if they can be converted in the same format/sample rate)

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
christianxAuthor Commented:
The experts-exchange premise is interesting... My experience has been positive.  I'll be back to use the site again.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.