Re: vim-transpose

2024-06-18 Thread Kenneth Flak
Hi,

Getting the same error here. The first one is easy enough to fix, just have to 
set g:LilypondLanguage = "nederlands" in your .vimrc. The rest is more 
complicated. I would open an issue in the repo if I were you. First of all the 
plugin is not following the conventions for a plugin, so it won't load when 
opening a lilypond-file. Secondly the language should have a default value. 
This is not set. Thirdly the errors that you're getting. There's been nothing 
happening in the repo for 4 years, though, so I wouldn't hold my breath...

Best,
Kenneth


Stefan Thomas, Jun 18, 2024 at 16:00:
> Unfortunately, it doesn't work:
> Error detected while processing function Transpose:
> line 16:
> E121: Undefined variable: g:LilypondLanguage
> line 23:
> E488: Trailing characters: # Default: nederlands: ^Ielse # Default:
> nederlands
> line 36:
> E121: Undefined variable: notenames
> E116: Invalid arguments for function len(notenames))
> E116: Invalid arguments for function range(len(notenames))
>
> Am Di., 18. Juni 2024 um 12:06 Uhr schrieb Kenneth Flak <[1]
> kennethf...@protonmail.com>:
>
>
> Yes, that should work, provided the included function works as
> advertised.
>
> Best,
> Kenneth
>
> Roosna & Flak
> Contemporary Dance & Music
> [2]https://roosnaflak.com
>
>
>
>  Original Message 
> On 6/18/24 12:16, Stefan Thomas wrote:
>
> Dear Kenneth,
> thanks for Your reply.
> I already have a file lilypond.vim in ~/.vim/ftplugin/. Could I paste
> the content of Transpose.vim into that file?
>
> Am Di., 18. Juni 2024 um 10:09 Uhr schrieb Kenneth Flak <[3]
> kennethf...@protonmail.com>:
>
> Hi,
>
> The plugin is missing some vital parts, but you should be able to
> get it working by renaming Transpose.vim to lilypond.vim and moving
> it into the after/ftplugin folder of your (n)vim configuration.
> Haven't tested it yet, though...
>
> Best,
> Kenneth
>
> Stefan Thomas, Jun 18, 2024 at 09:35:
> > Dear community,
> > has anyone of You successfully installed LilyVimTranspose?
> > See [1][4]https://github.com/gustaphe/LilyVimTranspose
> >
> > References:
> >
> > [1] [5]https://github.com/gustaphe/LilyVimTranspose
>
>
>
>
>
> References:
>
> [1] mailto:kennethf...@protonmail.com
> [2] https://roosnaflak.com/
> [3] mailto:kennethf...@protonmail.com
> [4] https://github.com/gustaphe/LilyVimTranspose
> [5] https://github.com/gustaphe/LilyVimTranspose






Re: vim-transpose

2024-06-18 Thread Kenneth Flak
Yes, that should work, provided the included function works as advertised.

Best,
Kenneth

Roosna & Flak
Contemporary Dance & Music
https://roosnaflak.com

 Original Message 
On 6/18/24 12:16, Stefan Thomas  wrote:

> Dear Kenneth,
> thanks for Your reply.
> I already have a file lilypond.vim in ~/.vim/ftplugin/. Could I paste the 
> content of Transpose.vim into that file?
>
> Am Di., 18. Juni 2024 um 10:09 Uhr schrieb Kenneth Flak 
> :
>
>> Hi,
>>
>> The plugin is missing some vital parts, but you should be able to get it 
>> working by renaming Transpose.vim to lilypond.vim and moving it into the 
>> after/ftplugin folder of your (n)vim configuration. Haven't tested it yet, 
>> though...
>>
>> Best,
>> Kenneth
>>
>> Stefan Thomas, Jun 18, 2024 at 09:35:
>>> Dear community,
>>> has anyone of You successfully installed LilyVimTranspose?
>>> See [1]https://github.com/gustaphe/LilyVimTranspose
>>>
>>> References:
>>>
>>> [1] https://github.com/gustaphe/LilyVimTranspose

Re: vim-transpose

2024-06-18 Thread Stefan Thomas
Dear Kenneth,
thanks for Your reply.
I  already have a file lilypond.vim in ~/.vim/ftplugin/. Could I paste the
content of Transpose.vim into that file?

Am Di., 18. Juni 2024 um 10:09 Uhr schrieb Kenneth Flak <
kennethf...@protonmail.com>:

> Hi,
>
> The plugin is missing some vital parts, but you should be able to get it
> working by renaming Transpose.vim to lilypond.vim and moving it into the
> after/ftplugin folder of your (n)vim configuration. Haven't tested it yet,
> though...
>
> Best,
> Kenneth
>
> Stefan Thomas, Jun 18, 2024 at 09:35:
> > Dear community,
> > has anyone of You successfully installed LilyVimTranspose?
> > See [1]https://github.com/gustaphe/LilyVimTranspose
> >
> > References:
> >
> > [1] https://github.com/gustaphe/LilyVimTranspose
>
>
>
>


Re: vim-transpose

2024-06-18 Thread Kenneth Flak
Hi,

The plugin is missing some vital parts, but you should be able to get it 
working by renaming Transpose.vim to lilypond.vim and moving it into the 
after/ftplugin folder of your (n)vim configuration. Haven't tested it yet, 
though...

Best,
Kenneth

Stefan Thomas, Jun 18, 2024 at 09:35:
> Dear community,
> has anyone of You successfully installed LilyVimTranspose?
> See [1]https://github.com/gustaphe/LilyVimTranspose
>
> References:
>
> [1] https://github.com/gustaphe/LilyVimTranspose






vim-transpose

2024-06-18 Thread Stefan Thomas
Dear community,
has anyone of You successfully installed LilyVimTranspose?
See https://github.com/gustaphe/LilyVimTranspose


Re: How to transpose?

2024-05-27 Thread Wols Lists

On 25/05/2024 18:44, bobr...@centrum.is wrote:

Wol,

The bit about trombones in bass and Bb treble; I've only ever heard of 
Bb treble clef trombone in British brass band music.  What is the 
"American bass part" in Bb?  I've never heard of such a thing.  I know 
that Richard Strauß wrote tenor tuba parts in Bb bass clef.


I only remember me hitting it with one piece, but I got the vibes (on 
this list, iirc) that that this may be rare but certainly not unheard of.


This piece was printed with NO KEY SIGNATURE, and a bass clef part that 
had been transposed. Boy did it cause hell until we realised what was 
going on!!!


Cheers,
Wol



Re: How to transpose?

2024-05-25 Thread bobr...@centrum.is
Wol, 

The bit about trombones in bass and Bb treble; I've only ever heard of Bb 
treble clef trombone in British brass band music. What is the "American bass 
part" in Bb? I've never heard of such a thing. I know that Richard Strauß wrote 
tenor tuba parts in Bb bass clef. 

-David 

> From: "Wols Lists" 
> To: "Lillypond Users Mailing List" 
> Sent: Friday, May 24, 2024 3:28:16 PM
> Subject: Re: How to transpose?

> On 23/05/2024 12:26, Kenneth Flak wrote:
> > Great, thanks to both of you! Very clarifying. \transposition is, thus,
> > going in the direction of instrument -> playback, whereas \transpose
> > goes in the opposite direction, if I understand it correctly.

> I do a lot of brass stuff. And as you've realised, it's \transpose not
> \transposition.

> I just think "\transpose for printed music, \transposition for midi".
> How accurate that is I don't know.

> The other trick I always use (given that a trombone plays both bass clef
> in C, and treble clef in Bb, and worse when you get an American bass
> part in Bb ?!?!?!), is I transpose on input as well as output.

> When copying a part IN to lilypond, I'll wrap it in "\transpose c c" or
> "\transpose bf c'" depending on whether it's a bass or treble part. So I
> know all my music fragments in lilypond are in C.

> Then I'll wrap them the other way on output to put them in the correct
> printed pitch. That way I never have to transpose in my head to make
> sure things are correct.

> Cheers,
> Wol


Re: How to transpose?

2024-05-25 Thread Kenneth Flak
Wols Lists, May 24, 2024 at 18:28:
> I do a lot of brass stuff. And as you've realised, it's \transpose not
> \transposition.
>
> I just think "\transpose for printed music, \transposition for midi".
> How accurate that is I don't know.
>
> The other trick I always use (given that a trombone plays both bass clef
> in C, and treble clef in Bb, and worse when you get an American bass
> part in Bb ?!?!?!), is I transpose on input as well as output.
>
> When copying a part IN to lilypond, I'll wrap it in "\transpose c c" or
> "\transpose bf c'" depending on whether it's a bass or treble part. So I
> know all my music fragments in lilypond are in C.
>
> Then I'll wrap them the other way on output to put them in the correct
> printed pitch. That way I never have to transpose in my head to make
> sure things are correct.
>
> Cheers,
> Wol

Sounds like a very good workflow! Will adopt this if/when I ever
get into a similar situation. I play trumpet myself, but I hardly ever
have to write for it :-) However, things can rapidly change...

Best,
Kenneth







Re: How to transpose?

2024-05-24 Thread Wols Lists

On 23/05/2024 12:26, Kenneth Flak wrote:

Great, thanks to both of you! Very clarifying. \transposition is, thus,
going in the direction of instrument -> playback, whereas \transpose
goes in the opposite direction, if I understand it correctly.


I do a lot of brass stuff. And as you've realised, it's \transpose not 
\transposition.


I just think "\transpose for printed music, \transposition for midi". 
How accurate that is I don't know.


The other trick I always use (given that a trombone plays both bass clef 
in C, and treble clef in Bb, and worse when you get an American bass 
part in Bb ?!?!?!), is I transpose on input as well as output.


When copying a part IN to lilypond, I'll wrap it in "\transpose c c" or 
"\transpose bf c'" depending on whether it's a bass or treble part. So I 
know all my music fragments in lilypond are in C.


Then I'll wrap them the other way on output to put them in the correct 
printed pitch. That way I never have to transpose in my head to make 
sure things are correct.


Cheers,
Wol



Re: How to transpose?

2024-05-23 Thread David Kastrup
Kenneth Flak  writes:

> Great, thanks to both of you! Very clarifying. \transposition is, thus,
> going in the direction of instrument -> playback,

More like display pitch -> concert pitch.

> whereas \transpose goes in the opposite direction, if I understand it
> correctly.

\transpose changes the display pitch.  It does not touch the relation
between display pitch and concert pitch.

So if you want to change the relation between display pitch and
instrument pitch after already having declared a \transposition, you get
into kind of a bind.

-- 
David Kastrup



Re: How to transpose?

