Solved

Concatenating .wav files from the command

Posted on 1997-09-01
9
412 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel Use VBA to get user's Mac Address for their computer 5 340
lucky13 challenge 11 158
wait notify demo infinite loop 3 137
NotAlone Challenge 20 88
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

726 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