Multiple dynamic markings under one note - lilypond

I am working with Lilypond and can't figure out how to place two dynamic markings under a whole note. I want it to start piano and then become forte but I don't want to use a crescendo. I'd also rather not indicate two tied half notes. Just p then f under a whole note. This is common in older notation which I am typesetting. Thank you.

You can add one single markup that contains multiple elements to a single note:
\version "2.18.2"
{
f'1 _\markup { \dynamic { f p } }
}

There's an example in the Notation Reference, where it says: "Spacer rests are needed to engrave multiple marks on one note."
If you adapt it to your case, you might write:
\version "2.18.2"
{
R1 |
<< f'1\p { s1\f } >> |
}
However, this triggers the following warning:
warning: Two simultaneous absolute-dynamic events, junking this one
and only the first dynamic mark is printed.
So you must place the second dynamic mark on a different musical moment:
\version "2.18.2"
{
R1 |
<< f'1\p { s4. s16\f s s2 } >> |
}

Related

how to show symbols on top of LilyPond scores?

Santa offered a toy keyboard to my 4-year-old. He enjoys the provided scores, but I'd like to add some songs that we sing together and that are not included in the basic set. Every Key has a symbol (circle, triangle, square) and a color (blue, yellow, purple, red, orange) that is displayed on top of the music score, to help him figure out which keys to press.
I'm not a musician, but I do have a basic understanding on how to write music scores. I've never used lilypond, but I'm a developer and I know latex.
I tried searching for a way to add extra symbols, but I'm not sure this is feasible.
You can draw theses symbols by using some of the various graphics commands found on this page:
https://lilypond.org/doc/v2.24/Documentation/notation/graphic
Store these as markup macros at the top of the LilyPond file, and then call them in the score at the appropriate places.
\version "2.24.0"
blueTriangle = \markup {
\left-align
\with-color "blue"
\triangle ##t
}
orangeCircle = \markup {
\left-align
\with-color "orange"
\draw-circle #1 #0 ##t
}
purpleCircle = \markup {
\left-align
\with-color "purple"
\draw-circle #1 #0 ##t
}
greenSquare = \markup {
\left-align
\with-color "green"
\filled-box #'(0 . 2) #'(0 . 2) #0
}
\new Staff {
g4^\blueTriangle
d'^\orangeCircle
b'^\purpleCircle
f''^\greenSquare
}
This will be a bit tedious if you are placing a symbol above every note. But if you know Scheme you can probably devise a function that reads the note letters and octaves and places the correct symbol in automatically.

Lilypond: Variable page break penalty

