binary files
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
binary files
Hi all.
Just joined the forum, and still working with the demo version of Studio. I’ve encountered a problem with sound files.
What I am trying to do is build a sound file by adding the contents of other .wav files one at a time. I’ve tried appending to the first file, using the traditional method and also the URL method. I’ve also tried reading both files into containers, adding one to the other and then writing it out to file. Neither of these methods work. The added sound data does not play.
And yet, when I look at the file size after the appending operation, the first file size has doubled, suggesting the new data is in there somewhere. When I open the .wav file with a sound editor, only the first file’s data is there.
Is it impossible to combine sound files in this way?
tia
rob
Just joined the forum, and still working with the demo version of Studio. I’ve encountered a problem with sound files.
What I am trying to do is build a sound file by adding the contents of other .wav files one at a time. I’ve tried appending to the first file, using the traditional method and also the URL method. I’ve also tried reading both files into containers, adding one to the other and then writing it out to file. Neither of these methods work. The added sound data does not play.
And yet, when I look at the file size after the appending operation, the first file size has doubled, suggesting the new data is in there somewhere. When I open the .wav file with a sound editor, only the first file’s data is there.
Is it impossible to combine sound files in this way?
tia
rob
2nd edit: I'm thinking you might not be able to just cat them together and have it work. I'm stubborn, so tried it a different way using cat file1.wav file2.wav > out.wav at the prompt.
Same results, first plays, 2nd doesn't. My guess is somewhere in the first file it tells it stuff pertaining to the size and shape of file 1, a player grabs the file, reads that info and stops when its supposed to.
I think you'll need more info on the format of wave files, or maybe call an external program that can do it for you. If you want more info on the file format you can look here. http://www.lightlink.com/tjweber/StripWav/WAVE.html
Its over my head i'm afraid.
edit: Been trying to do this now too, and I haven't a clue. Hopefully there will be a better answer soon.
Are you concatenating the files, one after another, or trying to layer them into each other?
If its the first, is it possible that the eof from the first file is still there, and the 2nd file is tacked on after it? If thats the case, anytime you mess with the file when the program hits the eof it'll quit and not see the next part.
Just a guess. If this is whats happening, you should be able remove the last char, put the next file in, and have it work.
Mind posting your code for the merge portion?
Same results, first plays, 2nd doesn't. My guess is somewhere in the first file it tells it stuff pertaining to the size and shape of file 1, a player grabs the file, reads that info and stops when its supposed to.
I think you'll need more info on the format of wave files, or maybe call an external program that can do it for you. If you want more info on the file format you can look here. http://www.lightlink.com/tjweber/StripWav/WAVE.html
Its over my head i'm afraid.
edit: Been trying to do this now too, and I haven't a clue. Hopefully there will be a better answer soon.
Are you concatenating the files, one after another, or trying to layer them into each other?
If its the first, is it possible that the eof from the first file is still there, and the 2nd file is tacked on after it? If thats the case, anytime you mess with the file when the program hits the eof it'll quit and not see the next part.
Just a guess. If this is whats happening, you should be able remove the last char, put the next file in, and have it work.
Mind posting your code for the merge portion?
Rob,
I think the easiest way to do this is to use Trevor Devore's enhancedQT external. It allows you to do a lot of stuff under script control that Quicktime can.
http://www.bluemangolearning.com/develo ... cedqt.html
Since it is so powerful it has a lot of commands and it takes a little learning, but there are example stacks to learn from. I tried your appending of wav files in the example video audio mixer by just importing 2 wav files and it does what you want. You have to adapt the script a little but basically it works. Of course you will need Quicktime installed on your Computer.
Going the binary way is a lot of work I suppose and unless you want to do some very special thing not necessary.
I dont know of any way Rev can do this natively.
Klaus, who is on this forum once in a while knows enhancedQT very well. May be he will chime in.
regards
Bernd
I think the easiest way to do this is to use Trevor Devore's enhancedQT external. It allows you to do a lot of stuff under script control that Quicktime can.
http://www.bluemangolearning.com/develo ... cedqt.html
Since it is so powerful it has a lot of commands and it takes a little learning, but there are example stacks to learn from. I tried your appending of wav files in the example video audio mixer by just importing 2 wav files and it does what you want. You have to adapt the script a little but basically it works. Of course you will need Quicktime installed on your Computer.
Going the binary way is a lot of work I suppose and unless you want to do some very special thing not necessary.
I dont know of any way Rev can do this natively.
Klaus, who is on this forum once in a while knows enhancedQT very well. May be he will chime in.
regards
Bernd
Hi Rob and all,
someone called my name? Here I am
Binary stuff is still a mistery to me, but I know that simply appending data
to an existing (sound) file will not work if you do not modify the header(s) of that file.
And yes Trevors WONDERFUL enhanced QT External is capable of adding segments
to existing sound and/or video files!
This frees one from having to dive deeper into abstract and boring file
speciafications like the one in strugis' link
Check the docs of the external:
http://www.mangomultimedia.com/develope ... mentation/
Especially the chapter about "Editing" and look for "qtCopy" and "qtAddMovieSegment"
and all entries actually...
I'm sure this will do what you wnat, BUT requires QT to be installed, at least on the
dev machine.
Best and happy eastern from germany
Klaus
someone called my name? Here I am

