question on creating an mp3

Thomas Stivers stivers_t at tomass.dyndns.org
Sun Jul 31 21:04:04 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

On Sun, Jul 31, 2005 at 07:10:41 PM -0400, Scott Howell wrote:
> This is off topic I know, but I have a question regarding how to perform 
> a certain task.

Well off topic messages are the spice of life, where would we be without
them. Besides this one is a lot more topical than most.

> I've got a directory of files, I want to take each name of a file and 
> put it into a separate mp3 file, i.e. song1.mp3 would have a file called 
> song1.talk associated with it.
> Now I will use the DECtalk software to do this. I will have say speak 
> the file name and then pipe that using a simi colon into sox to make a 
> wav or mp3 file whichever.
> In any case the problem is I'm not so sure how to feed say each file 
> name. I suspect using a loop statement (if that's the correct term) in a 
> script that would feed the file names from ls into say and on from 
> there.
> My thought was along these lines and any help appreciated. Not a Bash 
> expert.

Well here goes nothing I hope this is at least close to what you're
after.

for file in `/bin/ls *.mp3`; do
file = "${file/%.mp3/}"
	say -a "$file" -fo "${file}.tmp"
	lame "${file}.tmp" -o "${file}.talk"
	rm "${file}.tmp";
done

This is a little more complicated than you asked for, but it
removes the .mp3 from the ends of the file names and says them
using dectalk, then it uses lame to encode the result. My
version of sox could only read not write mp3's so I had to use
lame instead.

Now the next even cooler step would be to make the whole thing
recursive so it could handlke an entire tree of music all sorted
by artist and album, but I don't know if i'm up for that right
now.

HTH

- -- 
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

Thomas Stivers	e-mail: stivers_t at tomass.dyndns.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC7XUE5JK61UXLur0RA/yuAJ9CodJhtRlM+C25b0BLPG4N06yQ9gCeM4k1
GLSxQrlvaXeRa0ITJSBv1v8=
=Ly2K
-----END PGP SIGNATURE-----




More information about the Speakup mailing list