Running bash script from Processing
in
Integration and Hardware
•
2 years ago
Hi all, I'm looking to run a very simple bash script from Processing - in this case to combine mp3s, fix their header data, and save. I have it working with no issue from Terminal but can't get it to work in Processing.
I've tried some of the options (the open() help file and http://processing.org/discourse/yabb2/YaBB.pl?num=1239227478) but while I don't get errors, nothing happens either.
My Processing code (currently doesn't do anything except attempt to run the script):
And my script, if it's of any use. It requires two external libraries: mp3cat ( http://tomclegg.net/mp3cat) and id3cp ( http://www.linuxfromscratch.org/blfs/view/cvs/multimedia/id3lib.html), but at least shows what's happening.
I'm not very familiar with bash scripting or running anything from the command-line, so this might be something really simple...
Thanks all!
I've tried some of the options (the open() help file and http://processing.org/discourse/yabb2/YaBB.pl?num=1239227478) but while I don't get errors, nothing happens either.
My Processing code (currently doesn't do anything except attempt to run the script):
- import java.io.*;
void setup() {
// nope, doesn't work...
open("combineMP3s.sh"); // locally stored in the sketch folder
// not this either!
String fullPath = "/Users/jeffthompson/Documents/Processing/CombineMP3_CommandLine/combineMP3s.sh";
try {
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(fullPath);
}
catch (IOException e) {
e.printStackTrace();
}
}
And my script, if it's of any use. It requires two external libraries: mp3cat ( http://tomclegg.net/mp3cat) and id3cp ( http://www.linuxfromscratch.org/blfs/view/cvs/multimedia/id3lib.html), but at least shows what's happening.
- #!/bin/bash
clear
echo "Combining files..."
cat 01.mp3 02.mp3 03.mp3 04.mp3 05.mp3 06.mp3 07.mp3 08.mp3 09.mp3 10.mp3 11.mp3 12.mp3 13.mp3 | mp3cat - - > combined.mp3
echo
echo "Updating metadata..."
id3cp 01.mp3 combined.mp3
echo "FINISHED!"
I'm not very familiar with bash scripting or running anything from the command-line, so this might be something really simple...
Thanks all!
1