Solved

Concatenating .wav files from the command

Posted on 1997-09-01
9
403 Views
Last Modified: 2013-12-26
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
0
Comment
Question by:christianx
  • 5
  • 4
9 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1294625
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
 

Author Comment

by:christianx
ID: 1294626
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
 

Author Comment

by:christianx
ID: 1294627
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
 
LVL 84

Expert Comment

by:ozo
ID: 1294628
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:christianx
ID: 1294629
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
 
LVL 84

Expert Comment

by:ozo
ID: 1294630
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
 

Author Comment

by:christianx
ID: 1294631
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
 
LVL 84

Accepted Solution

by:
ozo earned 100 total points
ID: 1294632
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
 

Author Comment

by:christianx
ID: 1294633
The experts-exchange premise is interesting... My experience has been positive.  I'll be back to use the site again.

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now