Re: extending event-listener.ly to include a (numerical) voice id

2017-10-21 Thread Maurits Lamers

>> I tried to read the associatedVoice property, but that seems to be
>> empty.
> 
> Try the context property associatedVoiceContext .  I think it gets set
> by the iterator resposible for \lyricsto et al, just don't know when.

Just tried it, and it indeed contains the voice context required. In this case 
the lyrics are added through addLyrics.
As far as I have read the code it gets attached when the lyrics context is 
instantiated.
In any case, it gets attached before it is given to the engraver.

Very many thanks!

cheers

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


Re: extending event-listener.ly to include a (numerical) voice id

2017-10-21 Thread David Kastrup
Maurits Lamers  writes:

>>> But those values are not retrievable through (ly:context-id
>>> context), are they?
>> 
>> They are.  LilyPond just does the equivalent of
>> << \context Voice = "1" ...
>>   \context Voice = "2" ...
>>   \context Voice = "3"
 
>> 
>> But this is just ad-hoc for a << \\ \\ >> construct.
>
> So, if I understand this correctly, the following 
>
> \new Voice { 
>
> }
>
> leaves the context-id empty.

Yes.  Implicitly created contexts get something like "\\new" I think.

>  As I have to track them anyhow, I used the (make-object-property)
> technique to track the voice even in that case (as well as the parent
> staff)
>
> Follow up question:
> I also want to track lyrics. I already capture the lyric-event and
> hyphen-event. Is is possible to find the associated voice through the
> event?

Not that I know of.

> I tried to read the associatedVoice property, but that seems to be
> empty.

Try the context property associatedVoiceContext .  I think it gets set
by the iterator resposible for \lyricsto et al, just don't know when.

-- 
David Kastrup

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


Re: extending event-listener.ly to include a (numerical) voice id

2017-10-21 Thread Maurits Lamers
>> But those values are not retrievable through (ly:context-id context), are 
>> they? 
> 
> They are.  LilyPond just does the equivalent of
> << \context Voice = "1" ...
>   \context Voice = "2" ...
>   \context Voice = "3"
>>> 
> 
> But this is just ad-hoc for a << \\ \\ >> construct.

So, if I understand this correctly, the following 

\new Voice { 

}

leaves the context-id empty.
 As I have to track them anyhow, I used the (make-object-property) technique to 
track the voice even in that case (as well as the parent staff)

Follow up question:
I also want to track lyrics. I already capture the lyric-event and 
hyphen-event. Is is possible to find the associated voice through the event?
I tried to read the associatedVoice property, but that seems to be empty.

thanks in advance!

cheers

Maurits


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


Re: extending event-listener.ly to include a (numerical) voice id

2017-10-20 Thread David Kastrup
Maurits Lamers  writes:

>> Op 20 okt. 2017, om 18:32 heeft David Kastrup  het
>> volgende geschreven:
>> 
>> Maurits Lamers > 
>> writes:
>> 
>>> I can retrieve the retrieve that name through (ly:context-id
>>> (ly:translator-context engraver)).
>>> When the voice is defined in an anonymous way context-id is an empty 
>>> string. 
>>> I have been trying to set the context-id when none is set using a
>>> counter, but that fails because of an "missing typecheck for property
>>> 'context-id'" error.
>>> I tried to use both a normal list as well as an asoc list to keep
>>> track of the different Voice contexts in order to tell them apart but
>>> I haven't been able to get that to work.
>>> 
>>> I know that when lyrics are added, it is possible to refer to those
>>> anonymous voices by using "1" etc.
>> 
>> That's nonsense.  Voices in a << ... \\ ... \\ >> construct are not
>> anonymous but named "1", "2", "3" by default, and you can refer to
>> those.  But this has nothing whatsoever to do with lyrics.
>
> But those values are not retrievable through (ly:context-id context), are 
> they? 

They are.  LilyPond just does the equivalent of
<< \context Voice = "1" ...
   \context Voice = "2" ...
   \context Voice = "3"
>>

But this is just ad-hoc for a << \\ \\ >> construct.

-- 
David Kastrup

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


Re: extending event-listener.ly to include a (numerical) voice id

2017-10-20 Thread Maurits Lamers

