List Info

Thread: transcoding recipe request




transcoding recipe request
user name
2006-05-10 17:15:26
Hello,

I have a directory tree of sound files in .flac format and I
am trying 
to build a makefile to convert all these files to other
formats (ogg, 
alaw, mp3, etc.) in a similar, parallel directory tree. 

This is what I have:

/home/ldm/music/flac/classical/opera/author1/*.flac
/home/ldm/music/flac/jazz/author2/*.flac
/home/ldm/music/flac/rock/author2/*.flac
etc...

and this is what I'd like the makefile to auto-generate:

/home/ldm/music/alaw/classical/opera/author1/*.alaw
/home/ldm/music/alaw/jazz/author2/*.alaw
/home/ldm/music/alaw/rock/author2/*.alaw
etc...

(the directory tree has a variable depth)

Here is the rule I wrote to convert the files:

%.al: %.flac 
    flac -cds $< | sox -S -t wav - -r 8000 -c 1 $ resample
-ql
    mv $ alaw

What I need is a way of:

- recursing into the flac directory tree, 
- generate a target list from the flac files with patsubst
- another way?


Thanks in advance for your suggestions,


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
transcoding recipe request
user name
2006-05-10 20:03:52
Louis-David Mitterrand wrote:
> Hello,
> 
> I have a directory tree of sound files in .flac format
and I am trying 
> to build a makefile to convert all these files to other
formats (ogg, 
> alaw, mp3, etc.) in a similar, parallel directory tree.

> 
> This is what I have:
> 
> /home/ldm/music/flac/classical/opera/author1/*.flac
> /home/ldm/music/flac/jazz/author2/*.flac
> /home/ldm/music/flac/rock/author2/*.flac
> etc...
> 
> and this is what I'd like the makefile to
auto-generate:
> 
> /home/ldm/music/alaw/classical/opera/author1/*.alaw
> /home/ldm/music/alaw/jazz/author2/*.alaw
> /home/ldm/music/alaw/rock/author2/*.alaw
> etc...
> 
> (the directory tree has a variable depth)
> 
> Here is the rule I wrote to convert the files:
> 
> %.al: %.flac 
>     flac -cds $< | sox -S -t wav - -r 8000 -c 1
$
resample -ql
>     mv $ alaw
> 
> What I need is a way of:
> 
> - recursing into the flac directory tree, 
> - generate a target list from the flac files with
patsubst
> - another way?
> 
> Thanks in advance for your suggestions,

Off the top of my head (drawing from recent experience):

# Assumes a UNIX-type environment
$(FLACS) := $(shell find /home/ldm/music/flac -name
"*.flac" -print)

all: $(FLACS)

/home/ldm/music/alaw/%.alaw: /home/ldm/music/flac/%.flac
    flac -cds $< | sox -S -t wav - -r 8000 -c 1 $ resample
-ql

I've not tested this but it might give you a start.

                      -Dave


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
transcoding recipe request
user name
2006-05-10 20:11:58
David Greene wrote:

> $(FLACS) := $(shell find /home/ldm/music/flac -name
"*.flac" -print)
> 
> all: $(FLACS)

Oops, forgot a step:

ALAWS := $(FLAGS:.flac=.alaw)

all: $(ALAWS)

                         -Dave


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
transcoding recipe request
user name
2006-05-22 16:04:12
On Wed, May 10, 2006 at 03:03:52PM -0500, David Greene
wrote:
> > What I need is a way of:
> > 
> > - recursing into the flac directory tree, 
> > - generate a target list from the flac files with
patsubst
> > - another way?
> > 
> > Thanks in advance for your suggestions,
> 
> Off the top of my head (drawing from recent
experience):
> 
> # Assumes a UNIX-type environment
> $(FLACS) := $(shell find /home/ldm/music/flac -name
"*.flac" -print)
> 
> all: $(FLACS)
> 
> /home/ldm/music/alaw/%.alaw:
/home/ldm/music/flac/%.flac
>     flac -cds $< | sox -S -t wav - -r 8000 -c 1
$
resample -ql
> 
> I've not tested this but it might give you a start.

Thanks!

Here is the working recipe I built from your suggestions:

	FLACS := $(shell find ./flac -name "*.flac"
-print)

	ALAWS := $(patsubst ./flac/%.flac,./alaw/%.al,$(FLACS))

	all: $(ALAWS)

	./alaw/%.al: ./flac/%.flac
		[ -d $(dir $) ] || mkdir -p $(dir $)
		flac -cds $< | sox -S -t wav - -r 8000 -c 1 $ resample
-ql

Is there a way to auto-create directories as needed by
targets in the 
implicit rule? (thus avoiding the the -d test and mkdir)

Also I noticed filenames with whitespace produce errors in
the implicit 
rule. Should I apply quoting somewhere?


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )