Re: Extract notes from chords, with silence when there are none

2015-09-17 Thread Gilles THIBAULT
> Wrap the whole expression in event-chord-wrap! before handling it.  The
> LSR issue is probably from before issue 2240 changed the representation
> of single notes.
> 
No, it is because "chord.ly" deals only with chords and keeps notes unchanged. 
But yes, event-chord-wrap! is a quick way here to avoid to change all the 
code...

So Chris, the last change you have to make in the code is to change 

line 73 (in \extractNote definition)
(extract-note music n))

by

(extract-note (event-chord-wrap! music) n))

You'll get a { r2 r2 } in Staff 2 and 3 of the snippet.
Well, no very beautiful for a score but will be perfect for Midi.
 
-- 
Gilles

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


Re: Extract notes from chords, with silence when there are none

2015-09-17 Thread mskala
On Thu, 17 Sep 2015, Gilles THIBAULT wrote:
> So Chris, the last change you have to make in the code is to change
>
> line 73 (in \extractNote definition)
> (extract-note music n))
>
> by
>
> (extract-note (event-chord-wrap! music) n))

Assuming you mean me...

I just found a message I thought I'd already sent, in my "postponed
drafts" folder.  Most likely I started to write it, then saw more mail
coming in on this thread, stopped to read that in case it could answer my
problem, and never got back to the original message.  That message is now
obsolete, but in it I described how making your first change just resulted
in the error message "fatal error: cannot find music object: RestEvent
'duration".

Now, I made your second change and continued getting the "fatal error:
cannot find music object: RestEvent 'duration" message.  Then I tried
downloading the file and making the change again, exactly as before, and
got different error messages.  I ran a diff on the files and got this
(as part of longer output)...