> Op 20 okt. 2017, om 18:32 heeft David Kastrup  het volgende 
> geschreven:
> 
> Maurits Lamers > 
> writes:
> 
>> Hi all,
>> 
>> I am trying to extend the default event-listener.ly to also include
>> information about in which voice a specific note is being played.
>> When the voice is defined using 
>> 
>> \new Voice = voicename
>> 
>> I can retrieve the retrieve that name through (ly:context-id
>> (ly:translator-context engraver)).
>> When the voice is defined in an anonymous way context-id is an empty string. 
>> I have been trying to set the context-id when none is set using a
>> counter, but that fails because of an "missing typecheck for property
>> 'context-id'" error.
>> I tried to use both a normal list as well as an asoc list to keep
>> track of the different Voice contexts in order to tell them apart but
>> I haven't been able to get that to work.
>> 
>> I know that when lyrics are added, it is possible to refer to those
>> anonymous voices by using "1" etc.
> 
> That's nonsense.  Voices in a << ... \\ ... \\ >> construct are not
> anonymous but named "1", "2", "3" by default, and you can refer to
> those.  But this has nothing whatsoever to do with lyrics.

But those values are not retrievable through (ly:context-id context), are they? 

>> I would like to be able to mark a voice in Scheme in such a way that I
>> can print to which voice a certain note belongs. Could anyone give a
>> clue on how to achieve that?
> 
> Contexts are objects with identity.  You can just create something like
> 
> (define context-id (make-object-property))
> 
> And then you can set! and fetch (context-id ctx).

That works perfect indeed. Thanks a lot!

cheers

Maurits

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


Re: extending event-listener.ly to include a (numerical) voice id

2017-10-20 Thread David Kastrup
Maurits Lamers  writes:

> Hi all,
>
> I am trying to extend the default event-listener.ly to also include
> information about in which voice a specific note is being played.
> When the voice is defined using 
>
> \new Voice = voicename
>
> I can retrieve the retrieve that name through (ly:context-id
> (ly:translator-context engraver)).
> When the voice is defined in an anonymous way context-id is an empty string. 
> I have been trying to set the context-id when none is set using a
> counter, but that fails because of an "missing typecheck for property
> 'context-id'" error.
> I tried to use both a normal list as well as an asoc list to keep
> track of the different Voice contexts in order to tell them apart but
> I haven't been able to get that to work.
>
> I know that when lyrics are added, it is possible to refer to those
> anonymous voices by using "1" etc.

That's nonsense.  Voices in a << ... \\ ... \\ >> construct are not
anonymous but named "1", "2", "3" by default, and you can refer to
those.  But this has nothing whatsoever to do with lyrics.

> I would like to be able to mark a voice in Scheme in such a way that I
> can print to which voice a certain note belongs. Could anyone give a
> clue on how to achieve that?

Contexts are objects with identity.  You can just create something like

(define context-id (make-object-property))

And then you can set! and fetch (context-id ctx).


-- 
David Kastrup

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


extending event-listener.ly to include a (numerical) voice id

2017-10-20 Thread Maurits Lamers
Hi all,

I am trying to extend the default event-listener.ly to also include information 
about in which voice a specific note is being played.
When the voice is defined using 

\new Voice = voicename

I can retrieve the retrieve that name through (ly:context-id 
(ly:translator-context engraver)). 
When the voice is defined in an anonymous way context-id is an empty string. 
I have been trying to set the context-id when none is set using a counter, but 
that fails because of an "missing typecheck for property 'context-id'" error.
I tried to use both a normal list as well as an asoc list to keep track of the 
different Voice contexts in order to tell them apart but I haven't been able to 
get that to work.

I know that when lyrics are added, it is possible to refer to those anonymous 
voices by using "1" etc.
Looking through the code which does this 
(lily/lyric-combine-music-iterator.cc), I gather that the lyrics adding process 
searches for the a voice matching a certain id.

I would like to be able to mark a voice in Scheme in such a way that I can 
print to which voice a certain note belongs. Could anyone give a clue on how to 
achieve that?

Thanks in advance!

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


Re: extending event-listener.ly

2014-10-15 Thread James

Hello,

On 15/10/14 03:35, flip wrote:

