LilyPond missing repeat bar end line - lilypond

New to LilyPond and trying to use it to transcribe some bagpipe music. In this score there are two sets of repeats, however it is not adding the repeat bar end to the first, only the second. Even if I try to force it with \bar ":|." it is just ignored.
\score {
\header {
}
{
\clef "treble"
\time 3/4
\hideKeySignature
\repeat volta 2 {
\bar ".|:"
\grg a8. b16 \dblc c4 \grg e
\grg a8. b16 \dblc c4~ c4
\dblb b8 \grG a \dblb b4~ b4
\grg c16. b32 \grg a16. b32 \dblc c4~ c4
\break
\grg a8. b16 \dblc c4 \grg e
\grg a8. b16 \dblc c4~ c4
\dblb b8 \grG a \dblb b4 \thrwd d4
\dblc c8. b16 \grg a4~ a4
%% No bar end repeat line here?
}
\break
\repeat volta 2 {
\bar ".|:"
\thrwd d8. e16 \grg f4 A
\grf g8 f \dble e4~ e4
\thrwd d8 c \dblb b4~ b4
\grg c16. b32 \grg a16. b32 \dblc c4~ c4
\break
\thrwd d8. e16 \grg f4 A
\grf g8 f \dble e4~ e4
\thrwd d8 c \dblb b4 \thrwd d4
\dblc c8. b16 \grg a4~ a4
}
}
}
This code produces .
Where I would like repeat bar end marking to go after the second line.

The reason that you aren't getting the repeat barline at the end of the first section, is that you are forcing the barline to be: \bar ".|:".
LilyPond is using this as the barline definition for not only the start of the second section, but also for the end of the first section; LilyPond considers this to be a single barline event (as you'd expect if there wasn't at a line break here).
If you really want to force the repeat barline definition in the middle of the piece (between the repeated sections), you should use the compound barline: \bar ":|.|:".
However, in this case it much easier if you don't force the barline at all; remove this line and the \repeat volta commands will get the barlines right without it.

This seems to work. It has something to do with forcing the bar lines.
\version "2.20.0"
\include "bagpipe.ly"
\score {
\header {
}
{
\clef "treble"
\time 3/4
\hideKeySignature
\repeat volta 2 {
\bar ".|:"
\grg a8. b16 \dblc c4 \grg e
\grg a8. b16 \dblc c4~ c4
\dblb b8 \grG a \dblb b4~ b4
\grg c16. b32 \grg a16. b32 \dblc c4~ c4
\break
\grg a8. b16 \dblc c4 \grg e
\grg a8. b16 \dblc c4~ c4
\dblb b8 \grG a \dblb b4 \thrwd d4
\dblc c8. b16 \grg a4~ a4
%% No bar end repeat line here?
}
\break
\repeat volta 2 {
%\bar ".|:"
\thrwd d8. e16 \grg f4 A
\grf g8 f \dble e4~ e4
\thrwd d8 c \dblb b4~ b4
\grg c16. b32 \grg a16. b32 \dblc c4~ c4
\break
\thrwd d8. e16 \grg f4 A
\grf g8 f \dble e4~ e4
\thrwd d8 c \dblb b4 \thrwd d4
\dblc c8. b16 \grg a4~ a4
}
}
}
Notice that I included the "bagpipe.ly" file and I have a version number. Be sure to post complete working examples in the future.

Related

Finding postive and negative anchors for RPN (in faster RCNN)

I have been going through Faster RCNN Paper and I am facing a trouble understanding how to find out the positive and negative anchors at the time of training RPN's
As per the paper (Section 3.1.2), for each anchor, authors assign a positive label for
The anchor/anchors with the highest IoU overlap with a ground-truth box
An anchor that has IoU overlap higher than 0.7 with any ground-truth-box
for finding the negative proposal (background proposal), go through the remaining anchors and assign a negative label if
IoU is less than 0.3 for all ground-truth box
The remaining anchors even after this step are ignored while training.
EXAMPLE
G/A
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
G1
0.54
0.44
0.02
0.03
0
0.25
0.78
0.71
0.29
0.01
G2
0.63
0.28
0.68
0.62
0.9
0.21
0.73
0.26
0.27
0.14
G3
0.66
0.26
0.03
0.64
0.54
0.53
0.47
0.46
0.15
0.02
After applying rule 1 (for each ground truth, find the maximum IoU with anchor and assign it as positive), So
For G1, the highest value is for A7, so A7 is matched to G1
For G2, the highest value is for A5, so A5 is matched to G2
For G3, the highest value is for A1, so A1 is matched to G3
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
G1
G2
G1
After applying rule 2 we will get (for each anchor box, if IOU is greater than 0.7, then assign to the ground-truth)
For A8, the maximum value occurs with G1, so A8 is matched with G1
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
G1
G2
G1
G1
After applying rule 3 we will get
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
G1
G2
G1
G1
N
N
Now all the remaining one are marked as ignored.
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
G1
I
I
I
G2
I
G1
G1
N
N
My questions :
I wanted to know if my understanding is right or wrong ?
Also, if the rules are applied in different order then will it change the final output ?
In the above example, for rule 1 if suppose G2 maximum is also A7, then A7, then how should one decide G1 or G2 (I suppose choose the one which has the maximum, but I am not sure though)
Thanks.

