--- Begin Message ---
I mentioned previously that I wrote a program to convert MIDI files to LilyPond 
files. That program is called MidiToLily and it’s now freely available on 
GitHub. It’s a console app, doesn’t have an installer, and doesn’t store things 
in the registry or anywhere else. It does have command line help, including a 
few examples.

https://github.com/victimofleisure/MidiToLily

Notes can be quantized to a regular grid, a triplet grid, or both grids, in 
which case the note snaps to whichever grid is nearest.
The title, composer, and copyright can be specified, with Unicode support. Clef 
overrides, sections, and ottavas are also supported.
The tempo, time signature, and key signature are read from the input MIDI file. 
I have only tested MidiToLily on type 1 MIDI files.
MidiToLily includes a verification feature which is very useful to me. It 
depends on the fact that LilyPond can output a MIDI file that corresponds to 
its engraving. MidiToLily invokes this feature in the .ly file it creates, so 
after LilyPond runs, in addition to a PDF, you’ll also have a .mid file. Run 
MidiToLily a second time, specifying the verify flag, and instead of outputting 
a LilyPond file, MidiToLily looks for a .mid file with the same name as the 
output file. It then compares that LilyPond-generated MIDI file to the original 
MIDI file. The comparison automatically accounts for certain expected 
differences, and it creates two text files: MidiToLilyIn.txt for the original 
MIDI, and LilyPondMidi.txt for LilyPond’s MIDI. If MidiToLily reports 
differences, you can investigate them by comparing these two text files, using 
a source comparison utility, such as WinMerge for example.
MidiToLily does what I need it to do, but undoubtably it could be improved. I 
make no claim that it’s useful to others, but I hope so.
Best regards,Chrishttps://www.chriskorda.com/



--- End Message ---
--- Begin Message ---
I mentioned previously that I wrote a program to convert MIDI files to LilyPond 
files. That program is called MidiToLily and it’s now freely available on 
GitHub. It’s a console app, doesn’t have an installer, and doesn’t store things 
in the registry or anywhere else. It does have command line help, including a 
few examples.

https://github.com/victimofleisure/MidiToLily

Notes can be quantized to a regular grid, a triplet grid, or both grids, in 
which case the note snaps to whichever grid is nearest.
The title, composer, and copyright can be specified, with Unicode support. Clef 
overrides, sections, and ottavas are also supported.
The tempo, time signature, and key signature are read from the input MIDI file. 
I have only tested MidiToLily on type 1 MIDI files.
MidiToLily includes a verification feature which is very useful to me. It 
depends on the fact that LilyPond can output a MIDI file that corresponds to 
its engraving. MidiToLily invokes this feature in the .ly file it creates, so 
after LilyPond runs, in addition to a PDF, you’ll also have a .mid file. Run 
MidiToLily a second time, specifying the verify flag, and instead of outputting 
a LilyPond file, MidiToLily looks for a .mid file with the same name as the 
output file. It then compares that LilyPond-generated MIDI file to the original 
MIDI file. The comparison automatically accounts for certain expected 
differences, and it creates two text files: MidiToLilyIn.txt for the original 
MIDI, and LilyPondMidi.txt for LilyPond’s MIDI. If MidiToLily reports 
differences, you can investigate them by comparing these two text files, using 
a source comparison utility, such as WinMerge for example.
MidiToLily does what I need it to do, but undoubtably it could be improved. I 
make no claim that it’s useful to others, but I hope so.
Best regards,Chrishttps://www.chriskorda.com/



--- End Message ---
--- Begin Message ---
I mentioned previously that I wrote a program to convert MIDI files to LilyPond 
files. That program is called MidiToLily and it’s now freely available on 
GitHub. It’s a console app, doesn’t have an installer, and doesn’t store things 
in the registry or anywhere else. It does have command line help, including a 
few examples.

https://github.com/victimofleisure/MidiToLily

