Re: function to replace notes by rests

2015-11-24 Thread Marc Hohl

Am 24.11.2015 um 10:43 schrieb Marc Hohl:

Am 24.11.2015 um 09:52 schrieb David Kastrup:
[...]

Even better, thanks a lot!


Well, nearly there. Is it possible to use this function only within a 
certain Staff?


If I write

xNote =
#(define-music-function (music) (ly:music?)
   (make-relative (music) music
(music-map
 (lambda (m)
   (if (eq? (ly:music-property m 'name) 'NoteEvent)
   (make-music 'RestEvent
 'duration (ly:music-property m 'duration))
   m))
 (ly:music-deep-copy music

\include "myfiles.ily" % <- \mel and \text defined here

\score {
  <<
\new Staff {
   \new Voice = "mel" { \mel }
}
\new Lyrics \lyricsto "mel" { \text }
\new Staff \with { midiInstrument = "alto sax" } { \mel }
  >>
  \midi { }
  \layout { }
}

the lyrics are displaced because the "spoken" notes are replaced 
globally with rests. This is a feature for proofreading only,

if there is no easy way, I'll comment out the first staff with the lyrics.

Marc





___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function to replace notes by rests

2015-11-24 Thread Robin Bannister

Marc Hohl wrote:


Now I need a midi file that contains the "normal" notes only:


Skips would be quiet too.


notesToSkips =
#(define-music-function (music) (ly:music?)
(skip-of-length music))


Cheers,
Robin

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function to replace notes by rests

2015-11-24 Thread Marc Hohl

Am 24.11.2015 um 09:52 schrieb David Kastrup:
[...]

Even better, thanks a lot!



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function to replace notes by rests

2015-11-24 Thread David Kastrup
Marc Hohl  writes:

> Am 23.11.2015 um 21:41 schrieb Malte Meyn:
>> Am 23.11.2015 um 10:46 schrieb Marc Hohl:
>>> As the file is a bit lengthy, I think of a way to just redefine
>>> \xNotes to change every note to its corresponding rest, instead of
>>> rewriting the whole file (or using sed or any other external script).
>>>
>>> Has anyone a scheme routine at hand that does exactly this job?
>
> Malte,
>
>> I wrote this but it doesn’t work well in relative mode:
>>
>> \version "2.19.30"
>>
>> notesToRests =
>> #(define-music-function (music) (ly:music?)
>> (music-map
>>  (lambda (m)
>>(if (eq? (ly:music-property m 'name) 'NoteEvent)
>>(make-music 'RestEvent
>>  'duration (ly:music-property m 'duration))
>>m))
>>  music))
>>
>> \relative {
>>c' d e f \notesToRests { g a b2 g8 c } f e c2
>> }
>
> Thanks or sharing! The drawbacks in relative mode are neglectable,
> I'll use absolute mode.

\version "2.19.30"

notesToRests =
#(define-music-function (music) (ly:music?)
   (make-relative (music) music
(music-map
 (lambda (m)
   (if (eq? (ly:music-property m 'name) 'NoteEvent)
   (make-music 'RestEvent
 'duration (ly:music-property m 'duration))
   m))
 (ly:music-deep-copy music

\relative {
   c' d e f \notesToRests { g a b2 g8 c } f e c2
}

-- 
David Kastrup
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function to replace notes by rests

2015-11-23 Thread Jacques Menu
Hello Marc,

Thanks for teaching me this.

As it turns out, we’re better off specifying durations at crucial points to 
avoid « inheriting » such default values, see:

  c'4 d e f \notesToRests \fragment f'8 e c2

below.

JM


\version "2.19.32"

notesToRests =
#(define-music-function (music) (ly:music?)
   (music-map
(lambda (m)
  (if (eq? (ly:music-property m 'name) 'NoteEvent)
  (make-music 'RestEvent
'duration (ly:music-property m 'duration))
  m))
music))

\relative {
  c'4 d e f \notesToRests { g a b2 g8 c } f e c2
}

\relative {
  c'4 d e f \notesToRests \relative { g' a b2 g8 c } f' e c2
}


fragment = \relative { g'4 a b2 g8 c }

\relative {
  c'4 d e f \notesToRests \fragment f'8 e c2
}



> Le 24 nov. 2015 à 08:32, Marc Hohl  a écrit :
> 
> Am 24.11.2015 um 08:27 schrieb Jacques Menu:
>> Hello Malte,
>> 
>> Interesting, but why are there halves instead of quarters in the second
>> staff?
>> 
> 
> Because the first \relative bock ends with halves and this duration is
> used for the next \relative block as well.
> 
> Just using \relative multiple times doesn't reset the default duration to 4 
> (which would be quite a nuisance, anyway).
> 
> Marc
> 
>> JM
>> 
>> 
>> \version "2.19.32"
>> 
>> notesToRests =
>> #(define-music-function (music) (ly:music?)
>>(music-map
>> (lambda (m)
>>   (if (eq? (ly:music-property m 'name) 'NoteEvent)
>>   (make-music 'RestEvent
>> 'duration (ly:music-property m 'duration))
>>   m))
>> music))
>> 
>> \relative {
>>   c' d e f \notesToRests { g a b2 g8 c } f e c2
>> }
>> 
>> \relative {
>>   c' d e f \notesToRests \relative { g' a b2 g8 c } f' e c2
>> }
>> 
>> 
>> 
>>> Le 24 nov. 2015 à 08:21, Malte Meyn >> > a écrit :
>>> 
>>> 
>>> 
>>> Am 24.11.2015 um 08:10 schrieb Marc Hohl:
 Thanks or sharing! The drawbacks in relative mode are neglectable, I'll
 use absolute mode.
 
>>> 
>>> Alternatively you could use
>>> 
>>> 1. another \relative block inside of notesToRests
>>> \relative {
>>>  c' d e f \notesToRests \relative { g' a b2 g8 c } f' e c2
>>> }
>>> 
>>> or
>>> 
>>> 2. octave checks if you don’t mind the warnings
>>> \relative {
>>>  c' d e f \notesToRests { g a b2 g8 c } f='' e c2
>>> }
>>> 
>>> ___
>>> lilypond-user mailing list
>>> lilypond-user@gnu.org 
>>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>> 
>> 
>> 
>> ___
>> lilypond-user mailing list
>> lilypond-user@gnu.org
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>> 
> 
> 
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function to replace notes by rests

