Sticky notes#

[1]:
from manimusic import *

config.media_embed = True; config.media_width = "100%"
_RV = "-v WARNING -qm --progress_bar None --disable_caching Example"
_RI = "-v WARNING -s --progress_bar None --disable_caching Example"
_RV_mid = "-v WARNING -qm -r 1200,300 --progress_bar None --disable_caching Example"
_RI_mid = "-v WARNING -s -r 1200,300 --progress_bar None --disable_caching Example"
Manim Community v0.17.3

With stems#

Stem down#

Problem#

[2]:
class Example(Scene):
  def construct(self):
    staff = Staff(width=3).scale(1.4)
    chord_line  = ChordLine(staff, "B|C1", 0.6, merge_stems=True)
    self.add(staff, chord_line)

%manim $_RI_mid
_images/CHP_4_3_0.png

Solution#

[3]:
class Example(Scene):
  def construct(self):
    staff = Staff(width=3).scale(1.4)
    chord_line  = ChordLine(staff, "Bl|C1", 0.6, merge_stems=True)
    self.add(staff, chord_line)

%manim $_RI_mid
_images/CHP_4_5_0.png

Stem up#

Problem#

[4]:
class Example(Scene):
  def construct(self):
    staff = Staff(width=3).scale(1.4)
    chord_line  = ChordLine(staff, "B|C1", 0.6, glob="u", merge_stems=True)
    self.add(staff, chord_line)

%manim $_RI_mid
_images/CHP_4_7_0.png

Solution#

[5]:
class Example(Scene):
  def construct(self):
    staff = Staff(width=3).scale(1.4)
    chord_line  = ChordLine(staff, "B|C1r", 0.6, glob="u", merge_stems=True)
    self.add(staff, chord_line)

%manim $_RI_mid
_images/CHP_4_9_0.png

Warning

Don’t use r and l in the same chord, in general, if the stem is up use r, and if it’s down use l, but don’t mix them. And remember that in the case of using “r”, the note will lose its stem.

Sticky alterations#

Problem#

[6]:
class Example(Scene):
  def construct(self):
    staff = Staff(width=3).scale(1.4)
    chord_line  = ChordLine(staff, "Cb|Eb|Gb|Bbl|C1#", 0.6, merge_stems=True)
    self.add(staff, chord_line)

%manim $_RI_mid
_images/CHP_4_11_0.png

Solution#

a = small shift left : 110% alteration width size
h = big shift left   : 150% alteration width size
H = huge shift left  : 200% alteration width size
_ = 0.05 * RIGHT "_" times (this symbol must always be at the end)
[7]:
class Example(Scene):
  def construct(self):
    staff = Staff(width=3).scale(1.4)
    chord_line  = ChordLine(staff, "Cb|Eba|GbH_|Bblh|C1#h", 0.6, merge_stems=True)
    self.add(staff, chord_line)

%manim $_RI_mid
_images/CHP_4_14_0.png

REMARK#

  1. In the same chord you should not use different types of notes, if you are going to make a counterpoint with notes of different durations, use Melody.

  2. In the same chord you can mix stem directions, but if you use merge_stems=True it can give you problems, if you are going to use merge_stems define the direction in glob and not in each note.

  3. Obviously the Semibreve note has no stem, so don’t use merge_stems=True because it will give you an error.

  4. When you build a stem chord, keep the direction in mind, since changing it can give you unexpected values, although they are easy to fix, as seen in the following example:

[8]:
class Example(Scene):
  def construct(self):
    staff = Staff(clefs="g", width=12, height=0.8)
    chord1 = ChordLine(staff, "D-1l|E-1|A-1l|B-1|C2l|D2", 0.3, merge_stems=True)
    chord2 = ChordLine(staff, "D-1l|E-1|A-1l|B-1|C2l|D2", 0.5, glob="u", merge_stems=True)\
      .set_color(RED)  # Problem
    chord3 = ChordLine(staff, "D-1|E-1r|A-1|B-1r|C2|D2r", 0.7, glob="u", merge_stems=True) # Solution
    self.add(staff, chord1, chord2, chord3)

%manim $_RI
_images/CHP_4_16_0.png

Note

In general when studying Harmony and Counterpoint these types of chords are not written, but it is good to know this.