Scheme function to force any noteEvent to a skipEvent

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Scheme function to force any noteEvent to a skipEvent

Joseph Chrestien

Hi all,

is it possible to change all notes in a voice to skips through a function ?

E.g. ` \silence c4 \tempo 4=100 f8\p g8 ` would be compiled as ` s4 \tempo
4=100 s8\p s8 `. Note all other events would stay the same.

Below are the context and minimal code.

Thanks!
Jo Chrestien




-----

PS. Context : I am editing a choral score with multiple MIDI
outputs (4 voice-by-voice MIDI outputs and 1 polyphonic output). My goal is
to tweak the tempo in all MIDI outputs with only one hand entry.

So far I indicated (invisible) tempo changes in only one of the voices. This
works like a charm for the polyphonic output, but when individual voices are
printed to MIDI it logically does not affect their tempo.

So I want to generate a silent clone of that "tempo-adapted" voice and include

it in the split MIDI output, as a new voice.

Is there some kind of \silence function I could call to change tempo in
split MIDI? This function would force all note events of \sopranoMusic to
become skip events (e.g. c4 --> s4).

------
PPS. Minimal code:

```
\version "2.18.2"

sopranoMusic = \relative c'' {
  \cadenzaOn
  % here are the invisible tempo marks that I don't want to copy manually in
other voices
  \set Score.tempoHideNote = ##t
  \tempo 4=200
  c\breve g\breve
  \tempo 4=60
  a8 b8 c4
}

altoMusic = \relative c' {
  \cadenzaOn
  e\breve e\breve
  f8 g8 e2
}

silence = #(define-music-function (parser location my-music)
   (ly:music?)
  ;change everything to silence
  ;...........
   my-music)


% alto-only MIDI output
\score {
  \new Staff <<
    \new Voice = "1" { \silence \sopranoMusic }

    % just to get the tempo modifications : no music should be played
    \new Voice = "2" { \altoMusic } %
  >>
  \midi{}
}

```


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Scheme function to force any noteEvent to a skipEvent

David Kastrup
Joseph Chrestien <[hidden email]> writes:

> Hi all,
>
> is it possible to change all notes in a voice to skips through a function ?
>
> E.g. ` \silence c4 \tempo 4=100 f8\p g8 ` would be compiled as ` s4 \tempo
> 4=100 s8\p s8 `. Note all other events would stay the same.

\version "2.19.32"