2015-11-23 Thread Marc Hohl

Am 24.11.2015 um 08:27 schrieb Jacques Menu:

Hello Malte,

Interesting, but why are there halves instead of quarters in the second
staff?



Because the first \relative bock ends with halves and this duration is
used for the next \relative block as well.

Just using \relative multiple times doesn't reset the default duration 
to 4 (which would be quite a nuisance, anyway).


Marc


JM


\version "2.19.32"

notesToRests =
#(define-music-function (music) (ly:music?)
(music-map
 (lambda (m)
   (if (eq? (ly:music-property m 'name) 'NoteEvent)
   (make-music 'RestEvent
 'duration (ly:music-property m 'duration))
   m))
 music))

\relative {
   c' d e f \notesToRests { g a b2 g8 c } f e c2
}

\relative {
   c' d e f \notesToRests \relative { g' a b2 g8 c } f' e c2
}




Le 24 nov. 2015 à 08:21, Malte Meyn mailto:lilyp...@maltemeyn.de>> a écrit :



Am 24.11.2015 um 08:10 schrieb Marc Hohl:

Thanks or sharing! The drawbacks in relative mode are neglectable, I'll
use absolute mode.



Alternatively you could use

1. another \relative block inside of notesToRests
\relative {
  c' d e f \notesToRests \relative { g' a b2 g8 c } f' e c2
}

or

2. octave checks if you don’t mind the warnings
\relative {
  c' d e f \notesToRests { g a b2 g8 c } f='' e c2
}

___
lilypond-user mailing list
lilypond-user@gnu.org 
https://lists.gnu.org/mailman/listinfo/lilypond-user




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function to replace notes by rests

2015-11-23 Thread Jacques Menu
Hello Malte,

Interesting, but why are there halves instead of quarters in the second staff?

JM


