Re: lilypond "preprocessor"?

2023-12-13 Thread Stefano Antonelli
On Tue, 2023-12-12 at 14:46 -0800, Stefano Antonelli wrote: > #(define (add-midi-to-score score) >(define (has-midi? score) > (any (lambda (x) (ly:output-def-lookup x 'is-midi)) > (ly:score-output-defs score))) >(if (has-midi? score) score > #{ \score { $score \midi {}

Re: lilypond "preprocessor"?

2023-12-12 Thread Mats Bengtsson
On 2023-12-12 11:26, Werner LEMBERG wrote: One thing occurred to me.  If the original \score did not have a \midi block, would it be possible to ask lilypond to produce midi output without modifying the input file?

Re: lilypond "preprocessor"?

2023-12-12 Thread Stefano Antonelli
On Tue, 2023-12-12 at 12:40 -0800, Aaron Hill wrote: > Any better? > > > #(define (add-midi-to-score score) >(define (has-midi? score) > (any (lambda (x) (ly:output-def-lookup x 'is-midi)) > (ly:score-output-defs score))) >(if (has-midi? score) score > #{ \score {

Re: lilypond "preprocessor"?

2023-12-12 Thread David Kastrup
Aaron Hill writes: > On 2023-12-12 1:04 pm, David Kastrup wrote: >> Aaron Hill writes: >>> >>> #(define (add-midi-to-score score) >>> (define (has-midi? score) >>> (any (lambda (x) (ly:output-def-lookup x 'is-midi)) >> Wouldn't that need to be (ly:output-def-lookup x 'is-midi #f) ? >

Re: lilypond "preprocessor"?

2023-12-12 Thread Aaron Hill
On 2023-12-12 1:04 pm, David Kastrup wrote: Aaron Hill writes: #(define (add-midi-to-score score) (define (has-midi? score) (any (lambda (x) (ly:output-def-lookup x 'is-midi)) Wouldn't that need to be (ly:output-def-lookup x 'is-midi #f) ? The default is to return '() which I

Re: lilypond "preprocessor"?

2023-12-12 Thread David Kastrup
Aaron Hill writes: > On 2023-12-12 12:06 pm, Stefano Antonelli wrote: >> On Tue, 2023-12-12 at 02:31 -0800, Aaron Hill wrote: >>> Would this not work? >>> >>> #(define (add-midi-to-score score) >>>#{ \score { $score \midi {} } #}) >>> toplevel-score-handler = >>> #(lambda (score) >>>

Re: lilypond "preprocessor"?

2023-12-12 Thread Aaron Hill
On 2023-12-12 12:06 pm, Stefano Antonelli wrote: On Tue, 2023-12-12 at 02:31 -0800, Aaron Hill wrote: Would this not work? #(define (add-midi-to-score score) #{ \score { $score \midi {} } #}) toplevel-score-handler = #(lambda (score) (collect-scores-for-book (add-midi-to-score

Re: lilypond "preprocessor"?

2023-12-12 Thread Stefano Antonelli
On Tue, 2023-12-12 at 02:31 -0800, Aaron Hill wrote: > Would this not work? > > > #(define (add-midi-to-score score) >#{ \score { $score \midi {} } #}) > > toplevel-score-handler = > #(lambda (score) >(collect-scores-for-book (add-midi-to-score score))) > Indeed it does!

Re: lilypond "preprocessor"?

2023-12-12 Thread Stefano Antonelli
On Tue, 2023-12-12 at 11:00 +0100, Jean Abou Samra wrote: > > cat first.ly second.ly third.ly > out.ly > > lilypond out.ly > > But it's not portable. I'd have to do the equivalent in python if > > there's no way to do it with lilypond. > > Not sure I understand the need, why do you need to

Re: lilypond "preprocessor"?

2023-12-12 Thread Aaron Hill
On 2023-12-12 2:01 am, Jean Abou Samra wrote: One thing occurred to me.  If the original \score did not have a \midi block, would it be possible to ask lilypond to produce midi output without modifying the input file? No, this is not currently possible, although it would be a nice addition.

Re: lilypond "preprocessor"?

2023-12-12 Thread Werner LEMBERG
>> One thing occurred to me.  If the original \score did not have a >> \midi block, would it be possible to ask lilypond to produce midi >> output without modifying the input file? > > No, this is not currently possible, although it would be a nice > addition. Stefano, please file an issue for

Re: lilypond "preprocessor"?

2023-12-12 Thread Jean Abou Samra
> One thing occurred to me.  If the original \score did not have a \midi > block, would it be possible to ask lilypond to produce midi output > without modifying the input file? No, this is not currently possible, although it would be a nice addition. signature.asc Description: This is a

Re: lilypond "preprocessor"?