LilyPond: adding a newpage

I filled a chord grid in LilyPond which you can see the output here. It takes the space of a full-page so I wanted to add a few more lines to a new page. I tried to add it in my score but this stack all the cells the one on the others. So how can I add a new page in LilyPond?
Here is my attempt:
% LilyBin
\version "2.19.55"
#(set-global-staff-size 18)
% si cette valeur change modifier la valeur de rlineto ci-dessous
\header {
tagline = ##f
composer = "The Cure"
title = "Friday I'm in Love"
}
\paper {
#(set-paper-size "a4")
page-count = #1 % forçage du nombre de pages
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% La fonction pour diviser une case en 2 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
"\\/" =
#(define-music-function
(parser location mus1 mus2) ( ly:music? ly:music? )
#{
\stopStaff
\once \override Staff.StaffSymbol.stencil =
$(lambda (grob)
(let* ((staff (ly:staff-symbol::print grob))
(X-ext (ly:stencil-extent staff X))
(Y-ext (ly:stencil-extent staff Y)))
(ly:grob-set-property! grob 'layer -10)
(ly:stencil-add
(make-line-stencil
(ly:staff-symbol-line-thickness grob)
(car X-ext) (car Y-ext) (cdr X-ext) (cdr Y-ext))
staff)))
\startStaff
\once \override ChordName.extra-offset = #'(1 . .5)
$mus1
\once \override ChordName.extra-offset = #'(3 . -3)
$mus2
\stopStaff
\startStaff
#})
%%%%%%%%%%%%%%%%%
grille = \chordmode {
\bar "[|:"
d1
g1
d1
a1
\break
b1:m
g1
d1
a1
\bar ":|]"
\break
\bar "[|:"
d1
g1
d1
a1
\break
b1:m
g1
d1
a1
\bar ":|]"
\break
g1
a1
b1:m
g1
\break
d1
a1
\stopStaff
\bar "" s \bar "" s
\break
\startStaff
d1
g1
d1
a1
\break
b1:m
g1
d1
a1
\break
d1
g1
d1
a1
\break
b1:m
g1
d1
a1
\break
d1
g1
d1
a1
\break
b1:m
g1
d1
a1
\break
g1
a1
b1:m
g1
\break
d1
a1
\stopStaff
\bar "" s \bar "" s
\bar ".."
}
marques = \relative c' {
s1 ^\markup \bold \box \fontsize #7 Intro s1*7
s1 ^\markup \bold \box \fontsize #7 VerseI s1*7
s1 ^\markup \bold \box \fontsize #7 Chorus s1*7
s1 ^\markup \bold \box \fontsize #7 VerseII s1*7
s1 ^\markup \bold \box \fontsize #7 Solo s1*7
s1 ^\markup \bold \box \fontsize #7 VerseIII s1*7
s1 ^\markup \bold \box \fontsize #7 Chorus s1*7
}
\score{
\layout {
indent = 0 % pas de décalage même à la première ligne
\context {
\Score
\omit Clef % Cacher la clef
\omit TimeSignature % cacher la métrique
\omit BarNumber % cacher les numéros de mesures
\override SpacingSpanner.strict-note-spacing = ##t % permet d’avoir toutes les mesures de même longueur
proportionalNotationDuration = #(ly:make-moment 1/16) % durée de référence pour espacer la musique
}
}
<<
\new Staff \with { % la portée qui recevra les repères
\remove "Staff_symbol_engraver" % cacher la portée
}
\marques % la variable contenant les repères
\new ChordNames \with { % la portée qui recevra la grille harmonique
\override ChordName.extra-offset = #'(10 . -1 ) % déplacer les noms des accords
\override BarLine.bar-extent = #'(-5 . 5) % définir la taille des barres de mesures
\consists "Bar_engraver" % afficher les barres de mesures
\override StaffSymbol.line-positions = #'( -10 10 ) % definir une portée de 2 lignnes
\consists "Staff_symbol_engraver" % afficher la portée
\consists "Percent_repeat_engraver" % afficher le signe "%" pour les mesures répétées
}
\grille % la variable contenant la grille harmonique proprement dite
>>
}
I'm stoopid. In the documentation one can read that should you want to add a new line just do:
\paper {
...
page-breaking = #ly:page-turn-breaking
...
}
And then place a \pageBreak

Lilypond: adding arrows between cells of a chord grid

I filled a chord grid in LilyPond which you can see the output here. I want to add some arrows to write a syncope.
I thought about adding slurs:
grille = \chordmode {
\bar "[|:"
d1(
g1)
...
But it doesn't modify anything.
Here is the code:
% LilyBin
\version "2.19.55"
#(set-global-staff-size 18)
% si cette valeur change modifier la valeur de rlineto ci-dessous
\paper {
page-breaking = #ly:page-turn-breaking
}
\header {
tagline = ##f
composer = "The Cure"
title = "Friday I'm in Love"
}
\paper {
#(set-paper-size "a4")
page-count = #1 % forçage du nombre de pages
page-breaking = #ly:page-turn-breaking
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% La fonction pour diviser une case en 2 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
"\\/" =
#(define-music-function
(parser location mus1 mus2) ( ly:music? ly:music? )
#{
\stopStaff
\once \override Staff.StaffSymbol.stencil =
$(lambda (grob)
(let* ((staff (ly:staff-symbol::print grob))
(X-ext (ly:stencil-extent staff X))
(Y-ext (ly:stencil-extent staff Y)))
(ly:grob-set-property! grob 'layer -10)
(ly:stencil-add
(make-line-stencil
(ly:staff-symbol-line-thickness grob)
(car X-ext) (car Y-ext) (cdr X-ext) (cdr Y-ext))
staff)))
\startStaff
\once \override ChordName.extra-offset = #'(1 . .5)
$mus1
\once \override ChordName.extra-offset = #'(3 . -3)
$mus2
\stopStaff
\startStaff
#})
%%%%%%%%%%%%%%%%%
grille = \chordmode {
\bar "[|:"
d1
g1
d1
a1
\break
b1:m
g1
d1
a1
\bar ":|]"
\break
\bar "[|:"
d1
g1
d1
a1
\break
b1:m
g1
d1
a1
\bar ":|]"
\break
g1
a1
b1:m
g1
\break
d1
a1
\stopStaff
\bar "" s \bar "" s
\break
\startStaff
d1
g1
d1
a1
\break
b1:m
g1
d1
a1
\break
d1
g1
d1
a1
\break
b1:m
g1
d1
a1
\break
d1
g1
d1
a1
\break
b1:m
g1
d1
a1
\pageBreak
\break
g1
a1
b1:m
g1
\break
d1
a1
\stopStaff
\bar "" s \bar "" s
\break
\startStaff
\set Score.repeatCommands = #'((volta "4 X"))
\bar "[|:"
b1:m
c:9
d1
a1
\set Score.repeatCommands = #'((volta "#f"))
\bar ":|]"
}
marques = \relative c' {
s1 ^\markup \bold \box \fontsize #7 Intro s1*7
s1 ^\markup \bold \box \fontsize #7 VerseI s1*7
s1 ^\markup \bold \box \fontsize #7 Chorus s1*7
s1 ^\markup \bold \box \fontsize #7 VerseII s1*7
s1 ^\markup \bold \box \fontsize #7 Solo s1*7
s1 ^\markup \bold \box \fontsize #7 VerseIII s1*7
s1 ^\markup \bold \box \fontsize #7 ChorusII s1*7
s1 ^\markup \bold \box \fontsize #7 Bridge s1*7
}
\score{
\layout {
indent = 0 % pas de décalage même à la première ligne
\context {
\Score
\omit Clef % Cacher la clef
\omit TimeSignature % cacher la métrique
\omit BarNumber % cacher les numéros de mesures
\override SpacingSpanner.strict-note-spacing = ##t % permet d’avoir toutes les mesures de même longueur
proportionalNotationDuration = #(ly:make-moment 1/16) % durée de référence pour espacer la musique
}
}
<<
\new Staff \with { % la portée qui recevra les repères
\remove "Staff_symbol_engraver" % cacher la portée
}
\marques % la variable contenant les repères
\new ChordNames \with { % la portée qui recevra la grille harmonique
\override ChordName.extra-offset = #'(10 . -1 ) % déplacer les noms des accords
\override BarLine.bar-extent = #'(-5 . 5) % définir la taille des barres de mesures
\consists "Bar_engraver" % afficher les barres de mesures
\override StaffSymbol.line-positions = #'( -10 10 ) % definir une portée de 2 lignnes
\consists "Staff_symbol_engraver" % afficher la portée
\consists "Percent_repeat_engraver" % afficher le signe "%" pour les mesures répétées
}
\grille % la variable contenant la grille harmonique proprement dite
>>
}
I'm new to Lilypond myself, but I was able to get the arrow by creating a custom shape in the markup of a measure /mark.
See this example (based on your original output): http://lilybin.com/k7kykq/142
Please forgive the fact that I hard-coded the shape. I don't yet know of an easier way of drawing it.
Idea inspired by: http://lsr.di.unimi.it/LSR/Item?id=1050

How to start measure halfway?

In my hymn, I need to start the first measure halfway through. It has a time of 3/4, but I have to insert two empty, non-showing eighth notes. How do I do that?
I've used o4 o4 c8[ d] below for the first measure, but lilypond does not like this. What's the right way?
Here's the line:
o4 o4 c8[ d] e4 e4 e8[ f] g4 g4 f8[ e] d4 d4 g8[ f] e2
For upbeats, there's a special command \partial available. In your case, you should notate a quarter partial:
\relative c' {
\time 3/4
\partial 4
c8 d | e4 e4 e8 f | g4 g4 f8 e | d4 d4 g8 f | e2
}
This results in:

Circuit design that outputs square of binary input

So for my digital logic course, we were asked to design a combinational circuit with 3 inputs, and an output that generates the square of the binary input. I assume she means the inputs are 3 bit binary numbers 0-7. In describing the solution, she mentioned 3 general steps of 1. Finding truth table, 2. deriving the function and 3. Simplifying
I understand perfectly how to do this when the output is a single function (combine the instances of a true function, simplify etc.) In our only relevant example, we input BCD numbers 0-9 and output their excess-3 equivalent, then simplified a k-map for each of the 4 output variables (a map for W, the leftmost bit, X the second-to-left bit, etc.). Not sure what to do from here tho. Thanks for the help
As you already mentioned, you need to fetch the inputs in binary, calculate the square in binary format (the binary length will increase from 3 to 6).
But, you don't need those BCD numbers and output their excess-3 equivalent. That would rather make the problem more complex. Simply do as directed below.
So, for the 3 different bit combinations, you need to generate a function in terms of combinational circuit that will yield a 6-bit square of the given number.
So, your input set = {b0,b1,b2} and your output set = {B1,B2,B3,B4,B5,B6}.
Then, you need to draw the truth table of 3-bit to 6-bit square converter as :-
Input B6 B5 B4 B3 B2 B1 B0
b0
b1
b2
Fill the entries, that's the homework for you.
And, then when you have output bits B6,B5,...,B0 in terms of b0,b1 and b2, just simplify all the functions.
If you still have any doubt, comment below. I will help you with your issue. Good luck.
I have used Logic Friday 1 to derive the following minimized expression for the six outputs of your multiplier:
ab5 = a2 a1 b2 b1 + a2 a1 a0 b2 b0 + a2 a0 b2 b1 b0;
ab4 = a2 a1' a0' b2 + a2 a1' b2 b1' + a2 a0' b2 b1'
+ a2 a1' b2 b0' + a2 b2 b1' b0' + a2' a1 a0 b2 b1
+ a2 a1 b2' b1 b0 + a1 a0 b2 b1 b0;
ab3 = a2' a1 a0' b2 + a2 a1' b2' b1 + a2' a1 b2 b1'
+ a2 b2' b1 b0' + a2' a1 a0 b2' b1 b0 + a2 a1' a0 b2 b1' b0
+ a1 a0' b2 b1' + a2 a1' b1 b0' + a2 a0' b2 b1 b0
+ a2 a1 a0 b2 b0';
ab2 = a2' a1 a0' b1 + a2 a1' a0' b0 + a2 a0' b1' b0
+ a1' a0 b2 b0' + a1 a0' b1 b0' + a1 b2' b1 b0'
+ a0 b2 b1' b0' + a2' a0 b2 b0 + a2 a0 b2' b0;
ab1 = a1' a0 b1 + a1 a0' b0 + a1 b1' b0 + a0 b1 b0';
ab0 = a0 b0;
As a truth table:
The original truth table has 64 rows.
The largest output number is 49 = 7 * 7 = 32 + 16 + 1.
Therefore, six (= 3 + 3) output bits are sufficient.