Notes can be quantized to a regular grid, a triplet grid, or both grids, in 
which case the note snaps to whichever grid is nearest.
The title, composer, and copyright can be specified, with Unicode support. Clef 
overrides, sections, and ottavas are also supported.
The tempo, time signature, and key signature are read from the input MIDI file. 
I have only tested MidiToLily on type 1 MIDI files.
MidiToLily includes a verification feature which is very useful to me. It 
depends on the fact that LilyPond can output a MIDI file that corresponds to 
its engraving. MidiToLily invokes this feature in the .ly file it creates, so 
after LilyPond runs, in addition to a PDF, you’ll also have a .mid file. Run 
MidiToLily a second time, specifying the verify flag, and instead of outputting 
a LilyPond file, MidiToLily looks for a .mid file with the same name as the 
output file. It then compares that LilyPond-generated MIDI file to the original 
MIDI file. The comparison automatically accounts for certain expected 
differences, and it creates two text files: MidiToLilyIn.txt for the original 
MIDI, and LilyPondMidi.txt for LilyPond’s MIDI. If MidiToLily reports 
differences, you can investigate them by comparing these two text files, using 
a source comparison utility, such as WinMerge for example.
MidiToLily does what I need it to do, but undoubtably it could be improved. I 
make no claim that it’s useful to others, but I hope so.
Best regards,Chrishttps://www.chriskorda.com/



--- End Message ---
--- Begin Message ---
Hi.

