A few questions about Scheme functions

2018-10-29 Thread Jérôme Plût
I have a few questions about using Scheme to build Lilypond data.

1. I have some Scheme code that builds custom articulations (more
precisely, it attaches metadata to NoteEvents, and the only way I found
to make this possible is via putting it in a custom, invisible
articulation, but let's not digress too much).

The code I use to declare this custom articulation is:

\layout { \context { \Score
  scriptDefinitions = #(append default-script-alist `(
  ("void" . ((stencil . #f) (direction . ,UP) (avoid-slur . ignore)))
)) } }

However, this is Lilypond code, not Scheme code. My code is in a .scm
file, which is read in the user files as #(load "code.scm").

Does there exist a way to modify the articulations table from inside a
Scheme code block (such as (begin ) )? I tried wrapping this
inside #{ ... #}, but to no effect.


2. A variant of 1. above: say I have a music expression such as

voiceone = \relative {
  c d e f g \mymacro { a b c }
}

where mymacro is defined as

mymacro = #(define-music-function (parser location music) (ly:music?)
  ; ...
  (let (music-rel #{ \relative $music #}) ...))

This works as intended (i.e. the third note is interpreted as a c', not a
c). However, trying to build the exact same expression in a Scheme way
does not work:
  (let (music-rel (make-music 'RelativeOctaveMusic 'element music)) ...)
leaves the music expression untouched.

  So the two questions are:
  2.1 From within the \mymacro function, does there exist a way to know
  that we are called in a \relative scope?
  2.2 Does there exist a “clean Scheme” (no #{ #}) way to interpret the
  parameter as relative music?


3. I have a function that takes some music as input and produces a lyrics
variable, for instance:

voiceone = \relative {
  % the \metadata macro adds some invisible articulation, nothing is
  produced
  c d e\metadata "foobar" f g ...
  %^ HERE ^
}

#(define (myfunction music) ... )

 ; this produces a Lyrics variable containing text "foobar" at the
 appropriate position
\score { \new PianoStaff <<
  \new Staff << \voiceone >>
  % this produces something equivalent to \lyrics { ""2 "foobar"4 }
  \new Lyrics << #(myfunction voiceone) >>
}

My code for now works as I intend it to, but I would like to add info to
the PDF file so that a mouse click on the "foobar" lyrics goes to the
place where \metadata is called (at the HERE comment above)?

(Maybe something with “ly:set-origin!” ? The documentation of this
function is not crystal clear...)

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


A few questions about Scheme functions

2018-10-29 Thread Jérôme Plût
I have a few questions about using Scheme to build Lilypond data.

1. I have some Scheme code that builds custom articulations (more
precisely, it attaches metadata to NoteEvents, and the only way I found
to make this possible is via putting it in a custom, invisible
articulation, but let's not digress too much).

The code I use to declare this custom articulation is:

\layout { \context { \Score
  scriptDefinitions = #(append default-script-alist `(
  ("void" . ((stencil . #f) (direction . ,UP) (avoid-slur . ignore)))
)) } }

However, this is Lilypond code, not Scheme code. My code is in a .scm
file, which is read in the user files as #(load "code.scm").

Does there exist a way to modify the articulations table from inside a
Scheme code block (such as (begin ) )? I tried wrapping this
inside #{ ... #}, but to no effect.



2. A variant of 1. above: say I have a music expression such as

voiceone = \relative {
  c d e f g \mymacro { a b c }
}

where mymacro is defined as

mymacro = #(define-music-function (parser location music) (ly:music?)
  ; ...
  (let (music-rel #{ \relative $music #}) ...))

This works as intended (i.e. the third note is interpreted as a c', not a
c). However, trying to build the exact same expression in a Scheme way
does not work:
  (let (music-rel (make-music 'RelativeOctaveMusic 'element music)) ...)
leaves the music expression untouched.

  So the two questions are:
  2.1 From within the \mymacro function, does there exist a way to know
  that we are called in a \relative scope?
  2.2 Does there exist a “clean Scheme” (no #{ #}) way to interpret the
  parameter as relative music?



3. I have a function that takes some music as input and produces a lyrics
variable, for instance:

voiceone = \relative {
  % the \metadata macro adds some invisible articulation, nothing is
  produced
  c d e\metadata "foobar" f g ...
  %^ HERE ^
}

#(define (myfunction music) ... )

 ; this produces a Lyrics variable containing text "foobar" at the
 appropriate position
\score { \new PianoStaff <<
  \new Staff << \voiceone >>
  % this produces something equivalent to \lyrics { ""2 "foobar"4 }
  \new Lyrics << #(myfunction voiceone) >>
}

My code for now works as I intend it to, but I would like to add info to
the PDF file so that a mouse click on the "foobar" lyrics goes to the
place where \metadata is called (at the HERE comment above)?

(Maybe something with “ly:set-origin!” ? The documentation of this
function is not crystal clear...)

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


a few questions

2013-08-27 Thread Stephanie

Hi all,
I have a few questions which I need help with.
I not sure what the /relative is for?
Also, how do I make chords?
Here is a little code I'd written below, can some one let me know 
if I'm on the right track?

Steph

 \relative c {
 \clef treble
 \key c \major
 \time 4/4

} c4 do every from go from every do c4
 lower = \relative c {
 \clef bass
 \key c \major
 \time 4/4

} g3 from every do can do every from g1

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


Re: a few questions

2013-08-27 Thread Robert Schmaus
Hi Stephanie,

I'm not sure where the track is supposed to lead to, so it's hard to say 
whether you're on the right one. 

The code you've written so far doesn't do anything (and what do you mean with 
c4 do every from go from every do c4?). 

Anyway, there's a learning manual on the Lilypond website (Manuals -- 
Learning) - you should find most of your basic questions answered there if you 
work through that (doesn't take that long), and the notation reference (Manuals 
-- Notation) for the more difficult ones. Of course, you can always direct 
questions to the list, but they probably should be more specific ...

best, 
Rob

-
Von meinem Fliewatüüt gesendet.

On 27 Aug 2013, at 11:36, Stephanie sim.musicsch...@gmail.com wrote:

 Hi all,
 I have a few questions which I need help with.
 I not sure what the /relative is for?
 Also, how do I make chords?
 Here is a little code I'd written below, can some one let me know if I'm on 
 the right track?
 Steph
 
 \relative c {
 \clef treble
 \key c \major
 \time 4/4
 
 } c4 do every from go from every do c4
 lower = \relative c {
 \clef bass
 \key c \major
 \time 4/4
 
 } g3 from every do can do every from g1
 
 ___
 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: a few questions

2013-08-27 Thread Paul Morris
Here's a discussion of \relative mode:
http://lilypond.org/doc/v2.16/Documentation/learning/simple-notation

The easiest way to enter notes is by using \relative mode. In this mode,
the octave is chosen automatically by assuming the following note is always
to be placed closest to the previous note, i.e., it is to be placed in the
octave which is within three staff spaces of the previous note.

And a chord (or other harmonic interval) is created using   like this:

c e g4  c f a2

More on chords here:
http://lilypond.org/doc/v2.16/Documentation/learning/combining-notes-into-chords

Cheers,
-Paul



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/a-few-questions-tp149856p149870.html
Sent from the User mailing list archive at Nabble.com.

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


Re: a few questions

2013-08-27 Thread Tim Roberts
Stephanie sim.musicsch...@gmail.com wrote:
 I have a few questions which I need help with.
 I not sure what the /relative is for?

Ordinarily, notes in Lilypond specify not only the pitch, but the
octave.  Middle C is c' -- third-space C is c'' -- two ledger lines C is
c'''.  Similarly, 2nd space bass clef C is c -- two ledger lines below
is c, -- octave below that is c,, .  Note that c4 means a quarter
note.  The 4 is not an octave number.

It can get tedious to write all those ticks and commas on every note. 
So, most people use relative mode, where each note is assumed to be
close to the note just before.  \relative c says that the following
block is starting close to the C below middle C.  That applies only to
the stuff INSIDE the braces.

Did you type your message on a phone?  I'm wondering if it was
auto-correct that changed your scale to:

c4 do every from go from every do c4


So, you probably want something similar to this:

upper = \relative c' {
\clef treble
\key c \major
\time 4/4
c4 d e f | g4 f e d | c1
}

lower = \relative c {
\clef bass
\key c \major
\time 4/4
g4 f e d | c4 d e f | g1
}

\new PianoStaff 
  \new Staff \upper
  \new Staff \lower


-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.


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


Re: a few questions

2013-08-27 Thread Stan Sanderson
Note that the closing ” were cut off from the end of the example in the 
email.

Stan

On Aug 27, 2013, at 12:40 PM, Tim Roberts t...@probo.com wrote:

 similar to this:
 
 upper = \relative c' {

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


A few questions

2005-12-27 Thread Jannik Jeppesen



Hi... is there really no one who ca´n help me with 
this. Please...?

  I have a few 
  questions.
  
  1. Why does the following create a .pdf and a 
  midi, but when I play the .midi file it just stops... it never plays 
  anything?
  2. I want it only to show the chord names, not 
  the notes. how can I do that? 
  3. How do I generate "\" signs inside the lines, 
  so I can show when to play the Chord that way? An example:4 strokes on 
  the guitar:\ \ \ \
  4. Another question: I want to create aly 
  file with only one D-chord played on the guitar. How is that 
  possible?
  -
  \version "2.6.3"
  
  \header{title = "Improvise"composer = 
  "Jannik Jeppesen"}
  
  chordline = \chordmode { \repeat volta 
  20 { a1:m c g e:m }}
  
  \score { 
  \chordline \layout {} }\score { 
  \unfoldRepeats \chordline \midi { \tempo 4 = 120 }}
  ---
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: A few questions

2005-12-27 Thread Graham Percival


On 26-Dec-05, at 12:52 PM, Jannik Jeppesen wrote:


I have a few questions.


Please allow a few days for responses.

 1. Why does the following create a .pdf and a midi, but when I play 
the .midi file it just stops... it never plays anything?


Some versions of lilypond have bugs with midi generation.  What version 
of lilypond are you using?


3. How do I generate \ signs inside the lines, so I can show when to 
play the Chord that way? An example: 4 strokes on the guitar: \ \ \ \


I think it's \\.
c4^\markup{ \\ \\ \\ \\}

- Graham


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


Re: A few questions

2005-12-27 Thread Jannik Jeppesen
What version 
of lilypond are you using?


I am using version 2.6.3


I have a few questions.


Please allow a few days for responses.

1. Why does the following create a .pdf and a midi, but when I play 
the .midi file it just stops... it never plays anything?


Some versions of lilypond have bugs with midi generation.  What version 
of lilypond are you using?


3. How do I generate \ signs inside the lines, so I can show when to 
play the Chord that way? An example: 4 strokes on the guitar: \ \ \ \


I think it's \\.
c4^\markup{ \\ \\ \\ \\}

- Graham


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


Re: A few questions

2005-12-27 Thread VSD
  1. Why does the following create a .pdf and a midi, but when I play  
the .midi file it just stops... it never plays anything?


perhaps version 2.6.3 has some bug in midi generation. If I remember it  
was fixed in 2.6.4, but I'm not sure. in version 2.7.x, your example yelds  
a correct midi file.


  2. I want it only to show the chord names, not the notes. how can  
I do that?


you have to use a ChordNames context in the \score section

  3. How do I generate \ signs inside the lines, so I can show when to  
play the Chord that way? An example: 4 strokes on the guitar: \ \ \ \


by inside the lines you mean inside the staff? if I get you right, you  
have to set the noteheads to slashes. these are / signs, not \. For  
the last one I guess you should use markups with \\.


Is this what you want?:

%%

\header
{
title = Improvise
composer = Jannik Jeppesen
}

chordline = \chordmode {
  \repeat volta 20 {
a1:m c g e:m
  }
}

rythmline = \relative c''
{
  \override NoteHead #'style = #'slash
  \override Stem #'transparent = ##t % or not
  \repeat volta 20 {
b4 b b b
b b b b
b b b b
b b b b
  }
}

\score {
  
\context ChordNames {
  \chordline
}
\context Staff {
  \rythmline
}
  
  \layout {}
}

\score {
  \unfoldRepeats \chordline
  \midi { \tempo 4 = 120 }
}

%% EOF 




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


Re: A few questions

2005-12-27 Thread D Josiah Boothby

On Tue, 27 Dec 2005, Jannik Jeppesen wrote:

Hi... is there really no one who ca?n help me with this. Please...?
 I have a few questions.


As a general piece of advice that unfortunately not very helpful with any 
of the questions that you asked, splitting up your questions is a very 
good idea. Along with this, instead of an email subject reading A few 
questions or I have a question or Lilypond is confusing, a subject 
that directly pertains to the question at hand would help the community in 
a number of ways. Most helful to yourself in the sense that those of us 
who might know enough about midi (for instance) could help you with a 
midi-related question; but also helpful to other users who might have the 
same question, but who have not (yet) asked the community.


Good luck. I think you'll find that if you stick with Lilypond, the 
quality of output alone is very rewarding, but the way it all works -- 
text based entry, so having a generally logical organization system -- 
saves time and makes one wonder why one ever used Finale or Sibelius 
before.


Josiah___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: A few questions

2005-12-27 Thread Jannik Jeppesen
Hi VSD thanx for your answer. The file you have created is perfect. But it 
seems that I have some midi problems... It opens in media player, but it 
does not play anything.

I am using version 2.6.4-5 on windows any Ideas?

Hi Josiah... I am sorry about my title of this question. I usually give my 
questions good titles. dont know what happened this time:-) Sorry.


%%


\header
{
title = Improvise
composer = Jannik Jeppesen
}

chordline = \chordmode {
  \repeat volta 20 {
a1:m c g e:m
  }
}

rythmline = \relative c''
{
  \override NoteHead #'style = #'slash
  \override Stem #'transparent = ##t % or not
  \repeat volta 20 {
b4 b b b
b b b b
b b b b
b b b b
  }
}

\score {
  
\context ChordNames {
  \chordline
}
\context Staff {
  \rythmline
}
  
  \layout {}
}

\score {
  \unfoldRepeats \chordline
  \midi { \tempo 4 = 120 }
}

%% EOF 






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


Re: A few questions

2005-12-27 Thread Jannik Jeppesen

Hi, it now looks as this:

 EE  E  E7  A7A7
| /  /  /  / | /  / /  / | / /  /  / | /  / /  / | /  / /  / | /  /  / 
/ |

E  E   B7A7 E   B7
| /  /  /  / | /  /  /  / | /  /  /  / | /  /  /  / | /  /  /  / | /  /  / 
/ |


I want it to look like this:

EE  E  E7
| /  /  /  / | /  /  /  / | /  /  /  / | /  /  /  / |
A7A7  E  E
| /  /  /  / | /  /  /  / | /  /  /  / | /  /  /  / |
H7A7 E H7
| /  /  /  / | /  /  /  / | /  /  /  / | /  /  /  / |

1. How does I tell lilly how many bars in each line? and that it shall not 
start first bar moved in to the paper?

2. How does I change B7 to H7 ? (the danish way of a B7?)
3. Is this possible:
| E  /  /  / | E  /  /  / | E  /  /  / | E7  /  /  /  |

| A7 /  /  / | A7 /  /  / | E /  /  / | E  /  /   /  |

| H7 /  /  / | A7 /  /  / | E /  /  / | /  H7  /  / |

Best reguards
Jannik

%
\header
{
title = 12 takters Blues
composer = Jannik Jeppesen
}

chordline = \chordmode {
  \repeat volta 20 {
e1 e e e:7
a:7 a:7 e e
b:7 a:7 e b:7
  }
}

rythmline = \relative c''
{
  \override NoteHead #'style = #'slash
  \override Stem #'transparent = ##t
  \repeat volta 20 {
b4 b b b b b b b b b b b b b b b
b4 b b b b b b b b b b b b b b b
b4 b b b b b b b b b b b b b b b
  }
}

\score {
  
\context ChordNames {
  \chordline
}
\context Staff {
  \rythmline
}
  
  \layout {}
}

\score {
  \unfoldRepeats \chordline
  \midi { \tempo 4 = 120 }
}
%% 




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


Re: A few questions

2005-12-27 Thread fiëé visuëlle

Am 2005-12-27 um 22:37 schrieb Jannik Jeppesen:


1. and that it shall not start first bar moved in to the paper?


\layout { indent = 0\cm }


2. How does I change B7 to H7 ? (the danish way of a B7?)


use \germanChords in the ChordNames context


Greetlings from Lake Constance
---
fiëé visuëlle
Henning Hraban Ramm
http://www.fiee.net
http://angerweit.tikon.ch/lieder/
http://www.cacert.org (I'm an assurer)




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


Re: A few questions

2005-12-27 Thread fiëé visuëlle

Am 2005-12-27 um 23:40 schrieb Jannik Jeppesen:

use \germanChords in the ChordNames context


Have tried some different versions now, is it like this you meen? I  
cant get it to whrite H7


It's \semiGermanChords, sorry.
But I don't think it'll do anything if you put it *after* your chords...

Please get used to look at the docs yourself!
This was in http://www.lilypond.org/doc/v2.7/Documentation/user/ 
lilypond/Printing-chord-names.html



Greetlings from Lake Constance
---
fiëé visuëlle
Henning Hraban Ramm
http://www.fiee.net
http://angerweit.tikon.ch/lieder/
http://www.cacert.org (I'm an assurer)




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


Re: A few questions

2005-12-27 Thread VSD

Hi, it now looks as this:

[...]

I want it to look like this:


please read the manual :)

in this case, use line breaks: put \break after each e.g 4 bars



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


Re: A few questions

2005-12-27 Thread Jannik Jeppesen

Hi, thanks. offcause... that helped:-)
believe me or not, but I am really reading the manual... But it really just 
slips my mind everytime I need something new. I never can find what I am 
looking for.


Is it possible to Make all the bars exact the same size? It does not look 
good that the bars does not stand exactly above each other

Any Ideas (or just a link to the manual:-))

Jannik 




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


Re: A few questions

2005-12-27 Thread D Josiah Boothby

On Wed, 28 Dec 2005, Jannik Jeppesen wrote:
Is it possible to Make all the bars exact the same size? It does not look 
good that the bars does not stand exactly above each other

Any Ideas (or just a link to the manual:-))


If you search through the mailing list archives, you will find extensive 
discussion on this matter.


Josiah


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


Re: A few questions

2005-12-27 Thread Jay Hamilton, Sound and Silence
Don't know if this will help but I ran into this same problem and 
discovered that if I changed the .midi  to .mid everything played, don't 
know why but it's consistent that I have to do this.

Jay

Jannik Jeppesen wrote:

Hi VSD thanx for your answer. The file you have created is perfect. 
But it seems that I have some midi problems... It opens in media 
player, but it does not play anything.

I am using version 2.6.4-5 on windows any Ideas?

Hi Josiah... I am sorry about my title of this question. I usually 
give my questions good titles. dont know what happened this 
time:-) Sorry.


%%



\header
{
title = Improvise
composer = Jannik Jeppesen
}

chordline = \chordmode {
  \repeat volta 20 {
a1:m c g e:m
  }
}

rythmline = \relative c''
{
  \override NoteHead #'style = #'slash
  \override Stem #'transparent = ##t % or not
  \repeat volta 20 {
b4 b b b
b b b b
b b b b
b b b b
  }
}

\score {
  
\context ChordNames {
  \chordline
}
\context Staff {
  \rythmline
}
  
  \layout {}
}

\score {
  \unfoldRepeats \chordline
  \midi { \tempo 4 = 120 }
}

%% EOF 






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




--
Childhood is a Journey not a race- Emma Sadinsky aged 8
Jay Hamilton
Sound and Silence
206-328-7694
www.soundand.com



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


A few questions

2005-12-26 Thread Jannik Jeppesen



Hi all.

I have a few questions.

1. Why does the following create a .pdf and a midi, 
but when I play the .midi file it just stops... it never plays 
anything?
2. I want it only to show the chord names, not the 
notes. how can I do that? 
3. How do I generate "\" signs inside the lines, so 
I can show when to play the Chord that way? An example:4 strokes on the 
guitar:\ \ \ \
4. Another question: I want to create aly 
file with only one D-chord played on the guitar. How is that 
possible?
-
\version "2.6.3"

\header{title = "Improvise"composer = 
"Jannik Jeppesen"}

chordline = \chordmode { \repeat volta 20 
{ a1:m c g e:m }}

\score { 
\chordline \layout {} }\score { 
\unfoldRepeats \chordline \midi { \tempo 4 = 120 }}
---
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user