Re: Naming midi files

2022-02-17 Thread Mark Probert


Thank you, everyone, especially to David for the study code. All this 
info is greatly appreciated!

 .. mark. 



Re: Naming midi files

2022-02-17 Thread David Wright
On Thu 17 Feb 2022 at 21:43:09 (+1100), Mark Probert wrote:
> [ ] wrote:
> >> It’s not that simple, since in the example all the scores are in the 
> >> same book.
> > 
> > It is that simple.
> > Put the score in one book and the midis separate books and done.
> > 
> My understanding is a \midi{} block is contained within a \score{} 
> block.
> 
> The structure I have is
> 
> \book foo
>  \bookpart bar
>   \score
>\midi => foo.mid
>  \bookpart baz
>   \score
>\midi => foo-1.mid
> 
> How do I separate the \midi from the \score putting the score into a 
> \book and the \midi into separate books?

To some extent, it depends what you're using the midis for.
My two uses are proof-reading by ear, and teach-tapes.

I always set the score and midis separately, placing all the
notes into variables. Thus:

\header { …
miditempo = { …
\paper { …
global = { …
soprano = \relative { …
alto = \relative { …
tenor = \relative { …
bass = \relative { …
\include "Midi-satb.ily" % midis made here
sopranotext = \lyricmode { …
altotext = \lyricmode { …
tenortext = \lyricmode { …
basstext = \lyricmode { …
\score { % typesettng here
  \new ChoirStaff <<
\new Staff <<
  \clef treble \global
  \new Voice { \soprano }
  \addlyrics { \sopranotext }
>>
 …
  >>
  \layout { }
}

I've attached Midi-sab.ily (as it's smaller), and I have versions
for any arrangement I've set, from "cs" (click and single voice)
to "satbsatbp" (skeleton piano accompaniment). They call in turn
trivial files like:

Midi-hi-soprano.ily:
\new Staff { \midihighlight { \soprano } }

Midi-back-alto.ily:
\new Staff { \midibacking { \alto } }

and the definitions are in Midi-bits.ily (attached).

In a multi-section work, the midi filenames don't collate well,
so my lilypond shell script calls _Midirename_ to read through
the run's log file and renumber all the midi files for each
section with a 2-digit sequence number (bash function).

Typical teach-tape for one voice of an opening section attached.

Cheers,
David.
\version "2.19.49" % 2017-12-21

\book {
  \bookOutputSuffix "tutti__"
  \score {
\unfoldRepeats
<<
  \global
  \include "Midi-hi-soprano.ily"
  \include "Midi-hi-alto.ily"
  \include "Midi-hi-bass.ily"
>>
\midi {
  \miditempo
}
  }
}

\book {
  \bookOutputSuffix "soprano_"
  \score {
\unfoldRepeats
<<
  \global
  \include "Midi-hi-soprano.ily"
  \include "Midi-back-alto.ily"
  \include "Midi-back-bass.ily"
>>
\midi {
  \midinodyn
  \miditempo
}
  }
}

\book {
  \bookOutputSuffix "alto_"
  \score {
\unfoldRepeats
<<
  \global
  \include "Midi-back-soprano.ily"
  \include "Midi-hi-alto.ily"
  \include "Midi-back-bass.ily"
>>
\midi {
  \midinodyn
  \miditempo
}
  }
}

\book {
  \bookOutputSuffix "bass_"
  \score {
\unfoldRepeats
<<
  \global
  \include "Midi-back-soprano.ily"
  \include "Midi-back-alto.ily"
  \include "Midi-hi-bass.ily"
>>
\midi {
  \midinodyn
  \miditempo
}
  }
}
\version "2.19.49" % 2018-12-23

miditempo = "" % default in case it's missing

miditutti = {
  \set Staff.midiInstrument = #"oboe"
  \set Staff.midiMinimumVolume = #0.0
  \set Staff.midiMaximumVolume = #1.0
} % with dynamics

midihighlight = {
  \set Staff.midiInstrument = #"clarinet"
  \set Staff.midiInstrument = #"oboe"
  \set Staff.midiMinimumVolume = #0.9
  \set Staff.midiMaximumVolume = #1.0
  \set Staff.midiPanPosition = #LEFT
}

midibacking = {
  \set Staff.midiInstrument = #"bassoon"
  \set Staff.midiMinimumVolume = #0.2
  \set Staff.midiMaximumVolume = #0.4
  \set Staff.midiPanPosition = #RIGHT
}

midiclick = {
  \set Staff.midiInstrument = #"woodblock"
  \set Staff.midiMinimumVolume = #1.0
  \set Staff.midiMaximumVolume = #1.0
  \set Staff.midiPanPosition = #RIGHT
}

midiaccomp = {
  \set Staff.midiInstrument = #"acoustic grand"
  \set Staff.midiMinimumVolume = #1.0
  \set Staff.midiMaximumVolume = #1.0
  \set Staff.midiPanPosition = #RIGHT
}

midinodyn = \midi {
  \context {
\Staff
\remove Dynamic_performer
  }
}
function _Midirename_ {
[ -z "$1" ] && printf '%s\n' "Usage:${FUNCNAME[0]} 
file-of-midi-filenames
for internal use only, it renames the midi files generated by lilypond
whose names are in the file, making them all sort in the correct order.
The first midi generated in each score should contain __, which 
increments
the sequence number, starting at 00. The score's other midis get that 
number.
Note that the Perl rename command (file-rename) must be available." >&2 
&& return 1
[ ! -r "$1" ] && printf '%s\n' "$1 not found!" >&2 && return 1
[ ! -r /usr/bin/file-rename ] && printf '%s\n' "Perl's rename command 
(file-rename) not found!" >&2 && return 1
local Unique="$(mktemp "${Uniquetrash:-/tmp}"/"${FUNCNAME[0]}"-"$(date 
+%s)"-)"
grep -e '^MIDI output to `' "$1" | sed -e 

Re: Naming midi files

2022-02-17 Thread Lukas-Fabian Moser

Folks,

Am 17.02.22 um 11:48 schrieb Xavier Scheuer:

> If I have a book that is structured something like below, then LP
> produces two midi files: foo.midi and foo-1.midi.
>
> Is there a way I can coerce the names into "bar.midi" and "baz.midi"
> within LP? Or is this something best down externally?

Works for books (bookOutputName), not for bookpart or score.

There is a feature request to implement it (and some people offered 
$100 and 30€ bounty for this enhancement).

https://gitlab.com/lilypond/lilypond/-/issues/3154


Ian Hulin started working on that issue, but it seems there's sad news 
that never actually reached the LilyPond community (at least I couldn't 
find a mention on either -user or -devel):


https://www.justgiving.com/remember/174876/Ian-Hulin

I didn't know him personally, but judging from 
https://github.com/ian-hulin, it seems that page is for the same Ian 
Hulin who contributed to LilyPond. His last messages on -devel are from 
October 2014.


Lukas




Re: Naming midi files

2022-02-17 Thread Leo Correia de Verdier
You would have to structure your files and variables differently, for instance 
something like (in pseudocode):

— foo.ly
\include "bar.ily"
\include ”baz.ily”

\book {
  \bookpart {
\header {
  title = "Bar One"
}
\score {
  \barMusic
  \layout{}
} 
  }
  \bookpart {
\header {
  title = "BaZ"
}
\score {
  \bazMusic
  \layout{}
}
  }
}

\book {
  \bookOutputName "bar"
  \score {
\barMusic
\midi {}
  }
}

\book {
  \bookOutputName "baz"
  \score {
\bazMusic
\midi {}
  }
}

— bar.ily
barMusic = %music
— baz.ily
bazMusic = %music



> 17 feb. 2022 kl. 11:43 skrev Mark Probert :
> 
> You wrote:
>>> It’s not that simple, since in the example all the scores are in the 
>>> same book.
>> 
>> It is that simple.
>> Put the score in one book and the midis separate books and done.
>> 
> My understanding is a \midi{} block is contained within a \score{} 
> block.
> 
> The structure I have is
> 
> \book foo
> \bookpart bar
>  \score
>   \midi => foo.mid
> \bookpart baz
>  \score
>   \midi => foo-1.mid
> 
> How do I separate the \midi from the \score putting the score into a 
> \book and the \midi into separate books?
> 
> Thanks,
> ..m.




Re: Naming midi files

2022-02-17 Thread Xavier Scheuer
On Thu, 17 Feb 2022 at 09:37, Mark Probert  wrote:
>
>
> Hi.
>
> If I have a book that is structured something like below, then LP
> produces two midi files: foo.midi and foo-1.midi.
>
> Is there a way I can coerce the names into "bar.midi" and "baz.midi"
> within LP? Or is this something best down externally?

Hello,

Works for books (bookOutputName), not for bookpart or score.

There is a feature request to implement it (and some people offered $100
and 30€ bounty for this enhancement).
https://gitlab.com/lilypond/lilypond/-/issues/3154

Cheers,
Xavier

-- 
Xavier Scheuer 


Re: Naming midi files

2022-02-17 Thread Mark Probert
You wrote:
>> It’s not that simple, since in the example all the scores are in the 
>> same book.
> 
> It is that simple.
> Put the score in one book and the midis separate books and done.
> 
My understanding is a \midi{} block is contained within a \score{} 
block.

The structure I have is

\book foo
 \bookpart bar
  \score
   \midi => foo.mid
 \bookpart baz
  \score
   \midi => foo-1.mid

How do I separate the \midi from the \score putting the score into a 
\book and the \midi into separate books?

Thanks,
 ..m.

Re: Naming midi files

2022-02-17 Thread Leo Correia de Verdier
It’s not that simple, since in the example all the scores are in the same book.

> 17 feb. 2022 kl. 09:58 skrev Michael Gerdau :
> 
>> If I have a book that is structured something like below, then LP
>> produces two midi files: foo.midi and foo-1.midi.
>> Is there a way I can coerce the names into "bar.midi" and "baz.midi"
>> within LP? Or is this something best down externally?
> [example code snipped]
> 
> RTFM: 
> https://lilypond.org/doc/v2.22/Documentation/notation-big-page#output-file-names
> 
> \bookOutputSuffix
> and
> \bookOutputName
> 
> are your friends.
> 
> HTH,
> Michael
> -- 
> Michael Gerdau   email: m...@qata.de
> GPG-keys available on request or at public keyserver
> 




Re: Naming midi files

2022-02-17 Thread Michael Gerdau

It’s not that simple, since in the example all the scores are in the same book.


It is that simple.
Put the score in one book and the midis separate books and done.
Or that is how I understand the manual.

Kind regards,
Michael
--
 Michael Gerdau   email: m...@qata.de
 GPG-keys available on request or at public keyserver



Re: Naming midi files

2022-02-17 Thread Michael Gerdau

If I have a book that is structured something like below, then LP
produces two midi files: foo.midi and foo-1.midi.

Is there a way I can coerce the names into "bar.midi" and "baz.midi"
within LP? Or is this something best down externally?

[example code snipped]

RTFM: 
https://lilypond.org/doc/v2.22/Documentation/notation-big-page#output-file-names


\bookOutputSuffix
and
\bookOutputName

are your friends.

HTH,
Michael
--
 Michael Gerdau   email: m...@qata.de
 GPG-keys available on request or at public keyserver



Naming midi files

2022-02-17 Thread Mark Probert


Hi.

If I have a book that is structured something like below, then LP 
produces two midi files: foo.midi and foo-1.midi. 

Is there a way I can coerce the names into "bar.midi" and "baz.midi" 
within LP? Or is this something best down externally?

Thanks again

 ..mark.

-- foo.ly
\include "bar.ily"
\include "baz.ily"
--
-- bar.ily
\bookpart {
  \header {
title = "Bar One"
  }
  \score {
% music
\layout{}
\midi{}
  }
}
--
-- baz.ily
\bookpart {
  \header {
title = "BaZ"
  }
  \score {
% music
\layout{}
\midi{}
  }
}
--