2024-05-23 Thread Kenneth Flak
Timothy Lanfear, May 23, 2024 at 13:19:
> If you already have the music written in concert pitch, use the
> transpose
> function to change displayed pitch.
>
> \transpose bes, c { \clef treble \key c\major g' }
>
> If your brass players prefer not to have a key signature, omit the \key
> statement.
>
> On 23/05/2024 11:10, [1]bobr...@centrum.is wrote:
>
> Kenneth,
>
> If you look here:
> [2]https://lilypond.org/doc/v2.24/Documentation/notation/
> displaying-pitches#instrument-transpositions
>
> You will see that '\transposition' tells the MIDI and cue functions
> what's
> going on so that MIDI output and cues in other instruments are correct.
> It
> is still necessary to enter the notes at displayed pitch as shown in the
> example.
>
> -David
>

Great, thanks to both of you! Very clarifying. \transposition is, thus,
going in the direction of instrument -> playback, whereas \transpose
goes in the opposite direction, if I understand it correctly.

Best,
Kenneth




Re: How to transpose?

2024-05-23 Thread Timothy Lanfear
If you already have the music written in concert pitch, use the 
transpose function to change displayed pitch.


\transpose bes, c { \clef treble \key c\major g' }

If your brass players prefer not to have a key signature, omit the \key 
statement.


On 23/05/2024 11:10, bobr...@centrum.is wrote:

Kenneth,

If you look here: 
https://lilypond.org/doc/v2.24/Documentation/notation/displaying-pitches#instrument-transpositions


You will see that  '\transposition' tells the MIDI and cue functions 
what's going on so that MIDI output and cues in other instruments are 
correct.  It is still necessary to enter the notes at displayed pitch 
as shown in the example.


-David



*From: *"Kenneth Flak" 
*To: *"Lillypond Users Mailing List" 
*Sent: *Thursday, May 23, 2024 6:55:45 AM
    *Subject: *How to transpose?

Hi,

Trying my hands on transposing from concert pitch to Trumpet in Bf
and french horn in F, but the displayed notes are still in concert
pitch... How do I make these display the notes I would like the
players to see?


    \new Staff = "trumpet" \with {
      instrumentName = "Trp"
    }
    {
      \clef treble
      \key c \major
      \transposition bf
      g'
    }
    \new Staff = "french horn" \with {
      instrumentName = "Horn"
    }{
      \clef treble
      \key c \major
      \transposition f
      cs'
    }

Best,
Kenneth

-- 
Roosna & Flak - Contemporary Dance & Music

Web: roosnaflak.com
Code: {github,gitlab}.com/kflak
Mastodon: @k...@sonomu.club


--
Timothy Lanfear, Bristol, UK.


Re: How to transpose?

2024-05-23 Thread bobr...@centrum.is
Kenneth, 

If you look here: [ 
https://lilypond.org/doc/v2.24/Documentation/notation/displaying-pitches#instrument-transpositions
 | 
https://lilypond.org/doc/v2.24/Documentation/notation/displaying-pitches#instrument-transpositions
 ] 

You will see that '\transposition' tells the MIDI and cue functions what's 
going on so that MIDI output and cues in other instruments are correct. It is 
still necessary to enter the notes at displayed pitch as shown in the example. 

-David 

> From: "Kenneth Flak" 
> To: "Lillypond Users Mailing List" 
> Sent: Thursday, May 23, 2024 6:55:45 AM
> Subject: How to transpose?

> Hi,

> Trying my hands on transposing from concert pitch to Trumpet in Bf and french
> horn in F, but the displayed notes are still in concert pitch... How do I make
> these display the notes I would like the players to see?

> \new Staff = "trumpet" \with {
> instrumentName = "Trp"
> }
> {
> \clef treble
> \key c \major
> \transposition bf
> g'
> }
> \new Staff = "french horn" \with {
> instrumentName = "Horn"
> }{
> \clef treble
> \key c \major
> \transposition f
> cs'
> }

> Best,
> Kenneth

> --
> Roosna & Flak - Contemporary Dance & Music
> Web: roosnaflak.com
> Code: {github,gitlab}.com/kflak
> Mastodon: @k...@sonomu.club


How to transpose?

2024-05-23 Thread Kenneth Flak
Hi,

Trying my hands on transposing from concert pitch to Trumpet in Bf and french 
horn in F, but the displayed notes are still in concert pitch... How do I make 
these display the notes I would like the players to see?


\new Staff = "trumpet" \with {
  instrumentName = "Trp"
}
{
  \clef treble
  \key c \major
  \transposition bf
  g' 
}
\new Staff = "french horn" \with {
  instrumentName = "Horn"
}{
  \clef treble
  \key c \major
  \transposition f
  cs'
}

Best,
Kenneth

-- 
Roosna & Flak - Contemporary Dance & Music
Web: roosnaflak.com
Code: {github,gitlab}.com/kflak
Mastodon: @k...@sonomu.club




Re: Transpose tab into label forms

2024-03-06 Thread Carl Sorensen
On Mon, Mar 4, 2024 at 5:37 AM achar  wrote:

> Indeed I use fret-diagram. Too bad.
> THANKS Xavier.
>
>
If you use Lilypond's automatic fret diagram functionality, the fret
diagrams will be transposable, but the transposition may not be exactly
what you would manually do for a transposition.  You can also control the
automatic fret diagram construction by adding string numbers to one or more
notes in the chord.

\version "2.24"

myChord = {
  1
}

altChord = {
  
}

minChord = {
  
}



\score{
  \new FretBoards {
\myChord
\transpose c d \myChord
\transpose c a, \myChord
\altChord
\transpose c d \altChord
\transpose c a, \altChord
\minChord
\transpose c d \minChord
\transpose c a, \minChord
  }
}


HTH,

Carl


Re: Transpose tab into label forms

2024-03-04 Thread achar

Indeed I use fret-diagram. Too bad. THANKS Xavier.

Le 04/03/2024 à 11:33, Xavier Scheuer a écrit :

On Mon, 4 Mar 2024 at 11:05, achar  wrote:
>
> Thank you for the answer. Label form may not be the correct 
translation. We could say "diagram" for guitar.

> See an example attached. Good day. jean-Pierre
> It would save me time.
> Does anyone have any ideas or is this simply impossible?
> Thank you for your attention . Good evening. Jean Pierre

Salut Jean-Pierre,

It depends, if you use Fret diagram markups that you enter yourself 
using \fret-diagram, then effectively a \transpose does not change these.
But if you use Predefined fret diagrams (with \include 
"predefined-guitar-fretboards.ly 
<http://predefined-guitar-fretboards.ly>" for instance), then a 
\transpose works.


\include "predefined-guitar-fretboards.ly 
<http://predefined-guitar-fretboards.ly>"

\new FretBoards {
  \chordmode {
    \transpose c d {
      c1 d
    }
  }
}

Kind regards,
Xavier


Re: Transpose tab into label forms

2024-03-04 Thread Xavier Scheuer
On Mon, 4 Mar 2024 at 11:05, achar  wrote:
>
> Thank you for the answer. Label form may not be the correct translation.
We could say "diagram" for guitar.
> See an example attached. Good day. jean-Pierre
> It would save me time.
> Does anyone have any ideas or is this simply impossible?
> Thank you for your attention . Good evening. Jean Pierre

Salut Jean-Pierre,

It depends, if you use Fret diagram markups that you enter yourself using
\fret-diagram, then effectively a \transpose does not change these.
But if you use Predefined fret diagrams (with \include "
predefined-guitar-fretboards.ly" for instance), then a \transpose works.

\include "predefined-guitar-fretboards.ly"
\new FretBoards {
  \chordmode {
\transpose c d {
  c1 d
}
  }
}

Kind regards,
Xavier


Re: Transpose tab into label forms

2024-03-04 Thread achar
Thank you for the answer. Label form may not be the correct translation. 
We could say "diagram" for guitar. See an example attached.Good day. 
jean-Pierre


Le 04/03/2024 à 00:27, Carl Sorensen a écrit :
What is "label form" for tablature?  I've never heard of it and 
couldn't find any information about it using Google.  So I don't know 
how to answer your question.


Carl



Get Outlook for Android <https://aka.ms/AAb9ysg>

*From:* lilypond-user-bounces+carl.d.sorensen=gmail@gnu.org 
 on behalf of 
achar 

*Sent:* Sunday, March 3, 2024 8:10:36 AM
*To:* Lilypond User English 
*Subject:* Transpose tab into label forms
Hello to all.
With Frescobaldi I use the transpose tool to change the key of a 
piece. One thing it doesn't do is transpose the tablatures into label 
form. It would save me time. Does anyone have any ideas or is this 
simply impossible? Thank you for your attention . Good evening. Jean 
Pierre

Red Roses For A Blue Lady gt.pdf
Description: Adobe PDF document


Re: Transpose tab into label forms

2024-03-03 Thread Carl Sorensen
What is "label form" for tablature?  I've never heard of it and couldn't find 
any information about it using Google.  So I don't know how to answer your 
question.

Carl



Get Outlook for Android<https://aka.ms/AAb9ysg>

From: lilypond-user-bounces+carl.d.sorensen=gmail@gnu.org 
 on behalf of achar 

Sent: Sunday, March 3, 2024 8:10:36 AM
To: Lilypond User English 
Subject: Transpose tab into label forms

Hello to all.

With Frescobaldi I use the transpose tool to change the key of a piece.
One thing it doesn't do is transpose the tablatures into label form.
It would save me time.
Does anyone have any ideas or is this simply impossible?
Thank you for your attention . Good evening. Jean Pierre







Transpose tab into label forms

2024-03-03 Thread achar

Hello to all.

With Frescobaldi I use the transpose tool to change the key of a piece. 
One thing it doesn't do is transpose the tablatures into label form. It 
would save me time. Does anyone have any ideas or is this simply 
impossible? Thank you for your attention . Good evening. Jean Pierre


Re: Transpose from major to minor key

2024-01-12 Thread Lukas-Fabian Moser via LilyPond user discussion

Hi Matthew,

Am 12.01.24 um 00:29 schrieb msk...@ansuz.sooke.bc.ca:

You need to remember lilypond thinks in terms of pitch, not note names. Unlike
some (most?) other music software. So "\transpose g e" says "transpose EVERY
note up A TONE".

I'm not sure it's quite right to say that Lilypond thinks in terms of
pitch, not note names, because it selects the spelling of transposed notes
based on the note names.  For instance, \transpose c cis fis gives fisis ,
not g , whereas \transpose b, c fis gives g.  The one-semitone
transposition of the same note is different depending on the note names
used to specify it.


It depends on what one takes the term "pitch" to mean.

Your remark sounds as if you take "pitch" to be physical frequency, 
which obviously is a valid stance. But, LilyPond's "pitch" data type 
carries much more information, namely octave, "note name" and alteration.


Wol's remarks (I think) alluded to the difference between LilyPond and, 
e.g., MuseScore, in that in LilyPond the meaning of naked note names 
does not change when selecting a new key signature: In MuseScore, if I 
switch to e-flat major and hit "e", I get the pitch e-flat; in LilyPond, 
"e" still creates e-natural.


Lukas


Re: Transpose from major to minor key

2024-01-11 Thread mskala
On Thu, 11 Jan 2024, Wol wrote:

> You need to remember lilypond thinks in terms of pitch, not note names. Unlike
> some (most?) other music software. So "\transpose g e" says "transpose EVERY
> note up A TONE".

I'm not sure it's quite right to say that Lilypond thinks in terms of
pitch, not note names, because it selects the spelling of transposed notes
based on the note names.  For instance, \transpose c cis fis gives fisis ,
not g , whereas \transpose b, c fis gives g.  The one-semitone
transposition of the same note is different depending on the note names
used to specify it.

-- 
Matthew Skala
msk...@ansuz.sooke.bc.ca People before tribes.
https://ansuz.sooke.bc.ca/



Re: Transpose from major to minor key

2024-01-11 Thread Wol

On 10/01/2024 21:26, Butter Cream wrote:
Hi, I have a piece of music written in the key of G major and I want the 
pitches to transpose to e minor. How do I do this.


When I use the command \transpose g e it changes to E major (all g notes 
are sharped)


You need to remember lilypond thinks in terms of pitch, not note names. 
Unlike some (most?) other music software. So "\transpose g e" says 
"transpose EVERY note up A TONE".


As someone who plays a transposing instrument, this is very important to 
me - if my part gets transposed and others don't, the resulting piece of 
music is going to sound awful.


I get the sort of transposition you want CAN be useful, and I'm glad 
it's available, but for my normal, I want transpose to behave the way it 
does. I work at score level in concert pitch, and then have to print off 
my parts transposed as appropriate. If transpose starts mucking about 
with modes, all of my parts are going to be a mess.


Cheers,
Wol



Re: Transpose from major to minor key

2024-01-10 Thread Aaron Hill via LilyPond user discussion

On 2024-01-10 6:30 pm, Freeman Gilmore wrote:

Aaron Does LP have that?That would be a trick for modes other than
between major and minor and that may not work well.
Thank you, ƒg


Sorry for not linking the docs directly.

https://lilypond.org/doc/v2.25/Documentation/notation/modal-transformations


On Wed, Jan 10, 2024 at 5:20 PM Aaron Hill via LilyPond user discussion 
<

lilypond-user@gnu.org> wrote:


On 2024-01-10 1:26 pm, Butter Cream wrote:
> Hi, I have a piece of music written in the key of G major and I want
> the pitches to transpose to e minor. How do I do this.
>
> When I use the command \transpose g e it changes to E major (all g
> notes are sharped)

I think you'll need to use \modalTranspose to achieve what you want.



-- Aaron Hill



Re: Transpose from major to minor key

2024-01-10 Thread Aaron Hill via LilyPond user discussion

On 2024-01-10 1:26 pm, Butter Cream wrote:
Hi, I have a piece of music written in the key of G major and I want 
the pitches to transpose to e minor. How do I do this.


When I use the command \transpose g e it changes to E major (all g 
notes are sharped)


I think you'll need to use \modalTranspose to achieve what you want.


-- Aaron Hill



Transpose from major to minor key

2024-01-10 Thread Butter Cream
Hi, I have a piece of music written in the key of G major and I want the 
pitches to transpose to e minor. How do I do this.

When I use the command \transpose g e it changes to E major (all g notes are 
sharped)

Steve


Re: how to avoid double sharps in \transpose?

2023-02-05 Thread Kenneth Flak



--
Roosna & Flak - Contemporary Dance & Music
Web: roosnaflak.com
Code: {github,gitlab}.com/kflak
Mastodon: @k...@sonomu.club
On  4 Feb 2023  21:45, Jean Abou Samra wrote:
>On 04/02/2023 21:07, Kenneth Flak wrote:
>
>>
>> This comes out correctly:
>>
>> patright = {
>>  2  |
>> }
>>
>> right  = {
>> #@(map (lambda (p) #{ \transpose c #p \patright #})
>> (event-chord-pitches #{  #}))
>> }
>>
>> This, however, transposes the g c sequence to b e instead on the first 
>> iteration:
>>
>> patleft = {
>>g'2 c'
>> }
>>
>> left = {
>> #@(map (lambda (p) #{ \transpose c #p \patleft #})
>> (event-chord-pitches #{  #}))
>> }
>>
>> (note I also have to transpose patleft up one octave to get it on the same 
>> stave as before...)
>
>
>Not for me here, this prints the expected output:
>
>\version "2.24.0"
>
>\language english
>
>patleft = {
>   g'2 c'
>}
>
>left = {
>#@(map (lambda (p) #{ \transpose c #p \patleft #})
>(event-chord-pitches #{  #}))
>}
>
>{ \left }
>
>
>If something like what you describe happens in the context of your score,
>it most likely means that you accidentally shared the same music expression
>between two different places. It might help to read
>
>https://lilypond.org/doc/v2.25/Documentation/notation/how-to-prevent-sharing-of-music-expressions
>
>(N.B. This section is new in the 2.25 documentation, but the
>same applies in 2.24 or pretty much any version as far back
>as I can remember.)
>
>
>> I don't find any docs for event-chord-pitches anywhere...
>
>
>All Scheme functions are documented here:
>
>https://lilypond.org/doc/v2.24/Documentation/internals/scheme-functions
>
>Best,
>Jean
>


Thanks a lot, Jean!

The interesting thing is that the score behaved correctly once I rebuilt it 
from scratch. I can't quite see what I did differently in the original score, 
but oh, well...

Best,
Kenneth




Re: how to avoid double sharps in \transpose?

2023-02-04 Thread Jean Abou Samra
On 04/02/2023 21:07, Kenneth Flak wrote:

> 
> This comes out correctly:
> 
> patright = {
>  2  |
> }
> 
> right  = {
> #@(map (lambda (p) #{ \transpose c #p \patright #})
> (event-chord-pitches #{  #}))
> }
> 
> This, however, transposes the g c sequence to b e instead on the first 
> iteration:
> 
> patleft = {
>    g'2 c'
> }
> 
> left = {
> #@(map (lambda (p) #{ \transpose c #p \patleft #})
>     (event-chord-pitches #{  #}))
> }
> 
> (note I also have to transpose patleft up one octave to get it on the same 
> stave as before...)


Not for me here, this prints the expected output:

\version "2.24.0"

\language english

patleft = {
   g'2 c'
}

left = {
#@(map (lambda (p) #{ \transpose c #p \patleft #})
(event-chord-pitches #{  #}))
}

{ \left }


If something like what you describe happens in the context of your score,
it most likely means that you accidentally shared the same music expression
between two different places. It might help to read

https://lilypond.org/doc/v2.25/Documentation/notation/how-to-prevent-sharing-of-music-expressions

(N.B. This section is new in the 2.25 documentation, but the
same applies in 2.24 or pretty much any version as far back
as I can remember.)


> I don't find any docs for event-chord-pitches anywhere...


All Scheme functions are documented here:

https://lilypond.org/doc/v2.24/Documentation/internals/scheme-functions

Best,
Jean



OpenPGP_signature
Description: OpenPGP digital signature


Re: how to avoid double sharps in \transpose?

2023-02-04 Thread Kenneth Flak



--
Roosna & Flak - Contemporary Dance & Music
Web: roosnaflak.com
Code: {github,gitlab}.com/kflak
Mastodon: @k...@sonomu.club
On  4 Feb 2023  13:55, David Kastrup wrote:
>Kenneth Flak  writes:
>
>> Hi list,
>>
>> I have this:
>>
>> \version "2.24.0"
>>
>> \language english
>>
>>
>> patright = {
>>  2  |
>> }
>>
>> patleft = {
>>    g2 c
>> }
>>
>> right = {
>>\patright
>>\transpose c df \patright
>>\transpose c d \patright
>>\transpose c ef \patright
>>\transpose c e \patright
>>    \transpose c f \patright
>>\transpose c fs \patright
>>\transpose c g \patright
>>\transpose c gs \patright
>>\transpose c a \patright
>>\transpose c bf \patright
>>\transpose c b \patright
>> }
>>
>> left = {
>>    \clef bass
>>\patleft
>>\transpose c df \patleft
>>    \transpose c d \patleft
>>\transpose c ef \patleft
>>\transpose c e \patleft
>>\transpose c f \patleft
>>\transpose c fs \patleft
>>\transpose c g \patleft
>>\transpose c gs \patleft
>>\transpose c a \patleft
>>\transpose c bf \patleft
>>\transpose c b \patleft
>> }
>>
>> \score {
>>\new PianoStaff
>><<
>>  \new Staff = "right" \right
>>  \new Staff = "left" \left
>>    >>
>> }
>>
>> It gives me a few instances of double sharps as well as some e
>> sharps. How can I do that?
>
>You mean, how can you avoid that?  Don't transpose to gs instead of af.
>
>> Also, the programmer in me squeals upon seeing all these duplications,
>> so I was curious how to reduce this to something a bit more sensible?
>
>Try using
>
>{
>#@(map (lambda (p) #{ \transpose c #p \patleft #})
>   (event-chord-pitches #{  #}))
>}
>
Trying to make this work, and I am partly successful...

This comes out correctly:

patright = {
 2  |
}

right  = {
#@(map (lambda (p) #{ \transpose c #p \patright #})
(event-chord-pitches #{  #}))
}

This, however, transposes the g c sequence to b e instead on the first 
iteration:

patleft = {
   g'2 c'
}

left = {
#@(map (lambda (p) #{ \transpose c #p \patleft #})
(event-chord-pitches #{  #}))
}

(note I also have to transpose patleft up one octave to get it on the same 
stave as before...)

I don't find any docs for event-chord-pitches anywhere...

Best,
Kenneth




Re: how to avoid double sharps in \transpose?

2023-02-04 Thread Kenneth Flak



On  4 Feb 2023  13:55, David Kastrup wrote:
>Kenneth Flak  writes:
>
>> Hi list,
>>
>> I have this:
>>
>> \version "2.24.0"
>>
>> \language english
>>
>>
>> patright = {
>>  2  |
>> }
>>
>> patleft = {
>>g2 c
>> }
>>
>> right = {
>>\patright
>>\transpose c df \patright
>>\transpose c d \patright
>>\transpose c ef \patright
>>\transpose c e \patright
>>    \transpose c f \patright
>>\transpose c fs \patright
>>\transpose c g \patright
>>\transpose c gs \patright
>>\transpose c a \patright
>>\transpose c bf \patright
>>\transpose c b \patright
>> }
>>
>> left = {
>>\clef bass
>>\patleft
>>\transpose c df \patleft
>>\transpose c d \patleft
>>\transpose c ef \patleft
>>\transpose c e \patleft
>>\transpose c f \patleft
>>\transpose c fs \patleft
>>\transpose c g \patleft
>>\transpose c gs \patleft
>>\transpose c a \patleft
>>\transpose c bf \patleft
>>\transpose c b \patleft
>> }
>>
>> \score {
>>\new PianoStaff
>><<
>>  \new Staff = "right" \right
>>  \new Staff = "left" \left
>>>>
>> }
>>
>> It gives me a few instances of double sharps as well as some e
>> sharps. How can I do that?
>
>You mean, how can you avoid that?  Don't transpose to gs instead of af.
Doh! Of course...
>
>> Also, the programmer in me squeals upon seeing all these duplications,
>> so I was curious how to reduce this to something a bit more sensible?
>
>Try using
>
>{
>#@(map (lambda (p) #{ \transpose c #p \patleft #})
>   (event-chord-pitches #{  #}))
>}
Thanks a lot! Will give it a try a bit later. Still have to get my feet wet 
with the whole scheme for lilypond thing. Scheme is very much a foreign 
language to me...
>
>--
>David Kastrup




Re: how to avoid double sharps in \transpose?

2023-02-04 Thread David Kastrup
Kenneth Flak  writes:

> Hi list,
>
> I have this:
>
> \version "2.24.0"
>
> \language english
>
>
> patright = {
>  2  |
> }
>
> patleft = {
>    g2 c
> }
>
> right = {
>\patright
>\transpose c df \patright
>    \transpose c d \patright
>\transpose c ef \patright
>\transpose c e \patright
>\transpose c f \patright
>\transpose c fs \patright
>\transpose c g \patright
>\transpose c gs \patright
>\transpose c a \patright
>\transpose c bf \patright
>\transpose c b \patright
> }
>
> left = {
>\clef bass
>    \patleft
>\transpose c df \patleft
>    \transpose c d \patleft
>\transpose c ef \patleft
>\transpose c e \patleft
>    \transpose c f \patleft
>\transpose c fs \patleft
>\transpose c g \patleft
>\transpose c gs \patleft
>\transpose c a \patleft
>\transpose c bf \patleft
>\transpose c b \patleft
> }
>
> \score {
>\new PianoStaff
><<
>  \new Staff = "right" \right
>  \new Staff = "left" \left
>>>
> }
>
> It gives me a few instances of double sharps as well as some e
> sharps. How can I do that?

You mean, how can you avoid that?  Don't transpose to gs instead of af.

> Also, the programmer in me squeals upon seeing all these duplications,
> so I was curious how to reduce this to something a bit more sensible?

Try using

{
#@(map (lambda (p) #{ \transpose c #p \patleft #})
   (event-chord-pitches #{  #}))
}

-- 
David Kastrup



Re: how to avoid double sharps in \transpose?

2023-02-04 Thread bobr...@centrum.is
Here is the relevant section in the docs:

https://lilypond.org/doc/v2.22/Documentation/snippets/pitches#pitches-transposing-pitches-with-minimum-accidentals-_0028_0022smart_0022-transpose_0029

-David

- Original Message -
> From: "Kenneth Flak" 
> To: "bobroff" 
> Cc: "Lillypond Users Mailing List" 
> Sent: Saturday, February 4, 2023 11:47:52 AM
> Subject: Re: how to avoid double sharps in \transpose?

> Great, thanks! Just what I need :-)
> 
> Roosna & Flak
> Contemporary Dance & Music
> https://roosnaflak.com
> 
>  Original Message 
> On Feb 4, 2023, 13:30, bobr...@centrum.is wrote:
> 
>> Do a search for “smart transpose.” I did this recently. I’m not home at the
>> moment but I’ll dig it up and post it when I get back. -David - Kenneth
>> Flak  wrote: > Hi list, > > I have this: > > \version "2.24.0" > > \language
>> english > > > patright = { > 2  | > } > > patleft = { > g2 c > } > > right = 
>> {
>> > \patright > \transpose c df \patright > \transpose c d \patright > 
>> > \transpose
>> c ef \patright > \transpose c e \patright > \transpose c f \patright >
>> \transpose c fs \patright > \transpose c g \patright > \transpose c gs
>> \patright > \transpose c a \patright > \transpose c bf \patright > 
>> \transpose c
>> b \patright > } > > left = { > \clef bass > \patleft > \transpose c df 
>> \patleft
>> > \transpose c d \patleft > \transpose c ef \patleft > \transpose c e 
>> > \patleft
>> > \transpose c f \patleft > \transpose c fs \patleft > \transpose c g 
>> > \patleft
>> > \transpose c gs \patleft > \transpose c a \patleft > \transpose c bf 
>> > \patleft
>> > \transpose c b \patleft > } > > \score { > \new PianoStaff > \new Staff =
>> "right" \right > \new Staff = "left" \left > >> > } > > It gives me a few
>> instances of double sharps as well as some e sharps. How can I do that? Also,
>> the programmer in me squeals upon seeing all these duplications, so I was
>> curious how to reduce this to something a bit more sensible? > > Best, >
>> Kenneth > > -- > Roosna & Flak - Contemporary Dance & Music > Web:
>> roosnaflak.com > Code: {github,gitlab}.com/kflak > Mastodon: 
>> @k...@sonomu.club >
> > >



Re: how to avoid double sharps in \transpose?

2023-02-04 Thread Kenneth Flak
Great, thanks! Just what I need :-)

Roosna & Flak
Contemporary Dance & Music
https://roosnaflak.com

 Original Message 
On Feb 4, 2023, 13:30, bobr...@centrum.is wrote:

> Do a search for “smart transpose.” I did this recently. I’m not home at the 
> moment but I’ll dig it up and post it when I get back. -David - Kenneth 
> Flak  wrote: > Hi list, > > I have this: > > \version "2.24.0" > > \language 
> english > > > patright = { > 2  | > } > > patleft = { > g2 c > } > > right = 
> { > \patright > \transpose c df \patright > \transpose c d \patright > 
> \transpose c ef \patright > \transpose c e \patright > \transpose c f 
> \patright > \transpose c fs \patright > \transpose c g \patright > \transpose 
> c gs \patright > \transpose c a \patright > \transpose c bf \patright > 
> \transpose c b \patright > } > > left = { > \clef bass > \patleft > 
> \transpose c df \patleft > \transpose c d \patleft > \transpose c ef \patleft 
> > \transpose c e \patleft > \transpose c f \patleft > \transpose c fs 
> \patleft > \transpose c g \patleft > \transpose c gs \patleft > \transpose c 
> a \patleft > \transpose c bf \patleft > \transpose c b \patleft > } > > 
> \score { > \new PianoStaff > \new Staff = "right" \right > \new Staff = 
> "left" \left > >> > } > > It gives me a few instances of double sharps as 
> well as some e sharps. How can I do that? Also, the programmer in me squeals 
> upon seeing all these duplications, so I was curious how to reduce this to 
> something a bit more sensible? > > Best, > Kenneth > > -- > Roosna & Flak - 
> Contemporary Dance & Music > Web: roosnaflak.com > Code: 
> {github,gitlab}.com/kflak > Mastodon: @k...@sonomu.club > >

Re: how to avoid double sharps in \transpose?

2023-02-04 Thread bobr...@centrum.is
Do a search for “smart transpose.”  I did this recently.  I’m not home at the 
moment but I’ll dig it up and post it when I get back.

-David
- Kenneth Flak  wrote:
> Hi list,
> 
> I have this:
> 
> \version "2.24.0"
> 
> \language english
> 
> 
> patright = {
>  2  |
> }
> 
> patleft = {
>    g2 c
> }
> 
> right = {
>\patright
>\transpose c df \patright
>    \transpose c d \patright
>\transpose c ef \patright
>\transpose c e \patright
>\transpose c f \patright
>\transpose c fs \patright
>\transpose c g \patright
>\transpose c gs \patright
>\transpose c a \patright
>\transpose c bf \patright
>\transpose c b \patright
> }
> 
> left = {
>\clef bass
>    \patleft
>\transpose c df \patleft
>    \transpose c d \patleft
>\transpose c ef \patleft
>\transpose c e \patleft
>    \transpose c f \patleft
>\transpose c fs \patleft
>\transpose c g \patleft
>\transpose c gs \patleft
>\transpose c a \patleft
>\transpose c bf \patleft
>\transpose c b \patleft
> }
> 
> \score {
>\new PianoStaff
><<
>  \new Staff = "right" \right
>  \new Staff = "left" \left
>>>
> }
> 
> It gives me a few instances of double sharps as well as some e sharps. How 
> can I do that? Also, the programmer in me squeals upon seeing all these 
> duplications, so I was curious how to reduce this to something a bit more 
> sensible?
> 
> Best,
> Kenneth
> 
> --
> Roosna & Flak - Contemporary Dance & Music
> Web: roosnaflak.com
> Code: {github,gitlab}.com/kflak
> Mastodon: @k...@sonomu.club
> 
> 




how to avoid double sharps in \transpose?

2023-02-04 Thread Kenneth Flak
Hi list,

I have this:

\version "2.24.0"

\language english


patright = {
 2  |
}

patleft = {
   g2 c
}

right = {
   \patright
   \transpose c df \patright
   \transpose c d \patright
   \transpose c ef \patright
   \transpose c e \patright
   \transpose c f \patright
   \transpose c fs \patright
   \transpose c g \patright
   \transpose c gs \patright
   \transpose c a \patright
   \transpose c bf \patright
   \transpose c b \patright
}

left = {
   \clef bass
   \patleft
   \transpose c df \patleft
   \transpose c d \patleft
   \transpose c ef \patleft
   \transpose c e \patleft
   \transpose c f \patleft
   \transpose c fs \patleft
   \transpose c g \patleft
   \transpose c gs \patleft
   \transpose c a \patleft
   \transpose c bf \patleft
   \transpose c b \patleft
}

\score {
   \new PianoStaff
   <<
 \new Staff = "right" \right
 \new Staff = "left" \left
   >>
}

It gives me a few instances of double sharps as well as some e sharps. How can 
I do that? Also, the programmer in me squeals upon seeing all these 
duplications, so I was curious how to reduce this to something a bit more 
sensible?

Best,
Kenneth

--
Roosna & Flak - Contemporary Dance & Music
Web: roosnaflak.com
Code: {github,gitlab}.com/kflak
Mastodon: @k...@sonomu.club




Re: Auto-transpose engraver progress

2023-01-19 Thread Saul Tobin
Thinking about this more, the issue with simultaneous transposition and key
changes is worse than I realized, since it's pretty common to write
something like:

global = {
  s1
  \key e \major
  s1
}

music = {
  g'1
  \transposition a
  g'1
}

\new Staff \with {
  \autoTranspose
} <<
  \global \music
>>

The output is incorrect (but differently wrong) regardless of whether you
write << \global \music >> or << \music \global >>.

This is partially a bug in the original snippet, not just my version with
inserted key signatures. Solving it would seem to require the ability to
"listen ahead" or "listen behind" to all the events happening at the same
moment. Is that even possible?

On Thu, Jan 19, 2023 at 5:48 PM Saul Tobin 
wrote:

> Hi all,
>
> I managed to add functionality to the auto-transpose engraver snippet from
> OLL so that it prints key signatures at transposition changes. It also
> doesn't do so if the transposition change is only octave transposition.
>
> The one thing I'd like to fix is the behavior when an actual key change
> occurs at the same moment as a transposition change. Currently this
> triggers a warning and the output is only correct depending on whether the
> key change or transposition is written first. Not sure how to approach
> solving that.
>
> Saul
>
>


Auto-transpose engraver progress

2023-01-19 Thread Saul Tobin
Hi all,

I managed to add functionality to the auto-transpose engraver snippet from
OLL so that it prints key signatures at transposition changes. It also
doesn't do so if the transposition change is only octave transposition.

The one thing I'd like to fix is the behavior when an actual key change
occurs at the same moment as a transposition change. Currently this
triggers a warning and the output is only correct depending on whether the
key change or transposition is written first. Not sure how to approach
solving that.

Saul


auto-transpose.ily
Description: Binary data


Re: chord name does not transpose as score using language italino

2022-09-07 Thread ming tsang
Hi Hans
Thank you for the info pertaining to the known issue 6305. I found the work
around solution from the known issue link.
Ming Tsang

On Wed, Sep 7, 2022 at 2:15 AM Hans Aikema  wrote:

>
>
> On 7 Sep 2022, at 05:32, ming tsang  wrote:
>
> 
> The following code produces a png file that did not print the
> correct chord name. .
> 
> ...
> the output png screen print:
> [image: image.png]
> I am expecting to seeA C#m F#m D C#m Bm
> Any help is appreciated.
> ming (lyndon) tsang
>
>
> That would be known issue
> https://gitlab.com/lilypond/lilypond/-/issues/6305
> The work-around according to comments would be to add a \language
> "english" after the notes and before the score.
>


-- 
ming (lyndon) tsang


Re: chord name does not transpose as score using language italino

2022-09-07 Thread Hans Aikema


> On 7 Sep 2022, at 05:32, ming tsang  wrote:
> 
> 
> The following code produces a png file that did not print the correct chord 
> name. .
> 
> ...
> the output png screen print:
> 
> I am expecting to seeA C#m F#m D C#m Bm
> Any help is appreciated.
> ming (lyndon) tsang

That would be known issue https://gitlab.com/lilypond/lilypond/-/issues/6305
The work-around according to comments would be to add a \language "english" 
after the notes and before the score.

chord name does not transpose as score using language italino

2022-09-06 Thread ming tsang
The following code produces a png file that did not print the correct chord
name. .

\version "2.23.11"
\language "italiano"
global = {
  \key do \major
  \numericTimeSignature
  \time 4/4
}

chordNames = \chordmode {
  \global
  % Chords follow here.
  la1 dod1:m fad1:m re2 dob8:m re4.:m
%  a1 cs1:m fs1:m d2 cs8:m b4.:m
}

melody = \fixed do'' {
  \global
  % Music follows here.
  mi8 do8 mi8 do8 mi8 do8 mi8 do8
  mi8 si, mi si, mi si, mi si,
%do re mi fa sol la si
  mi8 la, mi la, mi la, mi la,
  fa8 8 8 mi8 r8 re4.
}

verse = \lyricmode {
  % Lyrics follow here.

}

\score {
  <<
\new ChordNames \chordNames
\new Staff { \melody }
\addlyrics { \verse }
  >>
  \layout { }
  \midi {
\tempo 4=158
  }
}
the output png screen print:
[image: image.png]
I am expecting to seeA C#m F#m D C#m Bm
Any help is appreciated.
ming (lyndon) tsang


Re: \transpose question

2021-10-08 Thread Mark Probert
Valentin wrote:
> 
> How about this? 
>
Wow! Thank you. That really is what I was after, and now I need to 
understand what you've done!

Much appreciated

 .. mark.



Re: \transpose question

2021-10-08 Thread Flaming Hakama by Elaine
>
>
> -- Forwarded message --
> From: Mark Probert 
> To: Lily Pond 
> Cc:
> Bcc:
> Date: Fri, 8 Oct 2021 10:36:37 +1100
> Subject: \transpose question
>
> Hi.
>
> A question on transpose: I understand that "\transpose distinguishes
> between enharmonic pitches," however is there anyway to force a
> particular behaviour? For example, in the snippet below, when I have a
> movement from C to C# in the original key, and then go up a tone with
> "\transpose c d," I get "D and D#" (which is correct based on the
> provided notes and chords), however I want "D and Eb" (the other
> enharmonic).
>
> Is there a way to do this?
>
> Thanks .. mark.
>
> --
> \version "2.22"
>
> melody = \relative c' {
>   \clef treble
>   c8 d ees f g4 r4 \bar "||"
>   cis,8 dis e fis gis4 r4 \bar "||"
> }
>
> harmony = \chordmode {
>   c1:m7 cis1:m7
> }
>
> song = {
>   <<
> \new ChordNames \harmony
> \new Staff  \melody
>   >>
> }
>
> trans = {
>   \transpose c c { \song }
>   \transpose c d { \song }
> }
>
> \score {
>   \trans
> }
>

Since you are choosing to spell chords differently in terms of #1 vs b2,
you are not just trying to do a transposition.

Rather, you are choosing to respell the harmony.

Well, you are doing both--for some keys you will just be transposing.  For
the others, you are changing the harmonic spelling, and transposing.

Basically, you will have to have more than one source.
But you will probably only need 2, one spelled as #1 and the other as b2.

Your organization was a little confusing, as it created extra staves.
Here is how I would demo it


\version "2.19.83"

melodySharpOne = \relative c' {
  \clef treble
  c8 d ees f g4 r4
  cis,8 dis e fis gis4 r4 \bar "||"
}
melodyFlatTwo = \relative c' {
  \clef treble
  c8 d ees f g4 r4
  des8 ees fes ges aes4 r4 \bar "||"
}

harmonySharpOne = \chordmode {
  c1:m7 cis1:m7
}
harmonyFlatTwo = \chordmode {
  c1:m7 des1:m7
}

<<
  \new ChordNames {
    \transpose c c \harmonySharpOne
\transpose c cis \harmonyFlatTwo
\transpose c d \harmonyFlatTwo
\transpose c dis \harmonyFlatTwo
\transpose c ees \harmonySharpOne
  }
  \new Staff {
\transpose c c \melodySharpOne
\transpose c cis \melodyFlatTwo
\transpose c d \melodyFlatTwo
\transpose c dis \melodyFlatTwo
\transpose c ees \melodySharpOne
  }
>>


HTH,

Elaine Alt
415 . 341 .4954   "*Confusion is
highly underrated*"
ela...@flaminghakama.com
Producer ~ Composer ~ Instrumentalist ~ Educator
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


Re: \transpose question

2021-10-08 Thread Valentin Petzel
Hi Mark,

How about this? Here we basically pass along a list of numbers for each key. 
This contains informations about the enharmonic correctness: If the value is 0 
the part is kept as is, if it is positive it is corrected upwards, if it is 
negative it is corrected downwards.

Cheers,
Valentin\version "2.22"

test={ c'8 d' ees' f' g'4 r \bar "||" }
harms=\chordmode { c1 }

rectify=
#(define-music-function (n music) (number? ly:music?)
 (if (> n 0)
 #{ \transpose #(ly:make-pitch 0 0 (/ n 2)) #(ly:make-pitch 0 1 (/ (- n 2) 2)) #music #}
 (if (< n 0)
 #{ \transpose #(ly:make-pitch 0 1 (/ n 2)) #(ly:make-pitch 0 0 (/ (+ n 2) 2)) #music #}
 music)))

notes=
#(define-music-function (l)
   (list?)
   (define (L n)
 (if (< n (length l))
 (list-ref l n)
 0))
   #{
 \rectify #(L 0) \test
     \rectify #(L 1) \transpose c cis \test
     \rectify #(L 2) \transpose c d \test
     \rectify #(L 3) \transpose c ees \test
     \rectify #(L 4) \transpose c e \test
     \rectify #(L 5) \transpose c f \test
     \rectify #(L 6) \transpose c fis \test
     \rectify #(L 7) \transpose c g \test
     \rectify #(L 8) \transpose c gis \test
     \rectify #(L 9) \transpose c a \test
     \rectify #(L 10) \transpose c bes \test
     \rectify #(L 11) \transpose c b \test
   #})

harmonics=
#(define-music-function (l)
   (list?)
   (define (L n)
 (if (< n (length l))
 (list-ref l n)
 0))
   #{
 \rectify #(L 0) \harms
 \rectify #(L 1) \transpose c cis \harms
 \rectify #(L 2) \transpose c d \harms
 \rectify #(L 3) \transpose c ees \harms
 \rectify #(L 4) \transpose c e \harms
 \rectify #(L 5) \transpose c f \harms
 \rectify #(L 6) \transpose c fis \harms
 \rectify #(L 7) \transpose c g \harms
 \rectify #(L 8) \transpose c gis \harms
 \rectify #(L 9) \transpose c a \harms
 \rectify #(L 10) \transpose c bes \harms
 \rectify #(L 11) \transpose c b \harms
   #})

combined=
#(define-music-function (p l) (ly:pitch? list?)
   #{
 \transpose c #p
 <<
   \new ChordNames \harmonics #l
   \new Staff \notes #l
 >> \bar "|."
   #})
   
\score {
   \combined c #'()
  \layout { }
}

\score {
   \combined d #'(0 1 0 0 0 0 1 0 1 0 0 0)
  \layout { }
}

\score {
   \combined a #'(0 1 0 0 0 0 1 0 1 0 0 1)
  \layout { }
}

signature.asc
Description: This is a digitally signed message part.


Re: \transpose question

2021-10-07 Thread Mark Probert
David wrote:
>> 
>> Is there a way to do this?
> 
> Transpose the two halves of the melody separately,
> the first half c to d, the second half cis to ees.
> 
This is part of the problem with the "pared down snippet" approach, or 
rather, my original explanation of the problem. In reality, my problem 
is more complicated. I am attempting to create a "practice book" for 
various brass/woodwind instruments, so:

 + I have an exercise that goes through 12 keys: c-cis-d...bes-b

 + I want to use a single source for transposition to 3 keys: c, d, and 
a (essentially concert, bes, and ees). The exercise are identical apart 
from the key (the backing track is at a fixed pitch and I don't have 
the ability to change it in any meaningful way).

Unfortunately, I suspect I am going to need to create a separate 
edition for each transposition, but I hoped there would be a short cut.

Thank you! 
  .. m.



Re: \transpose question

2021-10-07 Thread David Wright
On Fri 08 Oct 2021 at 10:36:37 (+1100), Mark Probert wrote:
> 
> A question on transpose: I understand that "\transpose distinguishes 
> between enharmonic pitches," however is there anyway to force a 
> particular behaviour? For example, in the snippet below, when I have a 
> movement from C to C# in the original key, and then go up a tone with 
> "\transpose c d," I get "D and D#" (which is correct based on the 
> provided notes and chords), however I want "D and Eb" (the other 
> enharmonic).
> 
> Is there a way to do this?

Transpose the two halves of the melody separately,
the first half c to d, the second half cis to ees.

Cheers,
David.



\transpose question

2021-10-07 Thread Mark Probert


Hi. 

A question on transpose: I understand that "\transpose distinguishes 
between enharmonic pitches," however is there anyway to force a 
particular behaviour? For example, in the snippet below, when I have a 
movement from C to C# in the original key, and then go up a tone with 
"\transpose c d," I get "D and D#" (which is correct based on the 
provided notes and chords), however I want "D and Eb" (the other 
enharmonic).

Is there a way to do this?

Thanks .. mark.

--
\version "2.22"

melody = \relative c' {
  \clef treble
  c8 d ees f g4 r4 \bar "||"
  cis,8 dis e fis gis4 r4 \bar "||"
}

harmony = \chordmode {
  c1:m7 cis1:m7
}

song = {
  <<
    \new ChordNames \harmony
\new Staff  \melody
  >>
}

trans = {
  \transpose c c { \song }
  \transpose c d { \song }
}

\score {
  \trans
}



Re: pitch argument for transpose function

2021-02-18 Thread Thomas Morley
Am Do., 18. Feb. 2021 um 12:52 Uhr schrieb David Kastrup :
>
> Thomas Morley  writes:
>
> > Probably:
> >
> > \version "2.22.0"
> >
> > #(define interval #{ c' b #})
>
> That seems like a somewhat obtuse way to write
>
> interval = { c' b }
>
> --
> David Kastrup

Indeed, though as requested:
> I want to keep transpose intervals in scheme variables,

I know, both are interchangeable, but felt no energy to discuss it ...


Cheers,
  Harm



Re: pitch argument for transpose function

2021-02-18 Thread David Kastrup
Thomas Morley  writes:

> Probably:
>
> \version "2.22.0"
>
> #(define interval #{ c' b #})

That seems like a somewhat obtuse way to write

interval = { c' b }

-- 
David Kastrup



Re: pitch argument for transpose function

2021-02-18 Thread Robert Kubosz

Thank you, it works perfectly! :-)



Re: pitch argument for transpose function

2021-02-18 Thread Thomas Morley
Am Do., 18. Feb. 2021 um 11:12 Uhr schrieb Robert Kubosz
:
>
> Hello!
>
>
> I want to write a piece of code, that would automatically fill-in
> missing voices. Here is a snippet that represents what I want to accomplish:
>
>
> \version "2.22.0"
>
>
> voice-one = {c'}
>
>
> #(define interval "c' b")
>
> %this does not work
> %\transpose function expects pitch as first argument,
> %but unfortunately I have no idea how to provide it
>
> voice-two = \transpose \interval \voice-one
>
> {\voice-two}
>
>
> Of course it throws errors.
>
> Does somebody what to write to make it work?
> I want to keep transpose intervals in scheme variables, because there is
> ~24 voices and I want to keep the code maintainable.
>
>
> Best regards
>
> Robert Kubosz
>
>

Probably:

\version "2.22.0"

#(define interval #{ c' b #})

voice-one = { c' }

transposedMusic =
#(define-music-function (from-to-music music)(ly:music? ly:music?)
  (let ((transpose-pitches (event-chord-pitches from-to-music)))
(if (= (length transpose-pitches) 2)
(apply transpose `(,@transpose-pitches ,music))
(begin
  (ly:warning
"\\transpose expects two pitches: ~a, ignoring."
transpose-pitches)
  music

voice-two = \transposedMusic \interval \voice-one

\new Staff \voice-two

Cheers,
  Harm



pitch argument for transpose function

2021-02-18 Thread Robert Kubosz

Hello!


I want to write a piece of code, that would automatically fill-in 
missing voices. Here is a snippet that represents what I want to accomplish:



\version "2.22.0"


voice-one = {c'}


#(define interval "c' b")

%this does not work
%\transpose function expects pitch as first argument,
%but unfortunately I have no idea how to provide it

voice-two = \transpose \interval \voice-one

{\voice-two}


Of course it throws errors.

Does somebody what to write to make it work?
I want to keep transpose intervals in scheme variables, because there is 
~24 voices and I want to keep the code maintainable.



Best regards

Robert Kubosz




Re: transpose for baritone sax

2019-09-27 Thread Malte Meyn



Am 27.09.19 um 02:33 schrieb Francesco Petrogalli:

I understand that the correct way of doing this is first write the
notes in the tonality of the instrument, and _then_ use \transposition
to get the correct pitches in the midi, but I already have the notes
in the ly file with the orchestral pitch and I would like to avoid
rewriting the whole part.


If you write everything “in C” you can use it for the score directly (I 
guess that’s what you call “orchestral pitch”?).


You are right: For the transposed parts with midi in C you need 
\transposition. But you don’t have to rewrite everything, just use 
\transpose too:


%

\version "2.19.83"

altosax = \relative {
  \key c \major
  c d e f g a b c
}

horn = \relative {
  \key c \major
  c d e f g a b c
}

trombone = \relative {
  \clef bass
  \key c \major
  c d e f g a b c
}

\score {
  \new StaffGroup <<
\new Staff \altosax
\new Staff \horn
\new Staff \trombone
  >>
  \layout { }
  \midi { }
}

\score {
  {
\transposition es
\transpose es c' \altosax
  }
  \layout { }
  \midi { }
}

\score {
  {
\transposition f
\transpose f c' \horn
  }
  \layout { }
  \midi { }
}

\score {
  \trombone
  \layout { }
  \midi { }
}

%

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


Re: transpose for baritone sax

2019-09-26 Thread Tim McNamara
Read up on \transpose which should do what you want, combined with octaves.

> On Sep 26, 2019, at 7:33 PM, Francesco Petrogalli 
>  wrote:
> 
> Hi,
> 
> I have written a part using the orchestral pitch (real note) of an
> instrument, the baritone sax (and other instruments, like trumpets,
> alto, and so on).
> 
> All the parts are rendered with the real notes, so that I can listen
> to the midi and check the music on the piano easily (I am no good at
> transposing on the fly).
> 
> Now I need to produce the parts for the single instruments with the
> correct transposition, but keeping the same pitch in the midi.
> 
> Is there already a facility to do so, say a function that I can place
> in front of a music sequence and get it transposed for saxophone? or
> do I have to come up with my own?
> 
> I understand that the correct way of doing this is first write the
> notes in the tonality of the instrument, and _then_ use \transposition
> to get the correct pitches in the midi, but I already have the notes
> in the ly file with the orchestral pitch and I would like to avoid
> rewriting the whole part.
> 
> Kind regards,
> 
> Francesco
> 
> ___
> 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


transpose for baritone sax

2019-09-26 Thread Francesco Petrogalli
Hi,

I have written a part using the orchestral pitch (real note) of an
instrument, the baritone sax (and other instruments, like trumpets,
alto, and so on).

All the parts are rendered with the real notes, so that I can listen
to the midi and check the music on the piano easily (I am no good at
transposing on the fly).

Now I need to produce the parts for the single instruments with the
correct transposition, but keeping the same pitch in the midi.

Is there already a facility to do so, say a function that I can place
in front of a music sequence and get it transposed for saxophone? or
do I have to come up with my own?

I understand that the correct way of doing this is first write the
notes in the tonality of the instrument, and _then_ use \transposition
to get the correct pitches in the midi, but I already have the notes
in the ly file with the orchestral pitch and I would like to avoid
rewriting the whole part.

Kind regards,

Francesco

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


Re: Transpose

2019-09-16 Thread Pierre Perol-Schneider
Nice coding Gilles,
Cheers,
Pierre

Le lun. 16 sept. 2019 à 19:51, Gilles Thibault  a écrit :

> Sorry. Very late answer
> Here is a scheme way to proceed. (see attached file).
>
>
>
> ___
> 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: Transpose

2019-09-16 Thread Gilles Thibault

Sorry. Very late answer
Here is a scheme way to proceed. (see attached file).




%% For version 2.18 change the first line by :
%% makeExercice = #(define-music-function (parser location p0 p1 p2 p3 
highest-pitch lowest-pitch)
makeExercice = #(define-music-function (p0 p1 p2 p3 highest-pitch lowest-pitch)
  (ly:pitch? ly:pitch? ly:pitch? ly:pitch? ly:pitch? 
ly:pitch?)
"p0 : ton pitch. 
 p1,p2,p3 : pitches of the first 3 notes of the chords
The last 2 parameters : the pitch range"
  (let ((octave 1))
(let loop ((p1 p1)
   (p2 p2)
   (p3 p3)
   (l '()))
  (let ((p (ly:pitch-transpose p1 (ly:make-pitch octave 0 0
(if (= octave 1) ; go up
  (begin
(if (not (ly:pitch>

foo.pdf
Description: Adobe PDF document
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Transpose

2019-09-11 Thread David Wright
On Wed 11 Sep 2019 at 20:36:22 (+0200), John McWilliam wrote:
>I appreciate your thoughts on this one. I was looking for ways to 
> avoid repeating my code and therebye reduce the size of the LP file - I have 
> 26 scales to cover! I thought it might be possible to have a basic brocken 
> chord exersice in C and then simply transpose each scale from that. Utopia…
>   I have decided that in the long run it will be quicker and less effort 
> to write out each scale (longhand). I enclose my basic structure. If you have 
> a better idea, please let me know.

My only other suggestion would be to write a script to generate the
LP code. This presupposes that you're comfortable with a scripting
language like, say, python.

The Cmaj version contains just a sequence cegcegceg… followed by
gecgecgec… so that's just reading arrays of length 3 with an index
being incremented modulo 3.

The other versions vary in (i) the starting note (= finishing) which
you specify individually, in absolute pitch; (ii) the index 0, 1 or 2
of the second note; and (iii) whether the second note needs a ","
(because that interval can be a 4th or a 6th).

After that, the pattern is fixed: going up, the second note of each
group always has a ","; and going down, the first note of each group
always has a "'" except for the very first (ie the top note).

You'd still use LP's modal transposition on the generated sequences,
but proof-reading involves only looking at a few notes. (Your amin
version still contains that typo.)

As I say, it does require fluency in scripting.

> From: David Wright
> 
> On Tue 10 Sep 2019 at 16:34:56 (+0200), John McWilliam wrote:
> > The reason for the adjusted first Group (a4~ a16 e, g a) is due to the fact 
> > that the lowest note on a Bb clarinet is e. Thereafter, the broken chords 
> > follow the set pattern until reaching the last group. I have extended my 
> > snippet to illustrate what I mean.
> 
> I'm not sure how you expect LP to divine the range of the clarinet.
> What *would* be a "strange interpretation" to me is transposing an
> interval of a sixth into a fourth.
> 
> But the solution to your particular problem might be to observe
> that most of the notes in your manually adjusted version (senza
> typo) are shifted in time by one group when compared with the
> correct (your so-called "wrong") version. Also, several of the
> groups (corresponding to lines in the source file) are exact
> repetitions.
> 
> So I would break your Cmajor variable into 4-note chunks and then
> build each sequence from these smaller variables. Note that for
> this to work, you must put \relative { } round the composite
> scale, not round the 4-note chunks. The latter must be left
> "floating", neither absolute nor relative.
> 
> %% ✄ 
> raw = { c16 e f g }
> \score {
>   \relative c' { \raw \raw \raw \raw }
> }
> baked = \relative { c e f g }
> \score {
>   \relative c''' { \baked \baked \baked \baked }
> }
> %% ✄ 
> 
> The \relative c''' is impotent in both its effects, because \baked
> is already absolute.
> 
> > From: David Wright
> > 
> > On Tue 10 Sep 2019 at 13:19:52 (+0200), John McWilliam wrote:
> > > Hi again,
> > >   I attach my attempt to use \modalTranspose in order to save code when 
> > > rewriting broken chords in C major and A minor.  The idea is to go ahead 
> > > and repeat the exercise in G major, Eminor etc., however, it looks as 
> > > though I am going to have to write everything out (longhand). You will 
> > > see in my example that modalTranspose gives a strange interpretation of A 
> > > minor and I wonder whether there is a solution to this?
> > 
> > Shouldn't your manual one be:
> > 
> > Aminor = \relative c' {
> >   \key a \minor
> >   a4~ a16 c, e a c e, a c e a, c e
> > }
> > 
> > which matches the modal transposition.

Cheers,
David.

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


Re: Transpose

2019-09-11 Thread David Wright
On Tue 10 Sep 2019 at 16:34:56 (+0200), John McWilliam wrote:
> The reason for the adjusted first Group (a4~ a16 e, g a) is due to the fact 
> that the lowest note on a Bb clarinet is e. Thereafter, the broken chords 
> follow the set pattern until reaching the last group. I have extended my 
> snippet to illustrate what I mean.

I'm not sure how you expect LP to divine the range of the clarinet.
What *would* be a "strange interpretation" to me is transposing an
interval of a sixth into a fourth.

But the solution to your particular problem might be to observe
that most of the notes in your manually adjusted version (senza
typo) are shifted in time by one group when compared with the
correct (your so-called "wrong") version. Also, several of the
groups (corresponding to lines in the source file) are exact
repetitions.

So I would break your Cmajor variable into 4-note chunks and then
build each sequence from these smaller variables. Note that for
this to work, you must put \relative { } round the composite
scale, not round the 4-note chunks. The latter must be left
"floating", neither absolute nor relative.

%% ✄ 
raw = { c16 e f g }
\score {
  \relative c' { \raw \raw \raw \raw }
}
baked = \relative { c e f g }
\score {
  \relative c''' { \baked \baked \baked \baked }
}
%% ✄ 

The \relative c''' is impotent in both its effects, because \baked
is already absolute.

> From: David Wright
> 
> On Tue 10 Sep 2019 at 13:19:52 (+0200), John McWilliam wrote:
> > Hi again,
> > I attach my attempt to use \modalTranspose in order to save code when 
> > rewriting broken chords in C major and A minor.  The idea is to go ahead 
> > and repeat the exercise in G major, Eminor etc., however, it looks as 
> > though I am going to have to write everything out (longhand). You will see 
> > in my example that modalTranspose gives a strange interpretation of A minor 
> > and I wonder whether there is a solution to this?
> 
> Shouldn't your manual one be:
> 
> Aminor = \relative c' {
>   \key a \minor
>   a4~ a16 c, e a c e, a c e a, c e
> }
> 
> which matches the modal transposition.

Cheers,
David.

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


RE: Transpose

2019-09-10 Thread foxfanfare
I think the problem is that you're trying to engrave an a\minor chord in the
root position from a c\major in second inversion.
Lilypond won't guess how to adjust that with the transpose tool. 
But it should work smoothly if you use the same chord position for each
tonality.



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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


Re: Transpose

2019-09-10 Thread David Wright
On Tue 10 Sep 2019 at 13:19:52 (+0200), John McWilliam wrote:
> Hi again,
>   I attach my attempt to use \modalTranspose in order to save code when 
> rewriting broken chords in C major and A minor.  The idea is to go ahead and 
> repeat the exercise in G major, Eminor etc., however, it looks as though I am 
> going to have to write everything out (longhand). You will see in my example 
> that modalTranspose gives a strange interpretation of A minor and I wonder 
> whether there is a solution to this?

Shouldn't your manual one be:

Aminor = \relative c' {
  \key a \minor
  a4~ a16 c, e a c e, a c e a, c e
}

which matches the modal transposition.

Cheers,
David.

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


RE: Transpose

2019-09-10 Thread John McWilliam
Hi again,
I attach my attempt to use \modalTranspose in order to save code when 
rewriting broken chords in C major and A minor.  The idea is to go ahead and 
repeat the exercise in G major, Eminor etc., however, it looks as though I am 
going to have to write everything out (longhand). You will see in my example 
that modalTranspose gives a strange interpretation of A minor and I wonder 
whether there is a solution to this?

John McWilliam

Sent from Mail for Windows 10

From: David Kastrup
Sent: Saturday, September 7, 2019 9:49 PM
To: John McWilliam
Cc: lilypond-user@gnu.org
Subject: Re: Transpose

John McWilliam  writes:

> Hi,
>   I am rewriting Baermanns repetitive exercises for clarinet and
> am trying to rationalise my code.  For example broken chords: they
> start in C major then A minor followed by G major, E minor etc. To
> avoid rewriting the code every time I tried using ”\transpose c a
> \Cmajor” (the variable with the C major code). This gave me of coarse
> a change of key signature to A major – not what was wanted. Is there a
> way around this which will allow me to take the C major code and
> transpose the notes down a third to A keeping everything in C (minor).

Look up \modalTranspose in the manual.

-- 
David Kastrup



Exercise_snip.ly
Description: Binary data


Exercise_snip.pdf
Description: Adobe PDF document


Exercises_format.ily
Description: Binary data
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Transpose

2019-09-07 Thread David Kastrup
John McWilliam  writes:

> Hi,
>   I am rewriting Baermanns repetitive exercises for clarinet and
> am trying to rationalise my code.  For example broken chords: they
> start in C major then A minor followed by G major, E minor etc. To
> avoid rewriting the code every time I tried using ”\transpose c a
> \Cmajor” (the variable with the C major code). This gave me of coarse
> a change of key signature to A major – not what was wanted. Is there a
> way around this which will allow me to take the C major code and
> transpose the notes down a third to A keeping everything in C (minor).

Look up \modalTranspose in the manual.

-- 
David Kastrup

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


Re: Transpose

2019-09-07 Thread bobr...@centrum.is
Hi John,

I suspect you'll have to write out your pattern in C major and then A minor 
first, and then transpose the pair all the way through the other keys.  Be 
aware that you should be able to use '\key c \major' for the C maj. and A min. 
pattern.

Hope this helps,

David

- Original Message -
> From: "John McWilliam" 
> To: "Lillypond Users Mailing List" 
> Sent: Saturday, September 7, 2019 4:52:22 PM
> Subject: Transpose

> Hi,
> 
> I am rewriting Baermanns repetitive exercises for clarinet and am trying to
> rationalise my code. For example broken chords: they start in C major then A
> minor followed by G major, E minor etc. To avoid rewriting the code every time
> I tried using ”\transpose c a \Cmajor” (the variable with the C major code).
> This gave me of coarse a change of key signature to A major – not what was
> wanted. Is there a way around this which will allow me to take the C major 
> code
> and transpose the notes down a third to A keeping everything in C (minor).
> 
> 
> 
> John McWilliam
> 
> 
> 
> Sent from [ https://go.microsoft.com/fwlink/?LinkId=550986 | Mail ] for 
> Windows
> 10
> 
> 
> 
> ___
> 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


Transpose

2019-09-07 Thread John McWilliam
Hi,
I am rewriting Baermanns repetitive exercises for clarinet and am 
trying to rationalise my code.  For example broken chords: they start in C 
major then A minor followed by G major, E minor etc. To avoid rewriting the 
code every time I tried using ”\transpose c a \Cmajor” (the variable with the C 
major code). This gave me of coarse a change of key signature to A major – not 
what was wanted. Is there a way around this which will allow me to take the C 
major code and transpose the notes down a third to A keeping everything in C 
(minor).

John McWilliam

Sent from Mail for Windows 10

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


Transpose up or down conditionally

2019-08-28 Thread Steve Cummings

(also posted on Stack Exchange)
version 2.19...

How can I make Lilypond decide whether to transpose up or down depending 
on a target octave/range for one of the transposed notes?


I want to make a set of chord voicings, each in multiple transpositions, 
with the lowest note of each transposed voicing always within a 
specified octave, say between "c" and "b" (the octave below middle C in 
Lilypond notation). This would require some sort of conditional (in 
concept, something like: "try transposing the chord down; if the lowest 
note of the downward transposition is too low, transpose up").


I can't find any relevant snippets in the Lilypond snippet library. I 
found one discussion of conditional transposing here: 
http://lilypond.1069038.n5.nabble.com/problems-trying-to-write-a-conditional-transpose-td148815.html 
but the Scheme code is opaque to me--with the sparse comments I can't 
even understand what the original poster was trying to accomplish, much 
less the proposed solution. And when I tried to test that code using the 
short sample "input"  quoted in the above link I got errors, as follows:


|Parsing...C:...tmpdocument.ly:7:3: In procedure ly:music-set-property! 
in expression ((setter ly:music-property) (quote from-to) music ...): 
C:...tmpdocument.ly:7:3: Wrong type argument in position 1 (expecting 
Prob): from-to |


A fancy-ish implementation might take any specified note in a series as 
the reference point for the up/down decision, or even calculate an 
"average" reference pitch, but for my purposes the reference note will 
always be the first one in the chord, for example the 'c' in the C major 
'< c e g >' triad.


Thank you,
Steve


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


Re: Bug with transpose in functions

2019-07-14 Thread Simon Albrecht

On 12.07.19 20:04, Werner LEMBERG wrote:

Functions like transpose act destructively on their argument, so you
need a copy or the original will get changed.  [...]

How can Joe User find out whether a function is acting destructively?



The Extending Manual tells him about using $ in music function bodies, IIRC.

Best, Simon


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


Re: Bug with transpose in functions

2019-07-12 Thread David Kastrup
Wols Lists  writes:

> On 12/07/19 19:04, Werner LEMBERG wrote:
>> 
>>> Functions like transpose act destructively on their argument, so you
>>> need a copy or the original will get changed.  [...]
>> 
>> How can Joe User find out whether a function is acting destructively?
>> 
> Computer pedant here :-)
>
> Functions do not have side effects, and for any given input they
> always return the same output. So if this is a PROPER function, it
> cannot act destructively :-)

Nobody said it was.  In computer parlese, functions of the kind you
describe are commonly called pure functions.  Nobody said that music
functions were of that kind.

> Obviously it isn't, so it's technically a subroutine that returns a
> value. Dunno how you tell the difference, but that's why you get
> computer languages where all variables are "write once" - everything
> is based on proper functions.
>
> Maybe the documentation should make a point of saying whether
> functions are "proper" or "improper". :-)

I was pretty sure that I wrote some treatise on that but a superficial
search did not turn it up, and if I do not manage to find some treatise
with a superficial search, it would be too much to expect for a new
user.

-- 
David Kastrup

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


Re: Bug with transpose in functions

2019-07-12 Thread David Kastrup
Werner LEMBERG  writes:

>> Functions like transpose act destructively on their argument, so you
>> need a copy or the original will get changed.  [...]
>
> How can Joe User find out whether a function is acting destructively?

All music functions are allowed to do that by definition because it
would be inefficient if every transformation would have to create a
copy.

-- 
David Kastrup

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


Re: Bug with transpose in functions

2019-07-12 Thread Wols Lists
On 12/07/19 19:04, Werner LEMBERG wrote:
> 
>> Functions like transpose act destructively on their argument, so you
>> need a copy or the original will get changed.  [...]
> 
> How can Joe User find out whether a function is acting destructively?
> 
Computer pedant here :-)

Functions do not have side effects, and for any given input they always
return the same output. So if this is a PROPER function, it cannot act
destructively :-)

Obviously it isn't, so it's technically a subroutine that returns a
value. Dunno how you tell the difference, but that's why you get
computer languages where all variables are "write once" - everything is
based on proper functions.

Maybe the documentation should make a point of saying whether functions
are "proper" or "improper". :-)

Cheers,
Wol


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


Re: Bug with transpose in functions

2019-07-12 Thread Werner LEMBERG

> Functions like transpose act destructively on their argument, so you
> need a copy or the original will get changed.  [...]

How can Joe User find out whether a function is acting destructively?


Werner

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


Re: Bug with transpose in functions

2019-07-12 Thread David Kastrup
Immanuel Litzroth  writes:

> This seems to do the wrong thing:
>
>>
> \version "2.19.81"
> testme = #(define-music-function
>(parser location music)
>(ly:music?)
>    #{
>  \transpose c c' {#music } {#music }
>  #})
> \testme g'
>>
> printing out two g'' instead of a g'' and a g'

Functions like transpose act destructively on their argument, so you
need a copy or the original will get changed.  Write $music to get a
copy, or use ly:music-deep-copy .

> Also I found it strange that {#music} is not accepted as an argument with
> the
> following error:
>>tmp.ly:6:16: error: GUILE signaled an error for the expression beginning
> here
>>{#
>>  music}
>>Unbound variable: music}
> It seems to parse the closing } as part of the variable name.

Correct.  Scheme syntax is very simple.  Some characters like ()" act as
delimiters, but most others are only split into words with intervening
spaces.  LilyPond syntax is different, but writing # or $ hands control
over to the Scheme parser.

-- 
David Kastrup

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


Re: Bug with transpose in functions

2019-07-12 Thread Aaron Hill

On 2019-07-11 11:52 pm, Immanuel Litzroth wrote:

This seems to do the wrong thing:




\version "2.19.81"
testme = #(define-music-function
   (parser location music)
   (ly:music?)
   #{
 \transpose c c' {#music } {#music }
 #})
\testme g'



printing out two g'' instead of a g'' and a g'


Consider using $music or ly:music-deep-copy:


\version "2.19.83"
testI = #(define-music-function (music) (ly:music?)
  #{ \transpose c c' $music $music #})
testII = #(define-music-function (music) (ly:music?)
  #{ \transpose c c' #(ly:music-deep-copy music) #music #})
\testI d' \testII e'




Also I found it strange that {#music} is not accepted as an argument 
with

the
following error:
tmp.ly:6:16: error: GUILE signaled an error for the expression 
beginning

here

   {#
 music}
Unbound variable: music}

It seems to parse the closing } as part of the variable name.


Scheme is pretty permissive with what can be part of a symbol, so this 
is one case where whitespace does matter.



-- Aaron Hill

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


Bug with transpose in functions

2019-07-12 Thread Immanuel Litzroth
This seems to do the wrong thing:

>
\version "2.19.81"
testme = #(define-music-function
   (parser location music)
   (ly:music?)
   #{
     \transpose c c' {#music } {#music }
 #})
\testme g'
>
printing out two g'' instead of a g'' and a g'

Also I found it strange that {#music} is not accepted as an argument with
the
following error:
>tmp.ly:6:16: error: GUILE signaled an error for the expression beginning
here
>{#
>  music}
>Unbound variable: music}
It seems to parse the closing } as part of the variable name.
Am I making a mistake?
Immanuel
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: issue with \transpose and \relative

2019-02-07 Thread 智樂喬
Ok, thanks for the clarification. That's something to keep in mind,
although I've never used tags in my scores before. (Only made one score
before, though, so…) I'll keep this in mind if I ever have any strange
issues when I'm using it.

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


Re: issue with \transpose and \relative

2019-02-07 Thread David Kastrup
智樂喬  writes:

> Thanks a lot, David. It works as advertised.  I do think I read about this
> somewhere in the manuals, but I couldn't find it.
>
> This uses really involved code to simulate something that does not
>> really map well to LilyPond's internals so it may interfere with other
>> tricky code.
>>
>
> I'm pretty sure that I'm not at the level of skill to be writing other
> tricky code, so no problem :-)

Well, using tags would be problematic, for example.  They are not
particularly tricky but the likes of \keepWithTag are functions walking
their input, and such functions would miss the parts make-relative
stores for the sake of \relative .

-- 
David Kastrup

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


Re: issue with \transpose and \relative

2019-02-07 Thread 智樂喬
Thanks a lot, David. It works as advertised.  I do think I read about this
somewhere in the manuals, but I couldn't find it.

This uses really involved code to simulate something that does not
> really map well to LilyPond's internals so it may interfere with other
> tricky code.
>

I'm pretty sure that I'm not at the level of skill to be writing other
tricky code, so no problem :-)

For the benefit of anyone on the list who might find this useful, here's
the simple function I'm using this in. It adds falling gliss lines *à la*
sliding falls commonly notated in rock guitar music, and it's probably not
a good implementation, but it works as I'd like it to:

fall = #(define-music-function (input) (ly:music?)
(make-relative (input)
   input
   #{
\afterGrace 16/16
<< $input <>\glissando >>
\transpose c g, {
\once \omit Flag
\once \override Stem.length = #0
\once \override NoteHead.font-size = #-50
\once \hideNotes
$input
}
#}))

Thanks,

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


Re: issue with \transpose and \relative

2019-02-05 Thread David Kastrup
John Doe  writes:

> Hi, all,
>
> The Notation Reference section 1.1.2 says "Music inside a \transpose block
> is absolute unless a \relative is included in the block". I'm writing a
> function that uses \transpose to change a variable's pitch in a function.
>
> How can I check if the music entered was entered in a \relative block? Can
> I?
>
> Below is a minimal example showing the problem I'm having, along with a png
> (attached) demonstrating the output:
>
> \version "2.19.82"
> fall = #(define-music-function (input) (ly:music?)
> #{ $input \transpose c g, $input #})
>   { \fall 4 e2^"absolute"_"right"}
> \relative { \fall 4e,2^"relative"_"wrong" }
>
> I hope this is clear enough—running low on sleep…

It's comparatively crappy but you can do

\version "2.19.82"
fall = #(define-music-function (input) (ly:music?)
(make-relative (input) input #{ $input \transpose c g, $input #}))
  { \fall 4 e2^"absolute"_"right"}
\relative { \fall 4e,2^"relative"_"wrong" }

This uses really involved code to simulate something that does not
really map well to LilyPond's internals so it may interfere with other
tricky code.  Particularly code that tries analyzing LilyPond code.

-- 
David Kastrup

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


issue with \transpose and \relative

2019-02-05 Thread John Doe
Hi, all,

The Notation Reference section 1.1.2 says "Music inside a \transpose block
is absolute unless a \relative is included in the block". I'm writing a
function that uses \transpose to change a variable's pitch in a function.

How can I check if the music entered was entered in a \relative block? Can
I?

Below is a minimal example showing the problem I'm having, along with a png
(attached) demonstrating the output:

\version "2.19.82"
fall = #(define-music-function (input) (ly:music?)
#{ $input \transpose c g, $input #})
  { \fall 4 e2^"absolute"_"right"}
\relative { \fall 4e,2^"relative"_"wrong" }

I hope this is clear enough—running low on sleep…

Thanks,

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


Re: transpose several key signature

2018-05-30 Thread Torsten Hämmerle
David Kastrup wrote
> Excuse me?

Ah, yes, sorry, of course…
I just looked at Ming's example, had (for an unknown reason) something
*\naturalizeMusic* in mind and completely ignored what I had said before
about intervals.

When transposing F major down a minor second, we will get E major quite
naturally without any enharmonic wizardry and, yes, \transpose ef eff or
\transpose e ef etc. would have ruthlessly made Fb major out of it...

Sorry,
Torsten 




--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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


Re: transpose several key signature

2018-05-30 Thread David Kastrup
Torsten Hämmerle  writes:

> Apart from that, LilyPond will use suitable enharmonic key signatures if
> things (i.e. accidentals) are getting too weird.
> In your example, the second key signature (F major) will *not* be converted
> into Fb major (with 6 flats and even one double-flat!) but into E major
> (with only 4 sharps).

Excuse me?

{
  \transpose es d { \key f \major s1 }
  \transpose es eses { \key f \major s1 }
}

LilyPond has no qualms about things getting weird.  The typesetting
stage will bomb out at more than _double_ accidentals (slated to be
changed IIRC), but processing will proceed just fine.  Try
\transpose e feses here.

There have been a few proposals for the sake of transposing instrument
transpositions about weirdness limiting methods, but nothing with
permanent impact so far.

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


Re: transpose several key signature

2018-05-30 Thread Torsten Hämmerle
Hi Ming,

I think there is a general misunderstanding:
When saying "\transpose ef d", ef and d do *not* mean key signatures but
reference pitches defining an interval, nothing more, nothing less.

For specifying a key signature, by the way, you'd also have to state the
mode (e.g. minor, major, dorian, …).
So, \transpose ef d { … } just means "transpose everything in { … } down a
minor second.
You could also have written \transpose c' b or \transpose f e etc.

Just imagine the term "trumpet in Bb". The Bb generally states that the
trumpet will sound a major second lower than notated, i.e. a written C will
sound as a Bb. This also implies that a written A will sound as a G etc. and
is in no way restricted to a key signature.
In fact, this has nothing to do with key signatures at all and also works
for atonal music.
The only difference between the "trumpet in Bb" example and LilyPond's
\transpose is that "trumpet in Bb" implicitly takes C as a reference point,
whereas in LilyPond, both pitches have to be stated.

When taking a closer look, it becomes clear that LilyPond not just
transposes by a given number of semitones, but by considering actual
intervals:
Bb C (two semitones) is a major second, whereas A# C (two semitone, too) is
diminished third.

Apart from that, LilyPond will use suitable enharmonic key signatures if
things (i.e. accidentals) are getting too weird.
In your example, the second key signature (F major) will *not* be converted
into Fb major (with 6 flats and even one double-flat!) but into E major
(with only 4 sharps).

HTH,
Torsten




--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

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


Re: transpose to a set of pitches

2018-02-28 Thread Sirius Barras
On 27 February 2018 at 22:24, Thomas Morley <thomasmorle...@gmail.com>
wrote:

> 2018-02-27 19:12 GMT+01:00 Sirius Barras <turbole...@gmail.com>:
> > I would like to transpose a motif (using \modalTranspose) to a _set_ of
> > different pitches. At the moment this is what I do:
> >
> > scale = {c d e f g a b}
> > motif = {c' e' g' c'}
> > {
> >   \modalTranspose c e \scale \motif
> >   \modalTranspose c g \scale \motif
> >   \modalTranspose c a \scale \motif
> > }
> >
> > How can I do something similar to this:
> >
> > toPitchSet = {e g a}
> > scale = {c d e f g a b}
> > motif = {c' e' g' c'}
> > {
> >   \modalTranspose c \toPitchSet \scale \motif
> > }
> >
> > Many thanks, S.
>
>
> How about:
>
> \version "2.19.65"
>
> %% Based on a function by David K
> multipleModalTransposes =
> #(define-music-function (parser location m scale music)
>   (ly:music? ly:music? ly:music?)
>   ;; If `music' is simple `SequentialMusic', we need to go for 'elements
> instead
>   ;; of 'element. In this case we also need to "unfold" the resulting
>   ;; `possible-elts' one level
>   (let* ((seq-mus? (music-is-of-type? music 'sequential-music))
>  (possible-elts
>(map
>  (lambda (pitch)
>  (ly:music-property
>#{ \modalTranspose c $pitch $scale $music #}
>  (if seq-mus?
> 'elements
> 'element)))
> (event-chord-pitches m
>
> (music-clone m
>   'elements
>   (if seq-mus?
>   (apply append '() possible-elts)
>   possible-elts
>
> toPitchSet = { e g a e b }
> scale = { c d e f g a b }
> motif =
>   %\absolute { c' e' g' c' }
>   %\relative { c' e g c, }
>   %\relative c' { c e g c, }
>   %\fixed c' { c e g c }
>   %\context Voice { c'4 e' g' c' }
>   { c'4 e' g' c' }
>
> \multipleModalTransposes \toPitchSet \scale \motif
>
>
> Cheers,
>   Harm
>

Great! Thanks a lot, s.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: transpose to a set of pitches

2018-02-27 Thread Thomas Morley
2018-02-27 19:12 GMT+01:00 Sirius Barras <turbole...@gmail.com>:
> I would like to transpose a motif (using \modalTranspose) to a _set_ of
> different pitches. At the moment this is what I do:
>
> scale = {c d e f g a b}
> motif = {c' e' g' c'}
> {
>   \modalTranspose c e \scale \motif
>   \modalTranspose c g \scale \motif
>   \modalTranspose c a \scale \motif
> }
>
> How can I do something similar to this:
>
> toPitchSet = {e g a}
> scale = {c d e f g a b}
> motif = {c' e' g' c'}
> {
>   \modalTranspose c \toPitchSet \scale \motif
> }
>
> Many thanks, S.


How about:

\version "2.19.65"

%% Based on a function by David K
multipleModalTransposes =
#(define-music-function (parser location m scale music)
  (ly:music? ly:music? ly:music?)
  ;; If `music' is simple `SequentialMusic', we need to go for 'elements instead
  ;; of 'element. In this case we also need to "unfold" the resulting
  ;; `possible-elts' one level
  (let* ((seq-mus? (music-is-of-type? music 'sequential-music))
 (possible-elts
   (map
 (lambda (pitch)
 (ly:music-property
   #{ \modalTranspose c $pitch $scale $music #}
 (if seq-mus?
'elements
'element)))
(event-chord-pitches m

(music-clone m
  'elements
  (if seq-mus?
  (apply append '() possible-elts)
  possible-elts

toPitchSet = { e g a e b }
scale = { c d e f g a b }
motif =
  %\absolute { c' e' g' c' }
  %\relative { c' e g c, }
  %\relative c' { c e g c, }
  %\fixed c' { c e g c }
  %\context Voice { c'4 e' g' c' }
  { c'4 e' g' c' }

\multipleModalTransposes \toPitchSet \scale \motif


Cheers,
  Harm

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


transpose to a set of pitches

2018-02-27 Thread Sirius Barras
I would like to transpose a motif (using \modalTranspose) to a _set_ of
different pitches. At the moment this is what I do:

scale = {c d e f g a b}
motif = {c' e' g' c'}
{
  \modalTranspose c e \scale \motif
  \modalTranspose c g \scale \motif
  \modalTranspose c a \scale \motif
}

How can I do something similar to this:

toPitchSet = {e g a}
scale = {c d e f g a b}
motif = {c' e' g' c'}
{
  \modalTranspose c \toPitchSet \scale \motif
}

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


Re: \transpose and quoted music

2017-08-07 Thread David Kastrup
Jérôme Plût <plut.jer...@gmail.com> writes:

> Let's say I am typesetting some orchestra music written for a horn in
> D and want to output it for some other, more reasonably-pitched
> instrument.
>
> I entered the music in this way:
>
> global = { \key d \minor }
> cues = \relative { c'4^"Cue" c c c } \addQuote "cues" \cues
> hornA = \transpose c d, \relative {
>   \cueDuring #"cues" #UP s1 c'4 c c c }
> % Both \cues and \hornA are consistently in concert pitch, which
> % is the most idiot-proof way of entering music. The \transpose command
> % is here to help entering the notes from the original source in D.
>
> \score { \transpose c' f << \global \hornA >> }

<< \global ... >> is a bad idea when ... may contain grace notes.  Just
a side remark.

> % I can also produce a score in concert pitch for the case where the
> % horn is replaced by a trombone in an emergency...
>
> Since \transpose has this strange behaviour that it does not touch
> quoted music (... but why?), 

The main idea is that quoted music is already in concert pitch (after
compensating for its own \transposition setting) and any changes you
want to get done from there should be based on the relation between the
resulting instrument (as indicated by its setting of \transposition) and
concert pitch.

> the resulting PDF has the horn notes in F, but the cues are still in
> concert pitch, which is less than fully helpful to the poor horn
> player.

So?  Tell LilyPond what you are doing.

global = { \key d \minor }
cues = \relative { c'4^"Cue" c c c } \addQuote "cues" \cues
hornA = \transpose c d, \relative {
  \cueDuring #"cues" #UP s1 c'4 c c c }
% Both \cues and \hornA are consistently in concert pitch, which
% is the most idiot-proof way of entering music. The \transpose command
% is here to help entering the notes from the original source in D.

\score { \transpose c' f { \global \transposition f \hornA } }

> I know one sure-proof way to solve this (by writing a custom
> \sanetranspose Scheme function that goes deep in the music and
> replaces all the \cueDuring by \transposedCueDuring etc.), but this is
> surely not the most elegant way. Is there a simple way to make
> \transpose behave reasonably?

Just make sure to keep LilyPond informed about the relation of music to
concert pitch.  That's what \transposition is for.

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


\transpose and quoted music

2017-08-07 Thread Jérôme Plût
Let's say I am typesetting some orchestra music written for a horn in
D and want to output it for some other, more reasonably-pitched
instrument.

I entered the music in this way:

global = { \key d \minor }
cues = \relative { c'4^"Cue" c c c } \addQuote "cues" \cues
hornA = \transpose c d, \relative {
  \cueDuring #"cues" #UP s1 c'4 c c c }
% Both \cues and \hornA are consistently in concert pitch, which
% is the most idiot-proof way of entering music. The \transpose command
% is here to help entering the notes from the original source in D.

\score { \transpose c' f << \global \hornA >> }
% I can also produce a score in concert pitch for the case where the
% horn is replaced by a trombone in an emergency...

Since \transpose has this strange behaviour that it does not touch
quoted music (... but why?), the resulting PDF has the horn notes in
F, but the cues are still in concert pitch, which is less than fully
helpful to the poor horn player.

I tried some various combinations to have cues in F, such as those
below, but to no effect at all :

% this would be preferable, because it is locality-preserving
\transpose c' f << \transposition c' \global \hornA >>
% uglier (need to specify the “f” pitch twice) but would still be workable
{ \transposition f \transpose c' f << \global \hornA >> }

I know one sure-proof way to solve this (by writing a custom
\sanetranspose Scheme function that goes deep in the music and
replaces all the \cueDuring by \transposedCueDuring etc.), but this is
surely not the most elegant way. Is there a simple way to make
\transpose behave reasonably?

Thanks,

-- 
Jérôme

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


Re: : Re: transpose range

2017-06-30 Thread Gianmaria Lari
Dear Peter,

I only spent one hour on it and I have not been able to make it working as
I need. It is not clear to me the value I have to set to set the instrument
range  from c, to b,.

But I think that when I will have more time I should be able to modify your
code for that.

* * *

By the way this is a part of your code:

  ((equal? instrument "basso" )
   (if  (< pt -26)  (begin (set! o (+ o 1))) )
   (if  (< pt -24)  (begin (set! o (+ o 1))) )
   (if  (< pt -18)  (begin (set! o (+ o 1))) )

   (if  ( > pt 52/2)  (begin (set! o (- o 1))) )
   (if  ( > pt 41/2)  (begin (set! o (- o 1))) )
   (if  ( > pt 29/2)  (begin (set! o (- o 1))) )
   )

I'm not sure to understand how does it work but I wonder if wouldn't be
possible to check if the note is higher than the instrument upper bound and
if yes just set the note octave to the upper allow octave? And the opposite
in case the note is lower than the lower bound

Thank you Peter for you help.
Gianmaria
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: : Re: transpose range

2017-06-29 Thread David Kastrup
"Peter Gentry"  writes:

> Gianmaria 
>
>  
>
> I have modified the procedure to use pitch-tones to define the
> instrument range.  It makes little difference to the result.
>
>  
>
> I haven’t looked at the possibility of rebuilding the pitch just using
> pitch-tones (yet)

You would not want to do that since you only want to change the octave
without losing enharmonic information.  The calculation could likely be
simplified quite a bit.

-- 
David Kastrup

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


RE: : Re: transpose range

2017-06-29 Thread Peter Gentry
Gianmaria 

 

I have modified the procedure to use pitch-tones to define the instrument 
range.  It makes little difference to the result.

 

I haven’t looked at the possibility of rebuilding the pitch just using 
pitch-tones (yet)

 

Have you had any luck yet?

 

\version "2.19.15"
% -
% include function file instrument_ranges.ly
% usuage include --> \include "./ranges/instrument_ranges.ly"
% usuage call -->   \naturalizeInstrumentRange "instrument" music
% this function will confine all pitches to the individual instruments range
% Note the ranges refer to music transposed for each instrument not the true pitches.
% use % for comment outside scheme function -  use ; inside scheme functions
% -

#(define (naturalize-instrument-range p instrument )
  (let ((o (ly:pitch-octave p))
  (a (* 4 (ly:pitch-alteration p)))
;; alteration, a, in quarter tone steps, for historical reasons
  (n (ly:pitch-notename p))
  (pt (ly:pitch-tones p)))
(define np 0)
(define op (+ (* 14 o) (* n 2) (/ a 2)))


(cond

;; clarinet range e to f#'   (-4 to 29/2)

((equal? instrument "clarinet" )
   (if  (< pt -16)(begin (set! o (+ o 1))) )
   (if  (< pt -10)(begin (set! o (+ o 1))) )
   (if  (< pt -4) (begin (set! o (+ o 1))) )

   (if  ( > pt 52/2)  (begin (set! o (- o 1))) )
   (if  ( > pt 41/2)  (begin (set! o (- o 1))) )
   (if  ( > pt 29/2)  (begin (set! o (- o 1))) )
)
; bass clarinet range eb to f'  (-9/2 to 29/2)

   ((equal? instrument "bass clarinet eb" )
   (if  (< pt -33/2)  (begin (set! o (+ o 1))) )
   (if  (< pt -21/2)  (begin (set! o (+ o 1))) )
   (if  (< pt -9/2)  (begin (set! o (+ o 1))) )

   (if  ( > pt 52/2)  (begin (set! o (- o 1))) )
   (if  ( > pt 41/2)  (begin (set! o (- o 1))) )
   (if  ( > pt 29/2)  (begin (set! o (- o 1))) )
 )
; bass clarinet range c to f'   (-6 to 29/2)

((equal? instrument "bass clarinet c" )
(if  (< pt -18)  (begin (set! o (+ o 1))) )
(if  (< pt -12)  (begin (set! o (+ o 1))) )
(if  (< pt -6)  (begin (set! o (+ o 1))) )

(if  ( > pt 52/2)  (begin (set! o (- o 1))) )
(if  ( > pt 41/2)  (begin (set! o (- o 1))) )
(if  ( > pt 29/2)  (begin (set! o (- o 1))) )
)
;; flute range c to c''  (0 to 18)

((equal? instrument "flute")
(if   (< pt -12)  (begin (set! o (+ o 1))) )
(if   (< pt -6)   (begin (set! o (+ o 1))) )
(if   (< pt 0)(begin (set! o (+ o 1))) )

(if  ( > pt 30)   (begin (set! o (- o 1))) )
(if  ( > pt 24)   (begin (set! o (- o 1))) )
(if  ( > pt 18)   (begin (set! o (- o 1))) )
)
;; alto range d to c''  (1 to 31/2)

 ((equal? instrument "alto")
(if  (< pt -11) (begin (set! o (+ o 1))) )
(if  (< pt -5)  (begin  (set! o (+ o 1))) )
(if  (< pt  1)  (begin  (set! o (+ o 1))) )

(if  ( > pt 55/2)  (begin (set! o (- o 1))) )
(if  ( > pt 43/2)  (begin (set! o (- o 1))) )
(if  ( > pt 31/2)  (begin (set! o (- o 1))) )
) )

(ly:make-pitch o n (/ a 4))

))

% -
% a variable for the notehaed color on pitch change
% -

my-color = #(x11-color 'red)

% -
% this function rebuilds the music object optionally changing pitch and notehead color
% -
#(define (instrumentrange music instrument )

; extract the various portions of the music object
(let ((es (ly:music-property music 'elements))
   (e   (ly:music-property music 'element))
   (p   (ly:music-property music 'pitch)))

; rebuild any 'elements unchanged
(if (pair? es)
   (ly:music-set-property! music 'elements
   (map (lambda (x) (instrumentrange x instrument)) es)))

; rebuild any 'element unchanged
 (if (ly:music? e) (ly:music-set-property! music 'element
(instrumentrange e instrument )))

;rebuild the pitch and if a changed pitch add the color tweak
(if (ly:pitch? p)
  (let ((new-pitch (naturalize-instrument-range p instrument)))
  (ly:music-set-property! music 'pitch new-pitch)
  (if (and (not (equal? p new-pitch)) (color? my-color))
  (ly:music-set-property! music 'tweaks
  (acons  'color my-color
   (acons 'style 'harmonic-mixed
 (ly:music-property music 'tweaks)))

 music))

naturalizeInstrumentRange =
#(define-music-function (parser location  instrument m )
  ( string? ly:music? )
  (instrumentrange m instrument ))

% -
% the Lily test file calling 

Re: : Re: transpose range

2017-06-27 Thread Anthony Youngman



On 26/06/17 22:56, Peter Gentry wrote:

dak@lola:/usr/local/tmp/lilypond$ lilypond scheme-sandbox GNU LilyPond 2.19.59 
Processing `/usr/local/share/lilypond/2.19.59/ly/scheme-sandbox.ly'
Parsing...
guile> (apply - (map ly:pitch-tones (list #{ eis #} #{ fes #})))
1/2
guile>


--
David Kastrup

A semi tone difference is indeed noticeable but surely there is no semitone 
between e sharp and f flat?
It’s the same key on the piano! Where is the semitone?
Instead of enlightening me you simply reply with a superior and dismissive tone 
which is uncalled for.


Two little points.

Firstly, please DON'T reply beneath someone else's signature. Okay, 
you're probably using a broken email client (otherwise it wouldn't let 
you), but it makes things *really* confusing, especially if a non-broken 
client tries to "correct" things and makes it even worse, and


Secondly, if someone comes back at you like this, your immediate 
reaction should be "hang on, is this a corner case" - that's a 
programming term - it's a place where either reality or your assumptions 
change - and it's an *extremely* common cause of errors because all too 
often reality and assumptions don't change in exactly the same place! As 
indeed, is exactly what happened here.


I "often" play in six flats, and am interested in pentatonic (ie all 
black note) folk music, so it was instantly obvious to me what David was 
talking about, although if you're not into that you might not notice 
straight away. And why do people assume everyone plays the piano? My 
piano skills are Grade 0, despite me being a pretty decent amateur 
musician ...


Cheers,
Wol

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


Re: Transpose range Apology

2017-06-27 Thread David Kastrup
"Peter Gentry"  writes:

> Apologies you must think me some kind of retarded idiot.

It's not uncommon for my attempts at joking to bounce.

> I must learn to think a bit before mistyping rubbish but at 76 these
> niceties seem a lost cause.

I've given up much earlier than that.

-- 
David Kastrup

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


Re: Transpose range Apology

2017-06-27 Thread Peter Gentry
Apologies you must think me some kind of retarded idiot. I must learn to
think a bit before mistyping rubbish but at 76 these niceties seem a lost
cause.

 

Yes yes yes there is a problem with the tone tone semitone tone tone tone
semitone  notation and the octave note alteration calculation.

 

In my defence I hurriedly sent of a response to a question with some very
old code. At the time I did not solve the problem of computing a unique
number to represent the pitch.

 

The approximation in the code works because I was only interested in
modifying the octave component of the pitch.  The problem only has an impact
in the calculation of the range of an instrument and has never caused a
problem although I accept it could at the end points of each instrument
range.

 

So please don't be too hard on an old codger who just tried to help a fellow
dabbler out.

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


Re: : Re: transpose range

2017-06-26 Thread David Kastrup
"Peter Gentry"  writes:

> A semi tone difference is indeed noticeable but surely there is no
> semitone between e sharp and f flat?

There is.

> It’s the same key on the piano!

It isn't.

> Where is the semitone?

e sharp (a white key) is a semitone above f flat (another white key) and
your proposed procedure would have been oblivious of that.

That is different to the situation between f sharp and g flat (which
your proposed procedure is designed for) since there is an actual black
key between f and g.

> Instead of enlightening me you simply reply with a superior and
> dismissive tone which is uncalled for.

I let LilyPond _calculate_ that semitone of difference.  Apparently the
code example was too obtuse.  I would not have thought so since we were
talking about Scheme code in the first place, but then I am probably
more skilled talking with computers than humans.

-- 
David Kastrup

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


Re: : Re: transpose range

2017-06-26 Thread Gianmaria Lari
Thank you Peter and David for your help. I'll make some tests in the
followings hours.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: : Re: transpose range

2017-06-26 Thread Thomas Morley
2017-06-26 23:56 GMT+02:00 Peter Gentry <peter.gen...@sunscales.co.uk>:
>
>
> -Original Message-
> From: David Kastrup [mailto:d...@gnu.org]
> Sent: 26 June 2017 15:31
> To: Peter Gentry <peter.gen...@sunscales.co.uk>
> Cc: Lilypond <lilypond-user@gnu.org>
> Subject: Re: : Re: transpose range
>
> "Peter Gentry" <peter.gen...@sunscales.co.uk> writes:
>
>> From: David Kastrup [mailto:d...@gnu.org]
>>
>> "Peter Gentry" <peter.gen...@sunscales.co.uk> writes:
>>>
>>> The numeric pitch (op) is calculated by (define op (+ (* 14 o) (* n
>>> 2) (/ a 2))) “op is a unique number representing the pitch of the
>>> note”
>>
>>> Uh, that's pretty bad since it sees eis as equal to fes.  Anything
>>> wrong with just using (ly:pitch-tones p) instead?
>>
>> a. I had not heard of ly:pitch-tones p) b. for most folks eis is the
>> same sound as fes. Neither my battered old ears or my tuner could
>> detect the difference.  
>
> Well, I am glad that you don't sing in my hearing range then and you should 
> throw away that tuner.
>
> A semitone difference is quite noticeable.
>
> dak@lola:/usr/local/tmp/lilypond$ lilypond scheme-sandbox GNU LilyPond 
> 2.19.59 Processing `/usr/local/share/lilypond/2.19.59/ly/scheme-sandbox.ly'
> Parsing...
> guile> (apply - (map ly:pitch-tones (list #{ eis #} #{ fes #})))
> 1/2
> guile>
>
>
> --
> David Kastrup
>
> A semi tone difference is indeed noticeable but surely there is no semitone 
> between e sharp and f flat?

There is.

> It’s the same key on the piano!

Nope.

> Where is the semitone?

David gave you the proof ;)

> Instead of enlightening me you simply reply with a superior and dismissive 
> tone which is uncalled for.

e sharp and f are the same key, same for e and f flat, but not e sharp
and f flat.
You confused them. As far as I understand David made a joke to have
you rethink what you wrote ;)

Cheers,
  Harm

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


RE: : Re: transpose range

2017-06-26 Thread David Nalesnik
Hi,

On Jun 26, 2017 4:57 PM, "Peter Gentry" <peter.gen...@sunscales.co.uk>
wrote:



-Original Message-
From: David Kastrup [mailto:d...@gnu.org]
Sent: 26 June 2017 15:31
To: Peter Gentry <peter.gen...@sunscales.co.uk>
Cc: Lilypond <lilypond-user@gnu.org>
Subject: Re: : Re: transpose range

"Peter Gentry" <peter.gen...@sunscales.co.uk> writes:

> From: David Kastrup [mailto:d...@gnu.org]
>
> "Peter Gentry" <peter.gen...@sunscales.co.uk> writes:
>>
>> The numeric pitch (op) is calculated by (define op (+ (* 14 o) (* n
>> 2) (/ a 2))) “op is a unique number representing the pitch of the
>> note”
>
>> Uh, that's pretty bad since it sees eis as equal to fes.  Anything
>> wrong with just using (ly:pitch-tones p) instead?
>
> a. I had not heard of ly:pitch-tones p) b. for most folks eis is the
> same sound as fes. Neither my battered old ears or my tuner could
> detect the difference.  

Well, I am glad that you don't sing in my hearing range then and you should
throw away that tuner.

A semitone difference is quite noticeable.

dak@lola:/usr/local/tmp/lilypond$ lilypond scheme-sandbox GNU LilyPond
2.19.59 Processing `/usr/local/share/lilypond/2.19.59/ly/scheme-sandbox.ly'
Parsing...
guile> (apply - (map ly:pitch-tones (list #{ eis #} #{ fes #})))
1/2
guile>


--
David Kastrup

A semi tone difference is indeed noticeable but surely there is no semitone
between e sharp and f flat?
It’s the same key on the piano! Where is the semitone?


E sharp/F or F flat/E are the same key on the piano.  E sharp and F flat
are a semitone apart.

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


RE: : Re: transpose range

2017-06-26 Thread Peter Gentry


-Original Message-
From: David Kastrup [mailto:d...@gnu.org] 
Sent: 26 June 2017 15:31
To: Peter Gentry <peter.gen...@sunscales.co.uk>
Cc: Lilypond <lilypond-user@gnu.org>
Subject: Re: : Re: transpose range

"Peter Gentry" <peter.gen...@sunscales.co.uk> writes:

> From: David Kastrup [mailto:d...@gnu.org]
>
> "Peter Gentry" <peter.gen...@sunscales.co.uk> writes:
>>
>> The numeric pitch (op) is calculated by (define op (+ (* 14 o) (* n
>> 2) (/ a 2))) “op is a unique number representing the pitch of the 
>> note”
>
>> Uh, that's pretty bad since it sees eis as equal to fes.  Anything 
>> wrong with just using (ly:pitch-tones p) instead?
>
> a. I had not heard of ly:pitch-tones p) b. for most folks eis is the 
> same sound as fes. Neither my battered old ears or my tuner could  
> detect the difference.  

Well, I am glad that you don't sing in my hearing range then and you should 
throw away that tuner.

A semitone difference is quite noticeable.

dak@lola:/usr/local/tmp/lilypond$ lilypond scheme-sandbox GNU LilyPond 2.19.59 
Processing `/usr/local/share/lilypond/2.19.59/ly/scheme-sandbox.ly'
Parsing...
guile> (apply - (map ly:pitch-tones (list #{ eis #} #{ fes #})))
1/2
guile> 


--
David Kastrup

A semi tone difference is indeed noticeable but surely there is no semitone 
between e sharp and f flat?
It’s the same key on the piano! Where is the semitone? 
Instead of enlightening me you simply reply with a superior and dismissive tone 
which is uncalled for.



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


Re: : Re: transpose range

2017-06-26 Thread David Kastrup
"Peter Gentry"  writes:

> From: David Kastrup [mailto:d...@gnu.org] 
>
> "Peter Gentry"  writes:
>>
>> The numeric pitch (op) is calculated by (define op (+ (* 14 o) (* n
>> 2) (/ a 2))) “op is a unique number representing the pitch of the
>> note”
>
>> Uh, that's pretty bad since it sees eis as equal to fes.  Anything
>> wrong with just using (ly:pitch-tones p) instead?
>
> a. I had not heard of ly:pitch-tones p)
> b. for most folks eis is the same sound as fes. Neither my battered old ears 
> or my tuner could  detect the difference.  

Well, I am glad that you don't sing in my hearing range then and you
should throw away that tuner.

A semitone difference is quite noticeable.

dak@lola:/usr/local/tmp/lilypond$ lilypond scheme-sandbox
GNU LilyPond 2.19.59
Processing `/usr/local/share/lilypond/2.19.59/ly/scheme-sandbox.ly'
Parsing...
guile> (apply - (map ly:pitch-tones (list #{ eis #} #{ fes #})))
1/2
guile> 


-- 
David Kastrup

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


RE: : Re: transpose range

2017-06-26 Thread Peter Gentry


-Original Message-
From: David Kastrup [mailto:d...@gnu.org] 
Sent: 26 June 2017 13:43
To: Peter Gentry <peter.gen...@sunscales.co.uk>
Cc: 'Gianmaria Lari' <gianmarial...@gmail.com>; Lilypond <lilypond-user@gnu.org>
Subject: Re: : Re: transpose range

"Peter Gentry" <peter.gen...@sunscales.co.uk> writes:

> You will need to modify the attach file (instrument_ranges.ly) since you are 
> only interested in one instrument. 
>
>  
>
> A numeric pitch can be constructed from three components of the 
> lilypond pitch p
>
>  
>
> 1.The octave o obtained from  (ly:pitch-octave p))  
> 2.The note n obtained from (ly:pitch-notename p))  
> 3.The semitone  a  obtained from the alteration  (* 4 
> (ly:pitch-alteration p))  note alteration is in quarter tone steps
>
>  
>
> The numeric pitch (op) is calculated by (define op (+ (* 14 o) (* n 2) (/ a 
> 2)))  “op is a unique number representing the pitch of the note”

Uh, that's pretty bad since it sees eis as equal to fes.  Anything wrong with 
just using (ly:pitch-tones p) instead?

--
David Kastrup

a. I had not heard of ly:pitch-tones p)
b. for most folks eis is the same sound as fes. Neither my battered old ears or 
my tuner could  detect the difference.  




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


Re: : Re: transpose range

2017-06-26 Thread David Kastrup
"Peter Gentry"  writes:

> You will need to modify the attach file (instrument_ranges.ly) since you are 
> only interested in one instrument. 
>
>  
>
> A numeric pitch can be constructed from three components of the lilypond 
> pitch p
>
>  
>
> 1.The octave o obtained from  (ly:pitch-octave p))  
> 2.The note n obtained from (ly:pitch-notename p))  
> 3.The semitone  a  obtained from the alteration  (* 4 
> (ly:pitch-alteration p))  note alteration is in quarter tone steps
>
>  
>
> The numeric pitch (op) is calculated by (define op (+ (* 14 o) (* n 2) (/ a 
> 2)))  “op is a unique number representing the pitch of the note”

Uh, that's pretty bad since it sees eis as equal to fes.  Anything wrong
with just using (ly:pitch-tones p) instead?

-- 
David Kastrup

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


  1   2   3   4   5   >