It looks like this patch never made it into the current development
repository (or it got put into some place I couldn't find it). I've manually
tweaked my event-listener.ly for now, but wondered if this just sort of got
mis-placed. We need to output some drum part events for some experiments
we're doing. Any plans to integrate this into the main branches?


Nope. If it hasn't made it back then it won't now. However 

I just downloaded that 18 month old patch and it still applies to 
current master so, what the heck!


http://code.google.com/p/lilypond/issues/detail?id=4164

Let's see what happens when it gets tested.

There will be a new Rietveld though.

http://codereview.appspot.com/152600043

James





At some point I need to customize the drum MIDI stuff a bit. I have a
collection of percussion sounds that I need to custom-map, etc. Slowly
learning...



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/extending-event-listener-ly-tp143400p167571.html
Sent from the User mailing list archive at Nabble.com.

___
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: extending event-listener.ly

2014-10-14 Thread flip
It looks like this patch never made it into the current development
repository (or it got put into some place I couldn't find it). I've manually
tweaked my event-listener.ly for now, but wondered if this just sort of got
mis-placed. We need to output some drum part events for some experiments
we're doing. Any plans to integrate this into the main branches?


At some point I need to customize the drum MIDI stuff a bit. I have a
collection of percussion sounds that I need to custom-map, etc. Slowly
learning...



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/extending-event-listener-ly-tp143400p167571.html
Sent from the User mailing list archive at Nabble.com.

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


Re: extending event-listener.ly

2013-03-29 Thread Phil Hézaine

Hi list,

A patch about event-listener.ly was send to:

https://codereview.appspot.com/8165043/

Phil.

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


Re: extending event-listener.ly

2013-03-29 Thread Graham Percival
On Thu, Mar 28, 2013 at 08:09:45PM +0100, Phil Hézaine wrote:
 And what about the conversion of drum notes to midi pitches?
 I'm not able to find a way to write a specific function for that issue.
 Graham? Have you some time?

To clarify, I wasn't suggesting that drums should be converted to
midi pitches.  Rather, it should be possible to write a function
which extracts the MIDI pitch number (if it's a normal note), or
the drum name (if it's a drum note).  Using a function like that
would allow you to eliminate some duplicate lines, making the file
easier to maintain in the future.

- Graham

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


Re: extending event-listener.ly

2013-03-28 Thread luis jure

on 2013-03-27 at 14:13 Graham Percival wrote:

 On Wed, Mar 27, 2013 at 08:21:53AM -0300, luis jure wrote:

  BTW, i was quite curious myself about why the point-and-clik info was
  included in the first place. i thought it was only useful for pdf
  files. is this information used by your virtual violinist?
 
 Yes, for the interactive training, I display the pdf, and when
 users click on a note it displays information about that note (and
 plays it audibly).  


oh, i see, it makes perfect sense.

BTW, is phil's patch going be merged into lilypond's event-listener? drum
voices also have the right to be listened to... ;-)

best,


lj

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


Re: extending event-listener.ly

2013-03-28 Thread Janek Warchoł
On Thu, Mar 28, 2013 at 2:46 PM, luis jure l...@internet.com.uy wrote:
 BTW, is phil's patch going be merged into lilypond's event-listener?

It can be.  Phil, please make a git-formatted patch and send a request
for merging it to bug-lilypond mailing list.  If you need help with
this, let us know.

best,
Janek

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


Re: extending event-listener.ly

2013-03-28 Thread Phil Hézaine

Le 28/03/2013 15:00, Janek Warchoł a écrit :

On Thu, Mar 28, 2013 at 2:46 PM, luis jure l...@internet.com.uy wrote:

BTW, is phil's patch going be merged into lilypond's event-listener?


It can be.  Phil, please make a git-formatted patch and send a request
for merging it to bug-lilypond mailing list.  If you need help with
this, let us know.


Hi,
Yes, I need help. I don't know how to write a patch git-formatted.
But before, I think you should ask Graham if my additions are well 
written, I want to say: are there some improvements needed?

And what about the conversion of drum notes to midi pitches?
I'm not able to find a way to write a specific function for that issue.
Graham? Have you some time?

Phil.

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


Re: extending event-listener.ly

2013-03-28 Thread Janek Warchoł
Hi Phil,

On Thu, Mar 28, 2013 at 8:09 PM, Phil Hézaine philippe.heza...@free.fr wrote:
 Le 28/03/2013 15:00, Janek Warchoł a écrit :
 Phil, please make a git-formatted patch and send a request
 for merging it to bug-lilypond mailing list.  If you need help with
 this, let us know.

 Hi,
 Yes, I need help. I don't know how to write a patch git-formatted.

ok.  A few questions:
- what operating system do you use? (in particular, do you have some
Linux at hand?)
- do you have any experience with version control?
- how comfortable are you with the command line?

 But before, I think you should ask Graham if my additions are well written,
 I want to say: are there some improvements needed?
 And what about the conversion of drum notes to midi pitches?
 I'm not able to find a way to write a specific function for that issue.

We'll put your patch up for review, and then everybody will have the
opportunity to comment on it.

cheers,
Janek

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


Re: extending event-listener.ly

2013-03-28 Thread luis jure

on 2013-03-28 at 20:09 Phil Hézaine wrote:

 And what about the conversion of drum notes to midi pitches?

mmm... i wonder if that's strictly necessary? once you get the correct
text output, as you do now, it's trivial to convert the drum notes names to
pitches with whatever program you're using to process it.

on the other hand...

 I want to say: are there some improvements needed?

well, this is not related to your patch, but since you're at it... ;-)

i realized that the format-text function can only process simple text
scripts, but returns an error message when using a markup.

c^accel. is OK, but:

c^\markup{ accel. } or c^\markup{ \italic { accel. }}

return errors:

Unsupported SCM value for format: (#procedure line-markup (layout props
args) (accel.))

Unsupported SCM value for format: (#procedure line-markup (layout props
args) ((#procedure italic-markup (layout props arg) accel.)))

in both cases the .notes file has an empty text line where the markups
were used.

looking at the code i see that the format-text function is very basic, i
guess it wouldn't be trivial to adapt it to handle markups?


best,

lj

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


Re: extending event-listener.ly

2013-03-28 Thread Phil Hézaine

Le 28/03/2013 21:44, Janek Warchoł a écrit :

Hi Phil,

On Thu, Mar 28, 2013 at 8:09 PM, Phil Hézaine philippe.heza...@free.fr wrote:

Le 28/03/2013 15:00, Janek Warchoł a écrit :

Phil, please make a git-formatted patch and send a request
for merging it to bug-lilypond mailing list.  If you need help with
this, let us know.


Hi,
Yes, I need help. I don't know how to write a patch git-formatted.


ok.  A few questions:
- what operating system do you use? (in particular, do you have some
Linux at hand?)


Linux with Gentoo.


- do you have any experience with version control?


I've no idea.


- how comfortable are you with the command line?


I get by.


But before, I think you should ask Graham if my additions are well written,
I want to say: are there some improvements needed?
And what about the conversion of drum notes to midi pitches?
I'm not able to find a way to write a specific function for that issue.


We'll put your patch up for review, and then everybody will have the
opportunity to comment on it.

cheers,
Janek


Phil.


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


Re: extending event-listener.ly

2013-03-28 Thread Phil Hézaine

Le 28/03/2013 23:36, luis jure a écrit :


on 2013-03-28 at 20:09 Phil Hézaine wrote:


And what about the conversion of drum notes to midi pitches?


mmm... i wonder if that's strictly necessary? once you get the correct
text output, as you do now, it's trivial to convert the drum notes names to
pitches with whatever program you're using to process it.


Indeed. But Lilypond knows how to do this internally. If you look at the 
sources you'll see the midiDrumPitches in drumpitch-init.ly

It will be straightforward.


on the other hand...


I want to say: are there some improvements needed?


well, this is not related to your patch, but since you're at it... ;-)

i realized that the format-text function can only process simple text
scripts, but returns an error message when using a markup.

c^accel. is OK, but:

c^\markup{ accel. } or c^\markup{ \italic { accel. }}

return errors:

Unsupported SCM value for format: (#procedure line-markup (layout props
args) (accel.))

Unsupported SCM value for format: (#procedure line-markup (layout props
args) ((#procedure italic-markup (layout props arg) accel.)))

in both cases the .notes file has an empty text line where the markups
were used.

looking at the code i see that the format-text function is very basic, i
guess it wouldn't be trivial to adapt it to handle markups?



Not for me!... err... to handle... :-)


best,

lj


Phil.


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


Re: extending event-listener.ly

2013-03-27 Thread luis jure

on 2013-03-26 at 16:04 Graham Percival wrote:

 I'm quite curious about this -- do drum events not have
 point-and-click info?

BTW, i was quite curious myself about why the point-and-clik info was
included in the first place. i thought it was only useful for pdf files.
is this information used by your virtual violinist?


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


Re: extending event-listener.ly

2013-03-27 Thread Phil Hézaine

Le 27/03/2013 00:04, Graham Percival a écrit :

On Tue, Mar 26, 2013 at 08:12:42PM +0100, Phil Hézaine wrote:

for NoteEvent:

#(define (format-note engraver event)
(let* ((origin (ly:input-file-line-char-column
(ly:event-property event 'origin
  (print-line engraver
  note
  ;; get a MIDI pitch value.
  ;(+ 60 (ly:pitch-semitones
 (ly:event-property event 'drum-type) ;))


It would be nice if this was abstracted into a separate function:
   (get-pitch-or-drum
which would pick which type of output to produce.  Then I think we
could accept a patch to this effect without much fuss.


  ;; point and click info
  ;(ly:format point-and-click ~a ~a
  ;   (caddr origin)
  ;   (cadr origin))


I'm quite curious about this -- do drum events not have
point-and-click info?

- Graham


Hi,
Because it's MY OWN  PERSONAL  SELFISH LISTENER! :-) :-) :-)
Seriously, I join a modified event-listener.
I have pointed out the additions.
However no success about MIDI pitch values.
It will be awesome to have that.
Cheers.

@ Luis

i must be missing something, though, because i get output only if use
\drummode inside a regular Staff or a RhythmicStaff, but no output when
using a DrumStaff. any ideas why? the output of \displayMusic is the same
in all cases.


In MY OWN  PERSONAL...etc... I have added a context for a DrumVoice 
which was absent.

That's the tip.
I join -display.ly. I hope it helps you to play with the 
event-listener.

Phil.


i'm also getting a series of warnings (4) of the form:

Unsupported SCM value for format: ()

perhaps i misunderstood how to insert your code in the event-listener.ly
file?


Cheers.


 This file is part of LilyPond, the GNU music typesetter.

 Copyright (C) 2011--2012 Graham Percival gra...@percival-music.ca

 LilyPond is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 LilyPond is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with LilyPond.  If not, see http://www.gnu.org/licenses/.
%
%
%
% This file is used for Vivi, the Virtual Violinist:
%   http://percival-music.ca/vivi.html
% but it may be helpful to other researchers, either with the same
% output, or as a basis for other work in extracting music events
% from lilypond.
%
% Output format is tab-separated lines, like this:
%0.	note	57	0.2500	point-and-click 2 38
%0.	dynamic	f
%0.2500	note	62	0.2500	point-and-click 7 38
%0.5000	note	66	0.1250	point-and-click 9 38
%0.5000	script	staccato



\version 2.16.0

 Helper functions

#(define (filename-from-staffname context)
   Constructs a filename in the form
@file{@var{original_filename}-@var{staff_instrument_name}.notes} if the
staff has an instrument name.  If the staff has no instrument
name, it uses unnamed-staff for that part of the filename.
   (let* ((inst-name (ly:context-property context 'instrumentName)))
 (string-concatenate (list
  (substring (object-string (command-line))
   ;; filename without .ly part
   (+ (string-rindex (object-string (command-line)) #\sp) 2)
   (- (string-length (object-string (command-line))) 5))
  -
  (if (string? inst-name)
  inst-name
unnamed-staff)
  .notes

#(define (format-moment moment)
   (exact-inexact
(/ (ly:moment-main-numerator moment)
   (ly:moment-main-denominator moment

#(define (moment-grace-string moment)
   Prints a moment without grace note(s) as a float such as
0.25000.  Grace notes are written with the grace duration as a
separate \dashed\ number, i.e. 0.25000-0.12500.  This allows any
program using the output of this function to interpret grace notes
however they want (half duration, quarter duration?  before beat,
after beat?  etc.).
   (if
   (eq? 0 (ly:moment-grace-numerator moment))
   (ly:format ~a (format-moment moment))
   ;; grace notes have a negative numerator, so no - necessary
   (ly:format
 ~a~a
 (format-moment moment)
 (format-moment
   (ly:make-moment
(ly:moment-grace-numerator moment)
(ly:moment-grace-denominator moment))

#(define 

Re: extending event-listener.ly

2013-03-27 Thread luis jure

on 2013-03-27 at 18:35 Phil Hézaine wrote:

 @ Luis
 In MY OWN  PERSONAL...etc... I have added a context for a DrumVoice 
 which was absent.

wonderful, phil, it works to perfection now. a million thanks!

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


Re: extending event-listener.ly

2013-03-27 Thread Graham Percival
On Wed, Mar 27, 2013 at 08:21:53AM -0300, luis jure wrote:
 
 on 2013-03-26 at 16:04 Graham Percival wrote:
 
  I'm quite curious about this -- do drum events not have
  point-and-click info?
 
 BTW, i was quite curious myself about why the point-and-clik info was
 included in the first place. i thought it was only useful for pdf files.
 is this information used by your virtual violinist?

Yes, for the interactive training, I display the pdf, and when
users click on a note it displays information about that note (and
plays it audibly).  That allows users to identify mistakes, which
are then used to retrain the virtual violinist so that she
(hopefully) doesn't make that mistake again.

When running the virtual violinist in command-line mode, it's true
that point-and-click is not used for anything.

- Graham

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


Re: extending event-listener.ly

2013-03-26 Thread Phil Hézaine

Le 26/03/2013 02:29, Graham Percival a écrit :

On Mon, Mar 25, 2013 at 10:05:28PM +0100, Phil Hézaine wrote:

Le 25/03/2013 17:29, Graham Percival a écrit :

To add \parenthesize, you need to create a similar function or
extend that original one to deal with those events.  To see the
events, try:

\displayMusic { c'4 \parenthesize d' e }


Today, after the same discovery I was wondering the same question
than Luis but for drum-types (in \drummode, ie: sna, wbl... )
N.R. says: Not all lilypond music events are supported by
‘event-listener.ly’.
Is it possible to 'listen' the drums symbols?


I think the above hint should suffice.

- Graham


You're right. Though it was not evident at starting it was not so 
difficult to solve the problem. Thanks for your clarification.

I paste for Luis and others my solution.

for NoteEvent:

#(define (format-note engraver event)
   (let* ((origin (ly:input-file-line-char-column
   (ly:event-property event 'origin
 (print-line engraver
 note
 ;; get a MIDI pitch value.
 ;(+ 60 (ly:pitch-semitones
(ly:event-property event 'drum-type) ;))
 (ly:duration-string
  (ly:event-property event 'duration))
 (format-moment (ly:duration-length
 (ly:event-property event 'duration)))
 ;; point and click info
 ;(ly:format point-and-click ~a ~a
 ;   (caddr origin)
 ;   (cadr origin))
)))

For EventChord:

#(define (format-note engraver event-chord)
   (let* ((origin (ly:input-file-line-char-column
   (ly:event-property event-chord 'origin
 (print-line engraver
 note
 ;; get a MIDI pitch value.
 ;(+ 60 (ly:pitch-semitones
(ly:event-property event-chord 'drum-type) ;))
 (ly:duration-string
  (ly:event-property event-chord 'duration))
 (format-moment (ly:duration-length
 (ly:event-property event-chord 
'duration)))

 ;; point and click info
 ;(ly:format point-and-click ~a ~a
 ;   (caddr origin)
 ;   (cadr origin))
)))

then far below in the file:

#(define (format-dynamic engraver event-chord)
   (print-line engraver
   dynamic
   (ly:event-property event-chord 'text)
   ))

and finally at the bottom:
   (dynamic-event-chord . format-dynamic)


All is working, however I have an issue with the *non-orthodox* syntax I 
used for Le Puzzle du Batteur - The Drummer's 'G'igsaw.

example: bd_\ff toml_\p2
With 2.12 and 2.14 all was right. The dynamics inside a chord was 
recognized. At present time lilypond doesn't make a difference beetween 
the first and the second dynamics.

I checked out the midi with midicomp.
I have tried a ugly workaround which gives a uglier layout:
   bd2_\ff toml_\p
Lilypond says:
Avertissement : Deux événements absolute-dynamic simultanés, rejet de 
celui-ci

bd2_\ff toml
  _\p sna2_\p |
Avertissement : Événement absolute-dynamic précédent ici
bd2
 _\ff toml_\p sna2_\p |

But with the event-listener I get:
0.  notebassdrum2   0.5000
0.  dynamic ff
0.  notelowtom  2   0.5000
0.  dynamic p

Very interesting for me because the 'G'igsaw is sadly dead.
Is there a proper solution with these *non-orthodox* syntaxs apart from 
the event-listener?


Phil.

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


Re: extending event-listener.ly

2013-03-26 Thread Graham Percival
On Tue, Mar 26, 2013 at 08:12:42PM +0100, Phil Hézaine wrote:
 for NoteEvent:
 
 #(define (format-note engraver event)
(let* ((origin (ly:input-file-line-char-column
(ly:event-property event 'origin
  (print-line engraver
  note
  ;; get a MIDI pitch value.
  ;(+ 60 (ly:pitch-semitones
 (ly:event-property event 'drum-type) ;))

It would be nice if this was abstracted into a separate function:
  (get-pitch-or-drum
which would pick which type of output to produce.  Then I think we
could accept a patch to this effect without much fuss.

  ;; point and click info
  ;(ly:format point-and-click ~a ~a
  ;   (caddr origin)
  ;   (cadr origin))

I'm quite curious about this -- do drum events not have
point-and-click info?

- Graham

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


Re: extending event-listener.ly

2013-03-26 Thread luis jure

on 2013-03-26 at 20:12 Phil Hézaine wrote:

 You're right. Though it was not evident at starting it was not so 
 difficult to solve the problem. Thanks for your clarification.
 I paste for Luis and others my solution.


this is great, phil, thank you.

i must be missing something, though, because i get output only if use
\drummode inside a regular Staff or a RhythmicStaff, but no output when
using a DrumStaff. any ideas why? the output of \displayMusic is the same
in all cases.

i'm also getting a series of warnings (4) of the form:

Unsupported SCM value for format: ()

perhaps i misunderstood how to insert your code in the event-listener.ly
file?


best,


lj

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


extending event-listener.ly

2013-03-25 Thread luis jure

hello list,

i have just discovered that you can save music events to a file with
event-listener.ly. this is an incredible feature for what i'm trying to
do, that is generate csound scores from lilypond files. i managed to do
that from the midi file generated by lilypond, using a very simple python
program. but much information is lost. using the text file generated by
event-listener would be much better, since i could manage dynamics and
articulations.

i'm only beginning to explore its possibilities, but one event i miss is
\parenthesize. the manual says:

If some events that you want to see are not included, copy
‘event-listener.ly’ into your lilypond directory and modify the file so
that it outputs the information you want.

i looked at event-listener.ly, but i'm afraid it's way over my head. i can
hardly manage some basic python, for me scheme is undecipherable. 

could anyone give me a hint how to modify event-listener.ly to recognize
parenthesized notes?

any help would be greatly appreciated.

best,

lj

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


Re: extending event-listener.ly

2013-03-25 Thread Graham Percival
On Mon, Mar 25, 2013 at 08:58:09AM -0300, luis jure wrote:
 i looked at event-listener.ly, but i'm afraid it's way over my head. i can
 hardly manage some basic python, for me scheme is undecipherable. 
 
 could anyone give me a hint how to modify event-listener.ly to recognize
 parenthesized notes?

Unfortunately you'll need some scheme knowledge, but if you can
get the general idea of the below function then you should be
fine:

#(define (format-note engraver event)
   (let* ((origin (ly:input-file-line-char-column
   (ly:event-property event 'origin
 (print-line engraver
 note
 ;; get a MIDI pitch value.
 (+ 60 (ly:pitch-semitones
(ly:event-property event 'pitch)))
 (ly:duration-string
  (ly:event-property event 'duration))
 (format-moment (ly:duration-length
 (ly:event-property event
'duration)))
 ;; point and click info
 (ly:format point-and-click ~a ~a
(caddr origin)
(cadr origin)

The important bit is the (print-line ...) function.  It has a
number of arguments:
  - engraver
  - note
  - a MIDI pitch value
  - a duration (like 4.)
  - a duration (like 1.25)
  - point-and-click info

To add \parenthesize, you need to create a similar function or
extend that original one to deal with those events.  To see the
events, try:

\displayMusic { c'4 \parenthesize d' e }

oh, it looks like \parenthesize is an option to a note, rather
than a separate event:
...
(make-music
  'NoteEvent
  'parenthesize
  #t
  'duration
  (ly:make-duration 2 0 1)
  'pitch
  (ly:make-pitch 0 1 0))
...


In that case, you need to add another argument to the
(print-line...) function to indicate whether the note is
parenthesized or not.  That requires a bunch more scheme, but this
should be enough hints for you to start reading the lilypond
scheme tutorial and the Extending manual.

A simple binary field would be enough for your personal use, but
it would be nice to have a more general approach in case people
want to add more options for notes.  Don't worry about this
general approach (required for accepted patches into mainstream
lilypond) right now; first just get the basics working for your
particular purpose.

- Graham

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


Re: extending event-listener.ly

2013-03-25 Thread luis jure

on 2013-03-25 at 09:29 Graham Percival wrote:

 Unfortunately you'll need some scheme knowledge, but if you can
 get the general idea of the below function then you should be
 fine:

thanks for the thorough explanation, graham, you just ruined my easter
holidays... ;-)

first i need to finish hacking my python code to get a nice csound score
from the event-listener.ly output as is, and then i'll try to tackle this
other problem. it might take some time, but i didn't have anything to do
in easter anyway...

best,


lj

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


Re: extending event-listener.ly

2013-03-25 Thread Phil Hézaine

Le 25/03/2013 17:29, Graham Percival a écrit :

On Mon, Mar 25, 2013 at 08:58:09AM -0300, luis jure wrote:

i looked at event-listener.ly, but i'm afraid it's way over my head. i can
hardly manage some basic python, for me scheme is undecipherable.

could anyone give me a hint how to modify event-listener.ly to recognize
parenthesized notes?


Unfortunately you'll need some scheme knowledge, but if you can
get the general idea of the below function then you should be
fine:

#(define (format-note engraver event)
(let* ((origin (ly:input-file-line-char-column
(ly:event-property event 'origin
  (print-line engraver
  note
  ;; get a MIDI pitch value.
  (+ 60 (ly:pitch-semitones
 (ly:event-property event 'pitch)))
  (ly:duration-string
   (ly:event-property event 'duration))
  (format-moment (ly:duration-length
  (ly:event-property event
'duration)))
  ;; point and click info
  (ly:format point-and-click ~a ~a
 (caddr origin)
 (cadr origin)

The important bit is the (print-line ...) function.  It has a
number of arguments:
   - engraver
   - note
   - a MIDI pitch value
   - a duration (like 4.)
   - a duration (like 1.25)
   - point-and-click info

To add \parenthesize, you need to create a similar function or
extend that original one to deal with those events.  To see the
events, try:

\displayMusic { c'4 \parenthesize d' e }

oh, it looks like \parenthesize is an option to a note, rather
than a separate event:
...
 (make-music
   'NoteEvent
   'parenthesize
   #t
   'duration
   (ly:make-duration 2 0 1)
   'pitch
   (ly:make-pitch 0 1 0))
...


In that case, you need to add another argument to the
(print-line...) function to indicate whether the note is
parenthesized or not.  That requires a bunch more scheme, but this
should be enough hints for you to start reading the lilypond
scheme tutorial and the Extending manual.

A simple binary field would be enough for your personal use, but
it would be nice to have a more general approach in case people
want to add more options for notes.  Don't worry about this
general approach (required for accepted patches into mainstream
lilypond) right now; first just get the basics working for your
particular purpose.

- Graham



Hi,
Today, after the same discovery I was wondering the same question than 
Luis but for drum-types (in \drummode, ie: sna, wbl... )
N.R. says: Not all lilypond music events are supported by 
‘event-listener.ly’.

Is it possible to 'listen' the drums symbols?
Any hints will be appreciated.
Phil.

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


Re: extending event-listener.ly

2013-03-25 Thread luis jure

on 2013-03-25 at 22:05 Phil Hézaine wrote:

 Today, after the same discovery I was wondering the same question than 
 Luis but for drum-types (in \drummode, ie: sna, wbl... )

funny, i was intending to use it for a drumstaff also...


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


Re: extending event-listener.ly

2013-03-25 Thread Graham Percival
On Mon, Mar 25, 2013 at 10:05:28PM +0100, Phil Hézaine wrote:
 Le 25/03/2013 17:29, Graham Percival a écrit :
 To add \parenthesize, you need to create a similar function or
 extend that original one to deal with those events.  To see the
 events, try:
 
 \displayMusic { c'4 \parenthesize d' e }

 Today, after the same discovery I was wondering the same question
 than Luis but for drum-types (in \drummode, ie: sna, wbl... )
 N.R. says: Not all lilypond music events are supported by
 ‘event-listener.ly’.
 Is it possible to 'listen' the drums symbols?

I think the above hint should suffice.

- Graham

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