silence =
#(define-music-function (arg) (ly:music?)
   (map-some-music
     (lambda (m)
        (and (music-is-of-type? m 'note-event)
             (make-music 'SkipEvent m)))
     arg))

\displayLilyMusic
\silence { c4 \tempo 4=100 f8\p g8 }

For version 2.18 you'll likely have to write (parser location arg)
instead of just (arg) but I think the rest would work fine.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Scheme function to force any noteEvent to a skipEvent

Simon Albrecht-2
In reply to this post by Joseph Chrestien
Hi Joseph,

a more common approach to the situation is using a separate music
variable containing information common to all parts. E.g.

%%%%%%%%%%%%%
aux = {
   \tempo 4 = 100
   s1
   \bar "|."
}

musicOne = { e'1 }
musicTwo = { c'1 }

\score {
   <<
     \new Staff <<
       \new NullVoice \aux
       \new Voice \musicOne
     >>
     \new Staff \new Voice \musicTwo
   >>
   \layout {}
}

\score {
   \new Staff <<
     \new NullVoice \aux
     \new Voice \musicOne
   >>
   \midi {}
}
%%%%%%%%%%%%%%

HTH, Simon

On 04.04.2016 13:43, Joseph Chrestien wrote:

>
> Hi all,
>
> is it possible to change all notes in a voice to skips through a
> function ?
>
> E.g. ` \silence c4 \tempo 4=100 f8\p g8 ` would be compiled as ` s4 \tempo
> 4=100 s8\p s8 `. Note all other events would stay the same.
>
> Below are the context and minimal code.
>
> Thanks!
> Jo Chrestien
>
>
>
>
> -----
>
> PS. Context : I am editing a choral score with multiple MIDI
> outputs (4 voice-by-voice MIDI outputs and 1 polyphonic output). My
> goal is
> to tweak the tempo in all MIDI outputs with only one hand entry.
>
> So far I indicated (invisible) tempo changes in only one of the
> voices. This
> works like a charm for the polyphonic output, but when individual
> voices are
> printed to MIDI it logically does not affect their tempo.
>
> So I want to generate a silent clone of that "tempo-adapted" voice and
> include
>
> it in the split MIDI output, as a new voice.
>
> Is there some kind of \silence function I could call to change tempo in
> split MIDI? This function would force all note events of \sopranoMusic to
> become skip events (e.g. c4 --> s4).
>
> ------
> PPS. Minimal code:
>
> ```
> \version "2.18.2"
>
> sopranoMusic = \relative c'' {
>   \cadenzaOn
>   % here are the invisible tempo marks that I don't want to copy
> manually in
> other voices
>   \set Score.tempoHideNote = ##t
>   \tempo 4=200
>   c\breve g\breve
>   \tempo 4=60
>   a8 b8 c4
> }
>
> altoMusic = \relative c' {
>   \cadenzaOn
>   e\breve e\breve
>   f8 g8 e2
> }
>
> silence = #(define-music-function (parser location my-music)
>    (ly:music?)
>   ;change everything to silence
>   ;...........
>    my-music)
>
>
> % alto-only MIDI output
> \score {
>   \new Staff <<
>     \new Voice = "1" { \silence \sopranoMusic }
>
>     % just to get the tempo modifications : no music should be played
>     \new Voice = "2" { \altoMusic } %
>   >>
>   \midi{}
> }
>
> ```
>
>
>
> _______________________________________________
> lilypond-user mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/lilypond-user


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Scheme function to force any noteEvent to a skipEvent

Joseph Chrestien

Thanks David and Simon for your kind help. I used David's solution and it works brilliantly. Very nice. I didn't know of this NullVoice context, I'll take a look at it.

Nice day to all of you
Joseph




On Mon, Apr 4, 2016 at 7:57 AM -0700, "Simon Albrecht" <[hidden email]> wrote:

Hi Joseph,

a more common approach to the situation is using a separate music
variable containing information common to all parts. E.g.

%%%%%%%%%%%%%
aux = {
   \tempo 4 = 100
   s1
   \bar "|."
}

musicOne = { e'1 }
musicTwo = { c'1 }

\score {
   <<
     \new Staff <<
       \new NullVoice \aux
       \new Voice \musicOne
     >>
     \new Staff \new Voice \musicTwo
   >>
   \layout {}
}

\score {
   \new Staff <<
     \new NullVoice \aux
     \new Voice \musicOne
   >>
   \midi {}
}
%%%%%%%%%%%%%%

HTH, Simon

On 04.04.2016 13:43, Joseph Chrestien wrote:
>
> Hi all,
>
> is it possible to change all notes in a voice to skips through a
> function ?
>
> E.g. ` \silence c4 \tempo 4=100 f8\p g8 ` would be compiled as ` s4 \tempo
> 4=100 s8\p s8 `. Note all other events would stay the same.
>
> Below are the context and minimal code.
>
> Thanks!
> Jo Chrestien
>
>
>
>
> -----
>
> PS. Context : I am editing a choral score with multiple MIDI
> outputs (4 voice-by-voice MIDI outputs and 1 polyphonic output). My
> goal is
> to tweak the tempo in all MIDI outputs with only one hand entry.
>
> So far I indicated (invisible) tempo changes in only one of the
> voices. This
> works like a charm for the polyphonic output, but when individual
> voices are
> printed to MIDI it logically does not affect their tempo.
>
> So I want to generate a silent clone of that "tempo-adapted" voice and
> include
>
> it in the split MIDI output, as a new voice.
>
> Is there some kind of \silence function I could call to change tempo in
> split MIDI? This function would force all note events of \sopranoMusic to
> become skip events (e.g. c4 --> s4).
>
> ------
> PPS. Minimal code:
>
> ```
> \version "2.18.2"
>
> sopranoMusic = \relative c'' {
>   \cadenzaOn
>   % here are the invisible tempo marks that I don't want to copy
> manually in
> other voices
>   \set Score.tempoHideNote = ##t
>   \tempo 4=200
>   c\breve g\breve
>   \tempo 4=60
>   a8 b8 c4
> }
>
> altoMusic = \relative c' {
>   \cadenzaOn
>   e\breve e\breve
>   f8 g8 e2
> }
>
> silence = #(define-music-function (parser location my-music)
>    (ly:music?)
>   ;change everything to silence
>   ;...........
>    my-music)
>
>
> % alto-only MIDI output
> \score {
>   \new Staff <<
>     \new Voice = "1" { \silence \sopranoMusic }
>
>     % just to get the tempo modifications : no music should be played
>     \new Voice = "2" { \altoMusic } %
>   >>
>   \midi{}
> }
>
> ```
>
>
>
> _______________________________________________
> lilypond-user mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/lilypond-user


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Scheme function to force any noteEvent to a skipEvent

David Wright
On Mon 04 Apr 2016 at 17:47:03 (+0000), Joseph Chrestien wrote:
> Thanks David and Simon for your kind help. I used David's solution and it works brilliantly. Very nice. I didn't know of this NullVoice context, I'll take a look at it.

My view would be to use David's solution where you have a preexisting
part already coded, but to use Simon's where you're writing a score
from scratch. It clarifies the structure of the score, and the
"aux" part is likely to be much less bulky to include in each and
every midi score than, say, a silenced florid soprano part.

I don't know if you write homophonic music with shared words (like in
a US-style hymn book) but NullVoice is almost unavoidable for setting
lyrics unless the rhythms are identical in every voice.

Cheers,
David.

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user