40c40
< (make-music 'RestEvent 'duration (ly:music-property note 
'duration
---
> (make-music 'RestEvent 'duration (ly:music-property note 
> 'duration

...which is utterly bizarre!  Apparently the same identical line of code,
reported by diff as being different.

However, that was a clue.  After some digging around with hex dump, it
appears that the issue is when I copied and pasted from your message into
the file the first time, some invisible HTML-related garbage (namely, 0xA0
characters) was copied too.  Those characters *look* like spaces, but
LilyPond neither recognizes them as such nor reports them as errors.  It
just produces an incorrect parse.  Probably, the same issue is what causes
all your messages to appear double-spaced on my screen, making them hard
to read.

I wish people would stop using HTML for email.

Anyway, with the second change and the removal of the HTML garbage, the
script seems to do what I was hoping for.  Thanks!

-- 
Matthew Skala
msk...@ansuz.sooke.bc.ca People before principles.
http://ansuz.sooke.bc.ca/

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


Extract notes from chords, with silence when there are none

2015-09-16 Thread mskala
I'd like to take a passage of music that contains chords with differing
numbers of notes, and some single notes, and extract it into separate
monophonic streams such that their union is the original passage.  The
application is to generate microtonal MIDI using pitch bend, which can
only practically play one note per channel, from music entered as
polyphonic voices for typesetting convenience.

I'm aware of the snippet at
   http://lsr.di.unimi.it/LSR/Item?id=545

and it does almost what I want, except for the handling of missing notes.
If I specify an index greater than the number of notes playing at a given
moment, then this code returns the highest-numbered note that exists.  I
don't understand why anyone would want that behaviour, but that's what the
code does.  I want to have rests, not duplicated notes, in the remaining
voices when there are fewer notes playing than the number of voices.

Is there any simple, obvious way to modify the code to do this?  I can
probably get it to work with enough trial and error, but it's not clear to
me where in the code it is actually handling the case of index greater
than the number of notes, so I'm not sure what to try modifying first.

-- 
Matthew Skala
msk...@ansuz.sooke.bc.ca People before principles.
http://ansuz.sooke.bc.ca/

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


Re: Extract notes from chords, with silence when there are none

2015-09-16 Thread Chris Yate
Just to clarify, in the case of 3-voice music, how would you expect it to
deal with a 2 note chord?

One note to Treble, one to Bass, or one in Treble, one in Alto, or... what?

Chris

On 16 September 2015 at 13:07,  wrote:

> I'd like to take a passage of music that contains chords with differing
> numbers of notes, and some single notes, and extract it into separate
> monophonic streams such that their union is the original passage.  The
> application is to generate microtonal MIDI using pitch bend, which can
> only practically play one note per channel, from music entered as
> polyphonic voices for typesetting convenience.
>
> I'm aware of the snippet at
>http://lsr.di.unimi.it/LSR/Item?id=545
>
> and it does almost what I want, except for the handling of missing notes.
> If I specify an index greater than the number of notes playing at a given
> moment, then this code returns the highest-numbered note that exists.  I
> don't understand why anyone would want that behaviour, but that's what the
> code does.  I want to have rests, not duplicated notes, in the remaining
> voices when there are fewer notes playing than the number of voices.
>
> Is there any simple, obvious way to modify the code to do this?  I can
> probably get it to work with enough trial and error, but it's not clear to
> me where in the code it is actually handling the case of index greater
> than the number of notes, so I'm not sure what to try modifying first.
>
> --
> Matthew Skala
> msk...@ansuz.sooke.bc.ca People before principles.
> http://ansuz.sooke.bc.ca/
>
> ___
> 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: Extract notes from chords, with silence when there are none

2015-09-16 Thread David Kastrup
Chris Yate  writes:

> Just to clarify, in the case of 3-voice music, how would you expect it to
> deal with a 2 note chord?
>
> One note to Treble, one to Bass, or one in Treble, one in Alto, or... what?

As I read him, he does not care.  First note anywhere, second note
anywhere else, skip in the remaining expression.  This is for midi.

-- 
David Kastrup

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


Re: Extract notes from chords, with silence when there are none

2015-09-16 Thread mskala
On Wed, 16 Sep 2015, David Kastrup wrote:
> > Just to clarify, in the case of 3-voice music, how would you expect it to
> > deal with a 2 note chord?
> >
> > One note to Treble, one to Bass, or one in Treble, one in Alto, or... what?
>
> As I read him, he does not care.  First note anywhere, second note
> anywhere else, skip in the remaining expression.  This is for midi.

That's right.  I just want any two notes that play simultaneously to be
returned by separate index values into the extraction function, and any
other index values to return something that will be silent (either a skip
or a rest).  The typesetting of human-readable score will be from the
original single polyphonic voice; the splitting is only for MIDI, only to
separate the pitch-bend data for different notes, and the split channels
will be played using identical settings, so the exact assignment of notes
to index values (channels) can be arbitrary.

I would expect that the easiest way to do the note assignment would be
what I described in my initial message - change the "extract" script to
return silence instead of the last note in the data structure, when the
index is greater than the number of notes.  Then with two simultaneous
notes they will be returned by index values 1 and 2, and silence returned
by index 3.

I don't need to deal with cases like << { d''1 } { c'2 c'2 } >>, because
the input really is a single polyphonic voice.  Notes will all start and
stop together, only the number of notes changes.

FWIW, I'm aware of the script at http://x31eq.com/lilypond/, which
attempts to do better microtonality with LilyPond and MIDI Tuning Standard
messages, but it's not suitable for my needs because I'm sending the data
to a very simple MIDI device that doesn't understand MTS, only pitch bend.
(And I think it would require separating the notes into channels first
anyway.)

-- 
Matthew Skala
msk...@ansuz.sooke.bc.ca People before principles.
http://ansuz.sooke.bc.ca/

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


Re: Extract notes from chords, with silence when there are none

2015-09-16 Thread Thomas Morley
2015-09-16 17:20 GMT+02:00  :
> On Wed, 16 Sep 2015, David Kastrup wrote:
>> > Just to clarify, in the case of 3-voice music, how would you expect it to
>> > deal with a 2 note chord?
>> >
>> > One note to Treble, one to Bass, or one in Treble, one in Alto, or... what?
>>
>> As I read him, he does not care.  First note anywhere, second note
>> anywhere else, skip in the remaining expression.  This is for midi.
>
> That's right.  I just want any two notes that play simultaneously to be
> returned by separate index values into the extraction function, and any
> other index values to return something that will be silent (either a skip
> or a rest).  The typesetting of human-readable score will be from the
> original single polyphonic voice; the splitting is only for MIDI, only to
> separate the pitch-bend data for different notes, and the split channels
> will be played using identical settings, so the exact assignment of notes
> to index values (channels) can be arbitrary.
>
> I would expect that the easiest way to do the note assignment would be
> what I described in my initial message - change the "extract" script to
> return silence instead of the last note in the data structure, when the
> index is greater than the number of notes.  Then with two simultaneous
> notes they will be returned by index values 1 and 2, and silence returned
> by index 3.
>
> I don't need to deal with cases like << { d''1 } { c'2 c'2 } >>, because
> the input really is a single polyphonic voice.  Notes will all start and
> stop together, only the number of notes changes.
>
> FWIW, I'm aware of the script at http://x31eq.com/lilypond/, which
> attempts to do better microtonality with LilyPond and MIDI Tuning Standard
> messages, but it's not suitable for my needs because I'm sending the data
> to a very simple MIDI device that doesn't understand MTS, only pitch bend.
> (And I think it would require separating the notes into channels first
> anyway.)
>
> --
> Matthew Skala
> msk...@ansuz.sooke.bc.ca People before principles.
> http://ansuz.sooke.bc.ca/
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user

Is my recent coding here:
http://www.lilypondforum.de/index.php?topic=2080.msg11479#msg11479
of any help?

You probably will not understand the german text, thus: I express my
concerns that it will return warnings, if spanners like Ties, Slurs
etc are in the game.


HTH,
  Harm

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


REĀ : Extract notes from chords, with silence when there are none

2015-09-16 Thread Gilles Thibault


ProvenanceĀ : Courrier pour Windows 10




> That's right.  I just want any two notes that play simultaneously to be
> returned by separate index values into the extraction function, and any
> other index values to return something that will be silent (either a skip
> or a rest).  

I don't want this behaviour for my purpose but if you do want a rest for 
indexes out of range, you just have one line to change in the code.

First make sur you have the latest version of chord.ly at
http://gillesth.free.fr/Lilypond/chord/

Change the line 39
  ((null? res) (list-ref notes (1- len))) ; last note

by that

((null? res) 
   (let ((note (list-ref notes (1- len ; last note
(make-music 'RestEvent
'duration (ly:music-property note 
'duration

You'll get the joined image
( to compare with snippet
http://lsr.di.unimi.it/LSR/Item?id=545)






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


Re: Extract notes from chords, with silence when there are none

2015-09-16 Thread mskala
On Thu, 17 Sep 2015, msk...@ansuz.sooke.bc.ca wrote:
> On my first few attempt to load this page the server didn't respond, but
> it seems to work now, and yes, that looks like it does what I want.

I spoke too soon:  the code doesn't handle single notes (non-chords), so
it's not a complete solution.  But maybe I can further modify it.

-- 
Matthew Skala
msk...@ansuz.sooke.bc.ca People before principles.
http://ansuz.sooke.bc.ca/

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


Re: Extract notes from chords, with silence when there are none

2015-09-16 Thread mskala
On Wed, 16 Sep 2015, Thomas Morley wrote:
> Is my recent coding here:
> http://www.lilypondforum.de/index.php?topic=2080.msg11479#msg11479
> of any help?

On my first few attempt to load this page the server didn't respond, but
it seems to work now, and yes, that looks like it does what I want.
Thanks!

-- 
Matthew Skala
msk...@ansuz.sooke.bc.ca People before principles.
http://ansuz.sooke.bc.ca/

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


Re: Extract notes from chords, with silence when there are none

2015-09-16 Thread David Kastrup
msk...@ansuz.sooke.bc.ca writes:

> On Thu, 17 Sep 2015, msk...@ansuz.sooke.bc.ca wrote:
>> On my first few attempt to load this page the server didn't respond, but
>> it seems to work now, and yes, that looks like it does what I want.
>
> I spoke too soon:  the code doesn't handle single notes (non-chords), so
> it's not a complete solution.  But maybe I can further modify it.

Wrap the whole expression in event-chord-wrap! before handling it.  The
LSR issue is probably from before issue 2240 changed the representation
of single notes.

-- 
David Kastrup

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