Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Concatenating .wav files from the command

Posted on 1997-09-01
9
Medium Priority
?
417 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

715 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