I'm struggling some with writing a music function for rests.  Basically I
want to be able to write something like

 \rel-rest( b', 1)

which would place a dotted quarter rest on the indicated pitch (the
equivalent of

  b'1\rest

I'm starting with

rel-rest =
#(define-music-function (pit dur) (ly:pitch? ly:duration?)
  #{
    #pit#dur\rest
  #})

but that gives me an error.

Any suggestions?

-- 

-- 
-mark.

--- End Message ---
--- Begin Message ---
Hi.

I'm struggling some with writing a music function for rests.  Basically I
want to be able to write something like

 \rel-rest( b', 1)

which would place a dotted quarter rest on the indicated pitch (the
equivalent of

  b'1\rest

I'm starting with

rel-rest =
#(define-music-function (pit dur) (ly:pitch? ly:duration?)
  #{
    #pit#dur\rest
  #})

but that gives me an error.

Any suggestions?

-- 

-- 
-mark.

--- End Message ---
--- Begin Message ---
Hi.

I'm struggling some with writing a music function for rests.  Basically I
want to be able to write something like

 \rel-rest( b', 1)

which would place a dotted quarter rest on the indicated pitch (the
equivalent of

  b'1\rest

I'm starting with

rel-rest =
#(define-music-function (pit dur) (ly:pitch? ly:duration?)
  #{
    #pit#dur\rest
  #})

but that gives me an error.

Any suggestions?

-- 

-- 
-mark.

--- End Message ---
Sent from my iPad

> On Dec 17, 2023, at 11:35 PM, lilypond-user-requ...@gnu.org wrote:
> 
> Send lilypond-user mailing list submissions to
>    lilypond-user@gnu.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>    https://lists.gnu.org/mailman/listinfo/lilypond-user
> or, via email, send a message with subject or body 'help' to
>    lilypond-user-requ...@gnu.org
> 
> You can reach the person managing the list at
>    lilypond-user-ow...@gnu.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of lilypond-user digest..."
> Today's Topics:
> 
>   1. Re: Voices, shifting and stem direction (Jakob Pedersen)
>   2. MidiToLily, Windows console app that converts MIDI files to
>      Lily format, now available (Chris Korda)
>   3. Help with music function (Mark Probert)
--- Begin Message ---
Thank you kindly, Kieran. I appreciate your time.

I agree about the structure. Thank you for the example. I'll follow that.

Whatever else needs adjusting I'm sure I can force-\tweak into place.


Jakob

On 17.12.2023 15.49, Kieren MacMillan wrote:
Hi Jakob,

Does anyone know how to align VoiceOne (green) further left to match the 
horizontal position of VoiceFour (red)?
You could switch the \voiceTwo and \voiceFour commands… but that creates an 
even less pleasing result [IMO].

There are also ways to tweak the horizontal position of the noteheads; I just 
don’t have time right now to give examples (sorry!).

In the final bar, is it possible to align VoiceTwo (blue) and VoiceFour (red), 
without causing them to share a stem?
Something like this?

leftTwo = \relative c {
   \global << { \voiceFour \override NoteHead.color = #red c4 c' h a | h g a h 
| \tweak Stem.length #5 c a8\rest c h a h g }
              \new Voice { \voiceTwo \override NoteHead.color = #blue c,2 h4 a | h g 
a h | \tweak NoteColumn.force-hshift -0.5 c2 g\rest } >>
}

For what it’s worth, I would suggest a restructuring of your code, to (a) avoid 
potential potential issues if you start adding things [especially things with 
timing!] to the \global variable, and (b) to improve [at least IMO] readability 
and maintainability. Here’s a possibility I quickly whipped up:

%%%  SUGGESTED STRUCTURE (BEGIN)  %%%
\version "2.25.11"
\language "deutsch"

global = {
   \key c \major
   \time 4/4
}

rightOne = \relative c'' {
   c8 d e fis g d e fis | g d g4. f16 e d8 f~| f e16 d e8 r r2 |
}

rightTwo = \relative c'' {
   g4. a8 h4 c | h4. h8 a4. g8 | c2 r2 |
}

leftOne = \relative c' {
   \override NoteHead.color = #green
   e4 r d c | d2 c4 d | g, f'\rest r2 |
}

leftTwo = \relative c' {
   \override NoteHead.color = #blue
   c,2 h4 a | h g a h | \tweak NoteColumn.force-hshift -0.5 c2 g\rest
}

leftFour = \relative c {
   \override NoteHead.color = #red
   c4 c' h a | h g a h | \tweak Stem.length #5 c a8\rest c h a h g
}

\score {
   \new PianoStaff  <<
     \new Staff = "right" <<
       \global
       <<
         { \voiceOne \rightOne }
         \\ \new Voice { \voiceTwo \rightTwo }
       >>
     >>
     \new Staff = "left" <<
       \global \clef bass
       <<
         { \voiceOne \leftOne }
         \\ \new Voice { \voiceTwo \leftTwo }
         \\ \new Voice { \voiceFour \leftFour }
       >>
     >>
   >>
}
%%%  SUGGESTED STRUCTURE (END)  %%%

Here, almost all presentation decisions are left as late as possible (i.e., in 
the \score area), with the exception of the colour setting(s) and the 
voice-specific \tweaks (which I would personally also take out of the content 
code and add to the presentation layer, likely by way of the edition-engraver, 
if this were a “real piece“ of mine). This structure also puts all of the 
voice-splitting in the same place in the code, rather than having some in the 
variable definition area and some in the score area.

Hope all of this helps!
Kieren.

______________________________________________

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.


--- End Message ---
--- Begin Message ---
Thank you kindly, Kieran. I appreciate your time.

I agree about the structure. Thank you for the example. I'll follow that.

Whatever else needs adjusting I'm sure I can force-\tweak into place.


Jakob

On 17.12.2023 15.49, Kieren MacMillan wrote:
Hi Jakob,

Does anyone know how to align VoiceOne (green) further left to match the 
horizontal position of VoiceFour (red)?
You could switch the \voiceTwo and \voiceFour commands… but that creates an 
even less pleasing result [IMO].

There are also ways to tweak the horizontal position of the noteheads; I just 
don’t have time right now to give examples (sorry!).

In the final bar, is it possible to align VoiceTwo (blue) and VoiceFour (red), 
without causing them to share a stem?
Something like this?

leftTwo = \relative c {
   \global << { \voiceFour \override NoteHead.color = #red c4 c' h a | h g a h 
| \tweak Stem.length #5 c a8\rest c h a h g }
              \new Voice { \voiceTwo \override NoteHead.color = #blue c,2 h4 a | h g 
a h | \tweak NoteColumn.force-hshift -0.5 c2 g\rest } >>
}

For what it’s worth, I would suggest a restructuring of your code, to (a) avoid 
potential potential issues if you start adding things [especially things with 
timing!] to the \global variable, and (b) to improve [at least IMO] readability 
and maintainability. Here’s a possibility I quickly whipped up:

%%%  SUGGESTED STRUCTURE (BEGIN)  %%%
\version "2.25.11"
\language "deutsch"

global = {
   \key c \major
   \time 4/4
}

rightOne = \relative c'' {
   c8 d e fis g d e fis | g d g4. f16 e d8 f~| f e16 d e8 r r2 |
}

rightTwo = \relative c'' {
   g4. a8 h4 c | h4. h8 a4. g8 | c2 r2 |
}

leftOne = \relative c' {
   \override NoteHead.color = #green
   e4 r d c | d2 c4 d | g, f'\rest r2 |
}

leftTwo = \relative c' {
   \override NoteHead.color = #blue
   c,2 h4 a | h g a h | \tweak NoteColumn.force-hshift -0.5 c2 g\rest
}

leftFour = \relative c {
   \override NoteHead.color = #red
   c4 c' h a | h g a h | \tweak Stem.length #5 c a8\rest c h a h g
}

\score {
   \new PianoStaff  <<
     \new Staff = "right" <<
       \global
       <<
         { \voiceOne \rightOne }
         \\ \new Voice { \voiceTwo \rightTwo }
       >>
     >>
     \new Staff = "left" <<
       \global \clef bass
       <<
         { \voiceOne \leftOne }
         \\ \new Voice { \voiceTwo \leftTwo }
         \\ \new Voice { \voiceFour \leftFour }
       >>
     >>
   >>
}
%%%  SUGGESTED STRUCTURE (END)  %%%

Here, almost all presentation decisions are left as late as possible (i.e., in 
the \score area), with the exception of the colour setting(s) and the 
voice-specific \tweaks (which I would personally also take out of the content 
code and add to the presentation layer, likely by way of the edition-engraver, 
if this were a “real piece“ of mine). This structure also puts all of the 
voice-splitting in the same place in the code, rather than having some in the 
variable definition area and some in the score area.

Hope all of this helps!
Kieren.

______________________________________________

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.


--- End Message ---
--- Begin Message ---
Thank you kindly, Kieran. I appreciate your time.

I agree about the structure. Thank you for the example. I'll follow that.

Whatever else needs adjusting I'm sure I can force-\tweak into place.


Jakob

On 17.12.2023 15.49, Kieren MacMillan wrote:
Hi Jakob,

Does anyone know how to align VoiceOne (green) further left to match the 
horizontal position of VoiceFour (red)?
You could switch the \voiceTwo and \voiceFour commands… but that creates an 
even less pleasing result [IMO].

There are also ways to tweak the horizontal position of the noteheads; I just 
don’t have time right now to give examples (sorry!).

In the final bar, is it possible to align VoiceTwo (blue) and VoiceFour (red), 
without causing them to share a stem?
Something like this?

leftTwo = \relative c {
   \global << { \voiceFour \override NoteHead.color = #red c4 c' h a | h g a h 
| \tweak Stem.length #5 c a8\rest c h a h g }
              \new Voice { \voiceTwo \override NoteHead.color = #blue c,2 h4 a | h g 
a h | \tweak NoteColumn.force-hshift -0.5 c2 g\rest } >>
}

For what it’s worth, I would suggest a restructuring of your code, to (a) avoid 
potential potential issues if you start adding things [especially things with 
timing!] to the \global variable, and (b) to improve [at least IMO] readability 
and maintainability. Here’s a possibility I quickly whipped up:

%%%  SUGGESTED STRUCTURE (BEGIN)  %%%
\version "2.25.11"
\language "deutsch"

global = {
   \key c \major
   \time 4/4
}

rightOne = \relative c'' {
   c8 d e fis g d e fis | g d g4. f16 e d8 f~| f e16 d e8 r r2 |
}

rightTwo = \relative c'' {
   g4. a8 h4 c | h4. h8 a4. g8 | c2 r2 |
}

leftOne = \relative c' {
   \override NoteHead.color = #green
   e4 r d c | d2 c4 d | g, f'\rest r2 |
}

leftTwo = \relative c' {
   \override NoteHead.color = #blue
   c,2 h4 a | h g a h | \tweak NoteColumn.force-hshift -0.5 c2 g\rest
}

leftFour = \relative c {
   \override NoteHead.color = #red
   c4 c' h a | h g a h | \tweak Stem.length #5 c a8\rest c h a h g
}

\score {
   \new PianoStaff  <<
     \new Staff = "right" <<
       \global
       <<
         { \voiceOne \rightOne }
         \\ \new Voice { \voiceTwo \rightTwo }
       >>
     >>
     \new Staff = "left" <<
       \global \clef bass
       <<
         { \voiceOne \leftOne }
         \\ \new Voice { \voiceTwo \leftTwo }
         \\ \new Voice { \voiceFour \leftFour }
       >>
     >>
   >>
}
%%%  SUGGESTED STRUCTURE (END)  %%%

Here, almost all presentation decisions are left as late as possible (i.e., in 
the \score area), with the exception of the colour setting(s) and the 
voice-specific \tweaks (which I would personally also take out of the content 
code and add to the presentation layer, likely by way of the edition-engraver, 
if this were a “real piece“ of mine). This structure also puts all of the 
voice-splitting in the same place in the code, rather than having some in the 
variable definition area and some in the score area.

Hope all of this helps!
Kieren.

______________________________________________

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.


--- End Message ---
> _______________________________________________
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to