Re: Fw: Compress Long Rest in Jianpu.

2024-03-24 Thread Windy Deng
Thanks a lot, it works.
And I tried to add a little bit more to the original file, now it only
compresses 3 or more measures of rests.

--- a/jianpu10a.ly
+++ b/jianpu10a.ly
@@ -87,6 +87,9 @@ jianpuMusic =
  ((or (music-is-of-type? m 'rest-event)
   (music-is-of-type? m 'multi-measure-rest))
   (let ((dur (ly:moment-main (ly:music-duration-length m
+  (if (or (music-is-of-type? m 'rest-event)
+  (and (music-is-of-type? m 'multi-measure-rest)
+   (<= dur 2)))
 (if (>= dur 1/2)
 ;; split whole and half rests into quarter notes
 (let ((q (make-music 'NoteEvent
@@ -110,7 +113,7 @@ jianpuMusic =
 (delete 'rest-event (ly:music-property m 'types))
 '(note-event melodic-event)))
  (ly:music-set-property! m 'jianpu-rest #t)
- 
+ )


Windy

Werner LEMBERG  于2024年3月24日周日 14:28写道:

>
> [Forwarding private message to have the whole conversation in the
> archive.]
>
>
>
> -- Forwarded message --
> From: Windy Deng 
> To: Werner LEMBERG 
> Cc:
> Bcc:
> Date: Sun, 24 Mar 2024 13:00:10 +0800
> Subject: Re: Compress Long Rest in Jianpu.
> Sure, it looks like this
> [image: image.png]
> and this
> [image: image.png]
>
> seems like it just copies the staff style and removes staff lines.
>
>
> Windy
>
> Werner LEMBERG  于2024年3月24日周日 01:23写道:
>
>>
>> > I want to display both staff and jianpu, but if I enable
>> > \compressMMRests function, the long rests are not compressed when
>> > engraving with jianpu.
>> >
>> > Jianpu support for Lilypond is from file jiapu10a.ly on
>> > https://github.com/nybbs2003/lilypond-Jianpu . Is there any way to
>> > patch the file or something to make it support \compressMMRests?
>> >
>> > MWE is in the attachment.
>>
>> Do you have a real-world example how compressed rests look like in
>> Jianpu notation?  I guess the author hasn't thought of that...
>>
>>
>> Werner
>>
>


Re: Compress Long Rest in Jianpu.

2024-03-24 Thread Werner LEMBERG


[Please always reply to the list!]

> Sure, it looks like this
> [image: image.png]
> and this
> [image: image.png]
> 
> seems like it just copies the staff style and removes staff lines.

OK, thanks.  The un-compression of MM rests is an intentional feature
of `jianpu10a.ly`.  You should contact the author to add a command
that switches compression of MM rests on and off.

Below is a trivial patch to enable MM compression.  Note, however,
that this also disables conversion of `R1` to '0 0 0 0', which is
probably not wanted.  In other words, I suspect that more tinkering is
necessary to get a solution that really fits current jianpu usage.


Werner


==


--- jianpu10a-old.ly2024-03-23 18:20:24.923336345 +0100
+++ jianpu10a.ly2024-03-24 07:18:42.382334806 +0100
@@ -84,8 +84,7 @@
))
 
  ;; REST AND MULTI-MEASURE REST
- ((or (music-is-of-type? m 'rest-event)
-  (music-is-of-type? m 'multi-measure-rest))
+ ((music-is-of-type? m 'rest-event)
   (let ((dur (ly:moment-main (ly:music-duration-length m
 (if (>= dur 1/2)
 ;; split whole and half rests into quarter notes



Fw: Compress Long Rest in Jianpu.

2024-03-24 Thread Werner LEMBERG

[Forwarding private message to have the whole conversation in the
archive.]
--- Begin Message ---
Sure, it looks like this
[image: image.png]
and this
[image: image.png]

seems like it just copies the staff style and removes staff lines.


Windy

Werner LEMBERG  于2024年3月24日周日 01:23写道:

>
> > I want to display both staff and jianpu, but if I enable
> > \compressMMRests function, the long rests are not compressed when
> > engraving with jianpu.
> >
> > Jianpu support for Lilypond is from file jiapu10a.ly on
> > https://github.com/nybbs2003/lilypond-Jianpu . Is there any way to
> > patch the file or something to make it support \compressMMRests?
> >
> > MWE is in the attachment.
>
> Do you have a real-world example how compressed rests look like in
> Jianpu notation?  I guess the author hasn't thought of that...
>
>
> Werner
>
--- End Message ---


Re: Compress Long Rest in Jianpu.

2024-03-23 Thread Werner LEMBERG


> I want to display both staff and jianpu, but if I enable
> \compressMMRests function, the long rests are not compressed when
> engraving with jianpu.
> 
> Jianpu support for Lilypond is from file jiapu10a.ly on
> https://github.com/nybbs2003/lilypond-Jianpu . Is there any way to
> patch the file or something to make it support \compressMMRests?
> 
> MWE is in the attachment.

Do you have a real-world example how compressed rests look like in
Jianpu notation?  I guess the author hasn't thought of that...


Werner



Compress Long Rest in Jianpu.

2024-03-23 Thread Windy Deng
Greetings Lilypond users:

I want to display both staff and jianpu, but if I enable
\compressMMRests function,
the long rests are not compressed when engraving with jianpu.

Jianpu support for Lilypond is from file jiapu10a.ly on
https://github.com/nybbs2003/lilypond-Jianpu . Is there any way to patch
the file or something to make it support \compressMMRests?

MWE is in the attachment.

Sincerely,
Windy


test.ly
Description: Binary data