Back

Help! Mac script: first 10 sec of audio

#1
So I need to make a script that will be able to easily extract the first 10 seconds of audio from an audio file.
I found this on the web, after looking for "extract first 10 seconds of audio"
but it doesn't work, since it's for Ti.Media (whatever that is):

Quote:var sound = Ti.Media.createSound({
sound: file,
duration: 10
});
→ error: couldn't write the class name after this identifier.

I want to extract the first 10 seconds of classical songs, and be able to recognize the composer and title in Anki. ^^

Anyone has any knowledge about scripts?
Cheers!

-Mesqueeb
Edited: 2011-12-16, 3:39 am
Reply
#2
sox trim (seems to be in mac ports and fink)
Edited: 2011-12-16, 6:18 am
Reply
#3
Hello, I downloaded Sox and it is a certain folder. However even after I have the folder on my computer I cannot use the command.

The command I need I found here:
http://billposer.org/Linguistics/Computa...ml#extract

sox Input.wav Half1.wav trim 0 30:00
in my case:
sox Input.mp3 output.mp3 trim 0 10

However. "sox" is not recognized by Terminal. ><
Could you help me out a little bit in how to make sox active? Thanks!
Reply
May 16 - 30 : Pretty Big Deal: Save 31% on all Premium Subscriptions! - Sign up here
JapanesePod101
#4
Went into the sox folder and I got a bit closer I think.

MesqueebiatorConfusedox-14.3.2 Mesqueeb$ ./sox 1.mp3 2.mp3 trim 0 10
./sox FAIL util: Unable to load MAD decoder library (libmad).
./sox FAIL formats: can't open input file `1.mp3':


meaning I need to install MAD decoder? I'll google it and come report back in a second.

But do I really need to copy the mp3 file in the sox folder each time? =.=
Reply
#5
It's all a big hassle, I need to install mac dev tools and such...

Is there a really easy way to extract the first 10 seconds of audio?
Reply
#6
you'll want to install it using mac ports or fink
Reply
#7
But I need to install xCode, which is like 2 gb and I only have 60 gb on my Mac... >< Contstantly fighting against my limit. Truth is, I have no idea how to open up another 2gb...
><
Maybe I'll just use the mic and record the first few seconds...

Is there like a program that records desktop, and sound output? (not including sound input like mic.) If that would exist I could record 10 seconds my desktop, and afterwards convert it to mp3. ^^
Reply
#8
I use a program called Fission by Rogue Amoeba to do this. You have to pay but there's a free trial, so if you only need to do it a couple of times it will work.

Alternatively you could do it with python. If you have a mac python should be installed. You could try PyMP3Cut.
Reply
#9
I've never used a mac in my life, but, is there not a mac version of FFMPEG? Is there no package manager at all for installing stuff like that?
Reply
#10
when i did an update of a mac app called all2mp3 they asked me to install ffmpeg, and like practically did it for me! ^^
Is there a command I would be able to use now? To like easily cut the first 10 seconds of a piece of audio?
Reply
#11
try this
Code:
ffmpeg -i MyInputFile -ss 00:00:00 -t 00:00:10 MyOutputFile.mp3
That should get you the first 10 seconds of an audio file (well, any format ffmpeg supports actually)

I tested this on a random mkv file and it worked fine.
Reply
#12
bombpersons Wrote:try this
Code:
ffmpeg -i MyInputFile -ss 00:00:00 -t 00:00:10 MyOutputFile.mp3
That should get you the first 10 seconds of an audio file (well, any format ffmpeg supports actually)

I tested this on a random mkv file and it worked fine.
-bash: ffmpeg: command not found
Reply
#13
It's ok! I have found the perfect solution!
'Adapter' for mac!
You can drag a whole folder into it and batch convert to ten seconds each!
Muhahahaha!
Reply