Solved

Concatenating .wav files from the command

Posted on 1997-09-01
9
414 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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
 

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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

617 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