\version "2.19.32"

notesToRests =
#(define-music-function (music) (ly:music?)
   (music-map
(lambda (m)
  (if (eq? (ly:music-property m 'name) 'NoteEvent)
  (make-music 'RestEvent
'duration (ly:music-property m 'duration))
  m))
music))

\relative {
  c' d e f \notesToRests { g a b2 g8 c } f e c2
}

\relative {
  c' d e f \notesToRests \relative { g' a b2 g8 c } f' e c2
}



> Le 24 nov. 2015 à 08:21, Malte Meyn  a écrit :
> 
> 
> 
> Am 24.11.2015 um 08:10 schrieb Marc Hohl:
>> Thanks or sharing! The drawbacks in relative mode are neglectable, I'll
>> use absolute mode.
>> 
> 
> Alternatively you could use
> 
> 1. another \relative block inside of notesToRests
>   \relative {
> c' d e f \notesToRests \relative { g' a b2 g8 c } f' e c2
>   }
> 
> or
> 
> 2. octave checks if you don’t mind the warnings
>   \relative {
> c' d e f \notesToRests { g a b2 g8 c } f='' e c2
>   }
> 
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function to replace notes by rests

2015-11-23 Thread Malte Meyn



Am 24.11.2015 um 08:10 schrieb Marc Hohl:

Thanks or sharing! The drawbacks in relative mode are neglectable, I'll
use absolute mode.



Alternatively you could use

1. another \relative block inside of notesToRests
\relative {
  c' d e f \notesToRests \relative { g' a b2 g8 c } f' e c2
}

or

2. octave checks if you don’t mind the warnings
\relative {
  c' d e f \notesToRests { g a b2 g8 c } f='' e c2
}

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function to replace notes by rests

2015-11-23 Thread Marc Hohl

Am 23.11.2015 um 21:41 schrieb Malte Meyn:

Am 23.11.2015 um 10:46 schrieb Marc Hohl:

As the file is a bit lengthy, I think of a way to just redefine
\xNotes to change every note to its corresponding rest, instead of
rewriting the whole file (or using sed or any other external script).

Has anyone a scheme routine at hand that does exactly this job?


Malte,


I wrote this but it doesn’t work well in relative mode:

\version "2.19.30"

notesToRests =
#(define-music-function (music) (ly:music?)
(music-map
 (lambda (m)
   (if (eq? (ly:music-property m 'name) 'NoteEvent)
   (make-music 'RestEvent
 'duration (ly:music-property m 'duration))
   m))
 music))

\relative {
   c' d e f \notesToRests { g a b2 g8 c } f e c2
}


Thanks or sharing! The drawbacks in relative mode are neglectable, I'll 
use absolute mode.


Marc


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: function to replace notes by rests

2015-11-23 Thread Malte Meyn

Am 23.11.2015 um 10:46 schrieb Marc Hohl:

As the file is a bit lengthy, I think of a way to just redefine
\xNotes to change every note to its corresponding rest, instead of
rewriting the whole file (or using sed or any other external script).

Has anyone a scheme routine at hand that does exactly this job?


I wrote this but it doesn’t work well in relative mode:

\version "2.19.30"

notesToRests =
#(define-music-function (music) (ly:music?)
   (music-map
(lambda (m)
  (if (eq? (ly:music-property m 'name) 'NoteEvent)
  (make-music 'RestEvent
'duration (ly:music-property m 'duration))
  m))
music))

\relative {
  c' d e f \notesToRests { g a b2 g8 c } f e c2
}

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


function to replace notes by rests

2015-11-23 Thread Marc Hohl

Hi list,

I have a melody with some spoken passages, written like this:

c4 d e f \xNotes { b b b b } f e d c

Now I need a midi file that contains the "normal" notes only:

c4 d e f r r r r f e d c

As the file is a bit lengthy, I think of a way to just redefine
\xNotes to change every note to its corresponding rest, instead of 
rewriting the whole file (or using sed or any other external script).


Has anyone a scheme routine at hand that does exactly this job?

I remember vaguely that there has been something like this on the 
archives, but I did not find it again ...


TIA,

Marc

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user