Binary stuff is still a mistery to me, but I know that simply appending data
to an existing (sound) file will not work if you do not modify the header(s) of that file.
And yes Trevors WONDERFUL enhanced QT External is capable of adding segments
to existing sound and/or video files!
This frees one from having to dive deeper into abstract and boring file
speciafications like the one in strugis' link

Check the docs of the external:
http://www.mangomultimedia.com/develope ... mentation/
Especially the chapter about "Editing" and look for "qtCopy" and "qtAddMovieSegment"
and all entries actually...
I'm sure this will do what you wnat, BUT requires QT to be installed, at least on the
dev machine.
Best and happy eastern from germany
Klaus
Klaus,
that was fast. So it is not once in a while, apparently more often. Greetings and thanks for looking at this because I am not that familiar with the external.
Rob,
the example stack I indicated to you "video_audio_mixer" is a little 'messed up'. I sets a menu for no apparent reason and in the scripts the reference to the players are mixed up to: It refers to player 1, player 2 etc, when it shoud refer to player "player1" etc. That is a little confusiing.
If you want to use it I changed the script of button "export new movie" to
in the buttons "open movie" and "open sound" replace every reference to 'player 1' or 2 with 'player "player1"' or 'player "player2"'
This lets you import the first sound wav file via the button "open movie" and the second wav file vial button "open sound"
then you press the "export new movie" button and after the dialog box (make sure to choose wav as format) you will have a new wav file with the two files combined. With a little additional scripting you can append more than one file.
regards
bernd
that was fast. So it is not once in a while, apparently more often. Greetings and thanks for looking at this because I am not that familiar with the external.
Rob,
the example stack I indicated to you "video_audio_mixer" is a little 'messed up'. I sets a menu for no apparent reason and in the scripts the reference to the players are mixed up to: It refers to player 1, player 2 etc, when it shoud refer to player "player1" etc. That is a little confusiing.
If you want to use it I changed the script of button "export new movie" to
Code: Select all
on MouseUp
-- pass the controllerID to the external
put moviecontrollerid of player "player2" into mc
qtInitializeEditing mc
-- selecting the whole track
qtSelectAll mc
-- copy the track to the clipboard
qtCopy mc
-- pass the controllerID to the external
put moviecontrollerid of player "player1" into mc
-- make shure the insertion point (=currentTime) is at the end of the player (the duration)
-- so that the qtAddMovieSegment gets added at the end
set the currenttime of player "player1" to the duration of player "player1"
qtInitializeEditing mc
-- now the clipboard is added to the track of player "player1"
qtAddMovieSegment mc, false
-- set the sound to begin of sound
set the currenttime of player "player1" to 0
-- here you get the dialog of Quicktime that lets you determine the file format wav or aiff or whatever
-- be shure to set it to wav if that is what you want
qtExport mc
end MouseUp
This lets you import the first sound wav file via the button "open movie" and the second wav file vial button "open sound"
then you press the "export new movie" button and after the dialog box (make sure to choose wav as format) you will have a new wav file with the two files combined. With a little additional scripting you can append more than one file.
regards
bernd
binary files
Wow!
Thanks for all the replies and help! Looks like I've got a bit of digging around to do. There will be no problem about having QT available, so maybe it is doable. Since the users won't actually be doing anything with the composite sound except listening to themselves a few times, maybe I could just concatenate references to the component files and just play them one after the other. Might sound a bit cheesy. I'll check it out, along with the advice.
Thanks a lot. These forums are a great learning tool.
Rob
Thanks for all the replies and help! Looks like I've got a bit of digging around to do. There will be no problem about having QT available, so maybe it is doable. Since the users won't actually be doing anything with the composite sound except listening to themselves a few times, maybe I could just concatenate references to the component files and just play them one after the other. Might sound a bit cheesy. I'll check it out, along with the advice.
Thanks a lot. These forums are a great learning tool.
Rob