2023-12-12 Thread Jean Abou Samra
> If I can find a way to append to the input file, I can probably get rid > of that scraping/parsing code completely.  I came across -dread-file- > list.  If I understand I would need to create a file: > > ``` > $ cat list-of-files.txt > first.ly > song.ly > last.ly > ``` > > And then > > ``` >

Re: lilypond "preprocessor"?

2023-12-11 Thread Stefano Antonelli
On Mon, 2023-12-11 at 17:22 +0100, Jean Abou Samra wrote: > ly2video or not, you need to unfold repeats as soon as you want > correct MIDI output. I agree that requiring to do it explicitly is > not very user-friendly, but auto-adding \unfoldRepeats sounds like > solving the problem at the wrong

Re: lilypond "preprocessor"?

2023-12-11 Thread Stefano Antonelli
On Mon, 2023-12-11 at 19:41 +0100, Jean Abou Samra wrote: > Put > > break = {} > pageBreak = {} > in the -dinclude-settings file? Wow. That's deceptively simple! > You can put > > #(set! toplevel-music-functions (cons unfoldRepeats toplevel-music- > functions)) > in -dinclude-settings. This

Re: lilypond "preprocessor"?

2023-12-11 Thread Jean Abou Samra
> There is a case where I want to create a narrower page for a narrower > screen.  I can easily append a /paper {} block to the original file to > do this.  However, any manual breaks will probably not work at this > newer width.  How would you recommend dealing with this? Put ``` break = {}

Re: lilypond "preprocessor"?

2023-12-11 Thread Stefano Antonelli
On Mon, 2023-12-11 at 17:22 +0100, Jean Abou Samra wrote: > > We need a copy so we can introduce the space time dumper code which > > boils down to a simple /include statement at the very top of the > > file. > > You can do that via the -dinclude-settings option instead. Good to know, thanks. >

Re: lilypond "preprocessor"?

2023-12-11 Thread Stefano Antonelli
On Mon, 2023-12-11 at 03:49 -0800, Aaron Hill wrote: > Why should ly2video need any such smarts at all? Since there are > myriad > ways an end user can structure their input files, let LilyPond do its > job and have ly2video ask it for all the information needed. It > sounds > like ly2video is

Re: lilypond "preprocessor"?

2023-12-11 Thread Jean Abou Samra
> We need a copy so we can introduce the space time dumper code which > boils down to a simple /include statement at the very top of the file. You can do that via the `-dinclude-settings` option instead. > It looks like ly2video also removes any \break, \noBreak, and > \pageBreak it finds in

Re: lilypond "preprocessor"?

2023-12-11 Thread Aaron Hill
On 2023-12-10 9:33 pm, Stefano Antonelli wrote: On Sun, 2023-12-10 at 08:46 -0500, Michael Werner wrote: I'm not at all familiar with ly2video, so I really have no idea if this'll be directly useful to you. But for getting the headers from an included file, this is how I do it with nearly all

Re: lilypond "preprocessor"?

2023-12-10 Thread Stefano Antonelli
On Sun, 2023-12-10 at 08:46 -0500, Michael Werner wrote: > And then I would have anotherFile.ly containing something like: > > \include "song.ly" > > \book { > \myHeaders > \score { > \theMusic > } > } Thanks for the suggestion Michael. I like that idea, but it doesn't help with the

Re: lilypond "preprocessor"?

2023-12-10 Thread Stefano Antonelli
On Sun, 2023-12-10 at 10:56 +0100, Jean Abou Samra wrote: > It would be better for ly2video not to modify the input file. Technically, it modifies a copy of the input file. The scraping is clunky and I don't like it though it seems necessary. The idea, I suppose, is to make it easy for the

Re: lilypond "preprocessor"?

2023-12-10 Thread Michael Werner
Hi Stef, On Sat, Dec 9, 2023 at 11:07 PM Stefano Antonelli < santone...@algosolutions.com> wrote: > Any other options for getting the header block from an included file? > I don't know if this'll be directly usable in your use case, but I do something like this with most of the music I

Re: lilypond "preprocessor"?

2023-12-10 Thread Jean Abou Samra
> I know I can run lilypond on song.ly and it will implicitly wrap it in > a \score block, but is that contained in an intermediate file somewhere > I can get access to? No, there is no such file. The implicit wrapping happens at the level of LilyPond's data structures, it's not a textual macro

lilypond "preprocessor"?

2023-12-09 Thread Stefano Antonelli
Hello list, The issue I'm facing is that I might have a song.ly that contains: \header { % author and stuff } \theMusic = new DrumStaff { % the music } ly2video can't work with this file. It needs to see a \score block so it can add unfold repeats, layout, and midi. ly2video actually

Re: Using Lilypond as a Lilypond preprocessor.

2004-12-31 Thread Ferenc Wagner
Anthony W. Youngman [EMAIL PROTECTED] writes: [...] I can convert from midi to lily, and then I'd like to be able to put a \transpose in there, convert from lily to lily, and have the resulting output in concert pitch (or octaves thereof). Check the lyqi Emacs mode:

Re: Using Lilypond as a Lilypond preprocessor.

2004-12-30 Thread Anthony W. Youngman
In message [EMAIL PROTECTED], Erik Sandberg [EMAIL PROTECTED] writes Since this intermediate file is a valid Lilypond file, an intermediate pass can perform some kind of transformation on it before passing it back to Lilypond for actual processing. Is this reasonable ? or is Lilypond's internal

Re: Using Lilypond as a Lilypond preprocessor.

2004-12-29 Thread Erik Sandberg
Citerar Darius Blasband [EMAIL PROTECTED]: Hi, I think it might be a good idea for Lilypond to provide a facility which, based on an input file, provides a normalized intermediate file which is itself a valid Lilypond file, with exactly the same semantics as the original one, but where