Merging audio externally

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Merging audio externally

Post by bidgeeman » Sat Jun 06, 2009 3:25 am

Currently I have an example stack that bernd kindly did for me that loads two audio files into 2 player objects, then merges them into 1 wav file via QT External export.

I have a list of 20 different audio loops that a user can select via a checkbox, then the files are combined into 1 wav file in the order of selection.

My problem is, I have found that having 20 player objects in the stack to store each audio loop individually really makes the "exe" sluggish on start up but I would eventually like to have up to 100 loops. I'm afraid to put so may player objects into the stack as it would make the exe almost impossible to load.

so, is there a way to select the audio files via checkbox first, THEN have them loaded and merged using I player objec? Can the operation be done externally from a library or do the audio files need to be imported into the their own player first?

Thanks for any help
Bidge

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Sat Jun 06, 2009 8:02 am

Could someone please tell me if something like this could be a possible solution to stringiing 2 wav files together from an external library?

on MouseUp
put "C:\test.wav" into mc
qtInitializeEditing mc
qtSelectAll mc
qtCopy mc
set the currenttime of player "player1" to the duration of player "player1"
qtAddMovieSegment mc, false
put "C:\test2.wav" into mc
qtInitializeEditing mc
qtSelectAll mc
qtCopy mc
set the currenttime of player "player1" to the duration of player "player1"
qtAddMovieSegment mc, false

qtExport mc, 0, tPathAndName, "wav", "myStoredSettings"
end MouseUp

I can't get this to work. :(

Cheers
Bidge

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Sat Jun 06, 2009 10:43 am

Hi Bidge,

you can do it with 2 player objects. One is the receiving object that you append via copy paste to. The other is the one that holds the audio file that you want to append. In the example I send you that is player "player2".

You would set up a repeat loop to load a file into player2 and every time you copy the content from player2 to the end of player1.

You can easily do this from a list of files in a repeat loop.

Watch out: in the code you posted you pass a filename to the external. That does not work.
The external expects a reference to a player object like in the example:

Code: Select all

-- pass the controllerID to the external
   put moviecontrollerid of player "player1" into mc
If you want more than 1 audio appeded load new audio into player 2 and repeat the appending by setting first the filename of player 2 to another file. Than basically as in the eport button.
regards
Bernd

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Sat Jun 06, 2009 11:06 am

Thanks bernd...I think I understand. I am still learning but will try it out and if I run into a problem I will yell for help!

Cheers
Bidge

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Sat Jun 06, 2009 1:09 pm

Bidge,

I uploaded a stack that shows how to choose a folder that conatains .wav files and it displays those files in a field. Then you can select files from that field and it gives you the full path and name of the selected audio files.
The stack is "ChooseAudioFiles"
You could use this for your repeat loop to append wav files. Just load player2 after copying from player2 with the next file (set the fiilename of player "player2" etc)
regards
Bernd

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Sat Jun 06, 2009 1:35 pm

Hi bernd.

I really appreciate you spending the time on that stack bernd.
Here I have uploaded a small stack of exactly what I am trying to achieve with all this.

http://www.errolgray.com.au/CheckboxWav ... ombine.rev

It's a non working stack but shows what I am trying to achieve.

The biggest problem for me is getting the audio loaded into a player in the order that the Checkbox's are selected, ie, if I select Track 5 then Track 1 the audio loads into the player in that order from a library.

I have managed to create a stack that works this way but it uses a .bat file shell operation to merge the files. Now I am trying to get the same results but Using QT External and wav files rather than mp3 files.

Many thanks
Bidge

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Sat Jun 06, 2009 1:46 pm

bidge

I can not download the stack??

just gibberish/the header of the stack

regards
Bernd

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Sat Jun 06, 2009 2:03 pm

Sorry bernd. :(

I have zipped it up. Maybe that will work.

http://www.errolgray.com.au/Checkboxaudio.zip

Please let me know if that does'nt work.

Cheers
Bidge

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Sat Jun 06, 2009 2:40 pm

bidge
I got it now. Looking into it.
regards
Bernd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Sat Jun 06, 2009 4:10 pm

bidge,
I uploaded a stack to RevOnline "combine audio" that should do what you want.
regards
Bernd

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Sun Jun 07, 2009 12:55 am

Hello bernd. That stack is fantastic! Thank you so much. The only adjustment I cannot figure out how to make is to have the tracks combine in the order of selection....lets say checkbox 5 is selected before checkbox 1... then the order they would be combineded would be Track5 then Track1. This has been the problem I can't figure out how to do.

In the old one I made , when Track 5 is selected, a library is entered into a hidden text field. Each checkbox has this code:

Code: Select all

on mouseUp
   if the hilite of me then
   put label of me after fld "mp3"
   else
      put empty into fld "mp3"
      end if
end mouseUp
This way a list is built no matter what order the user selects the checkbox tracks.

I can't figure ot how to implement this with QT? I thought possibly have a field that takes the pathname of the Track and adds it dynamically to the player object?

Cheers
Bidge

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Sun Jun 07, 2009 11:55 am

Hi Bidge,

from reading this thread it sounds like your task could be done
with the help of my little SMIL library, "mk_libSMIL1":
http://www.major-k.de/xtalke.html

It lets you create a QT playlist of two or more sounds, that you
can load into a player and then export it as one file.


Best

Klaus

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Sun Jun 07, 2009 12:21 pm

bidge,

I uploaded a revised version of the combine audio stack. I keeps track of the sequence of events an combines the audio files in the order the user clicked them
Combine Audio, revOnline 3.5

@Klaus, I will check that out.

regards
Bernd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Sun Jun 07, 2009 12:26 pm

Klaus,

that is cool, I never even tried smil files. I have to look at that in detail. Thanks for the library.

regards
Bernd

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Sun Jun 07, 2009 12:29 pm

berd.....WOW! That is exactly the thing mate!!! How did you get it to track the checkbox sequences?

And also thanks Klaus for the other stack. I had to look up what a smil file was :)

Many, many thanks to you both.
Bidge.

Post Reply