In my use of Lilypond, I often face the same kind of problems: Say I have four scores (3-4 lines each) that fit in two pages but not necessarily in one.
I refuse to have page breaks within scores. If possible, I want all the scores on the same page. When it's not possible however, I would like the page break to occur between the first and second scores. If that is not possible either, between the second and the third. And only if that's really necessary between the third and the fourth. That is, by order of preference, | representing the page break:
1 2 3 4 |
1 | 2 3 4
1 2 | 3 4
1 2 3 | 4
Is there a way to achieve that without trying and adding the page breaks myself? Maybe by having page-break penalties going in increasing order after each score (but remaining smaller than the penalty for adding a new page)?
Thank you by advance for your help.
You should use ly:page-turn-breaking (see Optimal page turning in the documentation). You'll probably have to play also with \pageTurn, \noPageTurn, \allowPageTurn in order to have the best control.
Here's a minimal example:
\version "2.19.82"
\header {
title = "Page turn breaking"
}
\paper {
% The default page breaking will make Score 1 end at beginning of page 2.
% The following option prevents this and keeps Score 1 all in the first page.
page-breaking = #ly:page-turn-breaking
}
\score {
\header { piece = "Score 1" }
\new Staff {
\clef "treble_8"
\repeat unfold 14 { c'1*4 }
}
\layout {
indent = 0
system-count = 14
}
}
\score {
\header { piece = "Score 2" }
\new Staff {
\clef "treble_8"
\repeat unfold 13 { e'2 f }
}
\layout {
indent = 0
system-count = 13
}
}

Lyrics for additional verses in LilyPond?

Is there a way in LilyPond to simply list the lyrics corresponding to
additional verses after the end of the music, with one paragraph per verse?
(N.B. This exact question has been asked before, in 2001, but the first answer ("read this book") references a dead URL, while the second (use \context Lyrics) does not work for me, I get LilyPond syntax errors.)
Here's a song under which I want to write the additional verses.
\header{
title = "Hello World"
}
\score {
\relative {
\time 2/4
\clef treble
\key a \major
cis''2 | a4 fis \bar "|."
}
\addlyrics {
He -- | llo world
}
\layout { }
\midi { }
}
\version "2.18.2"
(Sorry about the syntax highlighting, <!-- language: lang-lilypond --> is not yet supported in the Google Code Prettyfier that SO uses.)
I'd like to add verses 2, 3, and 4 underneath, separated from the music, just as words.
I got an answer from Knute Snortum on the LiliyPond mailing list here
After my score block I can add a markup block like this
\markup {
\column {
\line { \null }
\line { 2. Here I go }
}
}
It turns out that this is covered in the LilyPond documentation (printing stanzas at the end) but they use the term 'stanza' and so my searching for 'verse' did not lead me there.
(It is also worth noting this discussion on meta. Posting LilyPond questions here is likely to lead to down-votes since it is not considered programming by many of the SO community. A better Stack Exchange site to post LilyPond questions to is the Music: Practice and Theory Stack Exchange, though, as I found, the LilyPond mailing list is currently the place most likely to elicit full and prompt answers.)

New to ActionScript3, Making calculator and stuck

first time here on stackoverflow and first time scripting in flashCS6.
ill get down to it - the only lang ive done is html and a bit of css. I tried learning java, but gave up since i realised im making flash games so might as well just do AS3. Its pretty similar and not at all at the same time.
As my first original program (i did a tutorial of pong from a website before, got to know a bit about functions and event handlers[http://as3gametuts.com/2011/03/19/pong-1/]), im trying to create a calculator, and what want to know is how i can return the values from two input fields, put them into a logic calculator (say input a is 1 and input b is 2, and there are four functions, each attached to an event listener for the 4 mathematical operations, and i press addition so the calculator goes 2+1=3)
main question here, how do i get the outut text field to display the answer. In java i just used system.out.println(inputA + inputB).
Here i tried to do out.text = ( a + b) (where out is output , a is input and b is input 2)
Here is the code i have so far:
a is input 1, b is input 2
Out is output
and mul, add, sub and div are symbols containing dynamic test fields with instance names adn, sub, mul and div respectively. The symbol instances are the same as the test instances) Ex: i have a text field that says addition, its instance name is adn, then i convert it to a symbol and make its instance name adn as well.
a.text.restrict = "0-9";
b.text.restrict = "0-9";
mul.addEventListener(MouseEvent.CLICK, output);
adn.addEventListener(MouseEvent.CLICK, addition);
sub.addEventListener(MouseEvent.CLICK, subtraction);
div.addEventListener(MouseEvent.CLICK, division);
a.addEventListener(TextInput,input);
b.addEventListener(TextInput,input);
function output ():void
{
out.text=("test to see if output works")
}
function input (e:TextInput)
{
}
function multiplication (e:MouseEvent)
{
}
function addition (e:MouseEvent)
{
}
function subtraction (e:MouseEvent)
{
}
function division (e:MouseEvent)
{
}
thanks guys, and cheers! Also, ill appreciate if anyone can link me to a good video or text tutorial (series) for AS3 introduction. My main focus is to be making PC games and not apps, so keep that in mind.
Check This Out
Also, don't forget to convert value to string, that may be neccessary:
out.text = String(a + b);
Since a text field will give you the input typecast as a string you will need to type cast them to type Number or type int before you can do any kind of math function on them.
And if you want to create a more complex calculator I would suggest you read up on the Math class
function subtraction (e:MouseEvent)
{
var result:Number = Number(a.text) - Number(b.text)
out.text = String(result)
}

Split long string to obtain multiple values/strings - google spreadsheet

I have complex string in which I need to pull single words and/or multiple words.
Here is the string:
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="5" yahoo:created="2013-07-28T18:37:23Z" yahoo:lang="en-US"><diagnostics><publiclyCallable>true</publiclyCallable><user-time>145</user-time><service-time>141</service-time><build-version>38483</build-version></diagnostics><results><Result xmlns="urn:yahoo:cate">**RED**</Result><Result xmlns="urn:yahoo:cate">**GREEN**</Result><Result xmlns="urn:yahoo:cate">**BLUE**</Result><Result xmlns="urn:yahoo:cate">**A, E, I, O, U **</Result><Result xmlns="urn:yahoo:cate">**SOMETIMES Y**</Result></results></query><!-- total: 145 -->
(I really wish that wouldn't scroll, since it makes it difficult to see the entire picture)
Anyway, I need to be able to pull out the:
RED
GREEN
BLUE
A, E, I, O, U
SOMETIMES Y
++++ btw, I tried to make those values BOLD in the big string, but they show up with asteriks instead. Disredard the asterisks. They are not part of the string. However I'm leaving them in there since it makes them easier to find when you look at the entire string)
++++
My goal is to turn that complex string into this:
RED|GREEN|BLUE|A, E, I, O, U|SOMETIMES Y
My preference is to do this on the sheet level using a single nested function (or a combination of multiple functions if necessary).
Failing that, a script version would be preferable to nothing.
I've been at this for hours using SPLIT, FIND, SUBSTITUTE, and a few other things that I tried on a whim - just to try everything. But I've now reached the saturation point of thinking clearly on this, and I'm hoping that someone can put me on a path for how to attack this logically.
I'm truly stumped (and frustrated).
==========================================
I said that I'd post the solution if I figured out the sheet-level solution, so this is it:
=mid(substitute(substitute(regexreplace(mid(A1,find("<Result",A1),find("</query",A1)-find("<Result",A1)),"<.*?>+","-"),"--","|"),"-","|"),2,len(substitute(substitute(regexreplace(mid(A1,find("<Result",A1),find("</query",A1)-find("<Result",A1)),"<.*?>+","-"),"--","|"),"-","|"))-2)
Have you considered using XmlService Services? https://developers.google.com/apps-script/reference/xml-service
Simple example:
/* CODE FOR DEMONSTRATION PURPOSES */
function testXML() {
var result = [];
var document = XmlService.parse('<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="5" yahoo:created="2013-07-28T18:37:23Z" yahoo:lang="en-US"><diagnostics><publiclyCallable>true</publiclyCallable><user-time>145</user-time><service-time>141</service-time><build-version>38483</build-version></diagnostics><results><Result xmlns="urn:yahoo:cate">RED</Result><Result xmlns="urn:yahoo:cate">GREEN</Result><Result xmlns="urn:yahoo:cate">BLUE</Result><Result xmlns="urn:yahoo:cate">A, E, I, O, U</Result><Result xmlns="urn:yahoo:cate">SOMETIMES Y</Result></results></query><!-- total: 145 -->');
var entries = document.getRootElement().getChildren('results')[0].getChildren();
for (var i = 0, len = entries.length; i < len; ++i)
result.push(entries[i].getText());
Logger.log(result.join('|'));
}