Page 1 of 1

Do as linux

Posted: Wed Jun 13, 2012 9:04 am
by doobox
Hi there..

I am certainly no Linux man.. in fact i know 0% about the code.
But what i would like to do to improve one of my apps is, merge 2 mp3 files.

So for arguments sake, I can know where these files are at any given time and have there paths in a couple of variable's

tMp3one
tMp3Two

I found this script which i believe is Linux, and i believe it is more than i need, as it is looking for all instances of a file with a given file name.
But i think it's got the foundation of what i am looking for:

Code: Select all

for f_file in ./*F.wav; do

b_file="${f_file/F.wav/R.wav}"  #replaces "F.wav" with "R.wav" in the filename

# <put sox command here with input $f_file $b_file>

soxmix $f_file $b_file -r 44100 /media/58E5-6EB7/mp3/$b_file.mp3
done
So my main questions are:

1: Can i have an amended version of this in a field and do :

Code: Select all

do field "script" as linux
2: How would i mix my paths stored in livecode variables into the script..?
I surely cant just add them like :

Code: Select all

for f_file in tMp3One; do
3: not really a question... more a please, can a Linux man show me an example of this type of function that will in plain English:

Code: Select all

Put tMp3One into f_file
Put tMp3Two into b_file
soxmix $f_file $b_file -r 44100 /media/58E5-6EB7/mp3/newfilename.mp3 // assuming this line is merging the two mp3 files.
Kind regards
Gary

Re: Do as linux

Posted: Wed Jun 13, 2012 9:55 am
by Klaus
Hi Gary,

this is not Linux specific but a SHELL command.

Try this, supposed you already have filled three variables wiht the source file 1 tSF1, source file2 tSF2 and the target file tTF.
then you can construct the actuall shell command:
...
put shel("somix" && tSF1 && tSF2 && "-r 44100" &&tTF") into tMixResult
...


Best

Klaus

Re: Do as linux

Posted: Wed Jun 13, 2012 10:05 am
by doobox
Now that looks more familiar :-)
Thank's Klaus i will let you know how it goes...

Re: Do as linux

Posted: Wed Jun 13, 2012 10:12 am
by doobox
Ok so i did as a test:

Code: Select all

   put specialfolderpath("desktop") & "/one.mp3" into tSF1
   put specialfolderpath("desktop") & "/two.mp3" into tSF2
   put shell("somix" && tSF1 && tSF2 && "-r 44100" && tTF) into tMixResult
   put tMixResult into field "script"
Script field reads: "/bin/sh: line 1: somix: command not found"

Re: Do as linux

Posted: Wed Jun 13, 2012 10:25 am
by Klaus
Hi Gary,

well, I am also not familiar with Linux at all 8) , but it looks like:
1. the appcication SOMIX is not found in the "known" paths (/bin/sh; /bin/whatever...)
2. the application is not installed at all on your machine.

I am not sure if this is part of the default installation of Linux (whatever distro you have) at all!


Best

Klaus

Re: Do as linux

Posted: Wed Jun 13, 2012 10:35 am
by doobox
Ok Cheers..
Seems out of my depth on this one. I was hoping that the somix command was inbuilt into OSX and always accessible.

Any other ideas of a way to make two separate mp3 fies, one continuous mp3, from anyone file appreciated.
I am trying to add a pause button to one of my existing apps : http://www.garysimpson.co.uk/dictaphone/

I was hoping to just create separate files for each section of a recording (one between each pause button click)
Then merge them when the stop button was clicked.

Re: Do as linux

Posted: Wed Jun 13, 2012 10:51 am
by Klaus
Hi Gary,

ah, I see, no SOMIX is not part of OS X.
And I don't know of any other app that could do this.


Best

Klaus

Re: Do as linux

Posted: Wed Jun 13, 2012 11:04 am
by Klaus
Hi Gary,

maybe this is of use for you?
http://sox.sourceforge.net/

Example of audio MIX
sox -m movAsound.wav movBsound.wav mixed.mp3
8)

Best

Klaus

Re: Do as linux

Posted: Wed Jun 13, 2012 12:04 pm
by bn
Hi Gary, hi Klaus,

wasn't there someone on the forum who was a big advocat of Trevor Devore's Quicktime external? :)

Gary, you can combine audio files and export them with the enhanced QuickTime external:
http://www.bluemangolearning.com/revolu ... rnals/eqt/

just make two players, load your files into the players, copy the audio from the second player and paste it after the audio of the first player and then export the audio from the first player as one file. (Copy pasting all with the help of the external)
I did this with wav files but I see no reason why it should not work with mp3. Actually I combined a lot more than 2 files into one file. Always using the second player as an intermediate place to copy/paste from.

Klaus wrote a couple of examples for Trevor's external.

Kind regards
Bernd

Re: Do as linux

Posted: Wed Jun 13, 2012 12:13 pm
by Klaus
Hi Bernd,
bn wrote:wasn't there someone on the forum who was a big advocat of Trevor Devore's Quicktime external? :)
hmm, really can't remember :lol:

Yes, this is possible, but a bit cumbersome and not so straightforward if you want to script this.
Looks like SOX can do so in a one line command, so why not try this. 8)

There are also some cool command line tools on OSX (don't know which version!? At least on LION) like
Audio file tools:
afplay
afinfo
afconvert

Audio/Video tool:
avconvert

But they cannot merge two files into one...

Best

Klaus