This commit is contained in:
DaviRaubach 2024-02-23 21:59:09 -03:00
commit 5cf50dfddd
499 changed files with 280250 additions and 0 deletions

250
.gitignore vendored Normal file
View file

@ -0,0 +1,250 @@
# my
timidity_orchidea/
# PDF e ly
*.pdf
*_score.ly
*_score_.ly
# LaTeX
*.aux
*.log
*.gz
# macOS
.DS_Store
# mypy
.mypy_cache
# output
*.midi
*.pdf
# pip
pip-log.txt
pip-delete-this-directory.txt
# pytest
.coverage
.pytest_cache
htmlcov
# python
*.egg
*.egg-info
*.py[cod]
__pycache__
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version
# projectile
.projectile
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# ---> Emacs
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
*.~undo-tree~
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
# directory configuration
.dir-locals.el
# network security
/network-security.data

2
README.org Normal file
View file

@ -0,0 +1,2 @@
* Peça para orquestra de cordas
Trabalho de doutorado UFRGS - 2023/01

0
cordas/__init__.py Normal file
View file

254
cordas/__main__.py Normal file
View file

@ -0,0 +1,254 @@
"""This module serves as the entry point of omcwb."""
import os
import abjad
import time
# from cordas.sketch import sketch
from cordas.segments.A import segment as A
from cordas.segments.B1 import segment as B1
from cordas.segments.B2 import segment as B2
from cordas.segments.B3 import segment as B3
from cordas.segments.B4 import segment as B4
from cordas.segments.B5 import segment as B5
from cordas.segments.B6 import segment as B6
from cordas.segments.C import segment as C
from cordas.segments.C_A2 import segment as C_A2
from cordas.segments.C_C2 import segment as C_C2
from cordas.segments.D import segment as D
from cordas.segments.E import segment as E
from cordas.segments.F import segment as F
from cordas.segments.F_fermata import segment as F_fermata
from cordas.segments.G import segment as G
from cordas.segments.H import segment as H
startTime = time.time()
segments = [A, B1, B2, B3, B4, B5, B6, C, C_A2, C_C2, D, E, F, F_fermata, G, H]
# segments = [D1, D2 ]
def main(compile_segments=False, call_by_material=None, make_parts=False):
includes = r"""
% \header {title = "Substâncias de uma sanga sem nome"}
\include "/Users/Davi/.pyenv/versions/beta/lib/python3.11/site-packages/abjad/scm/abjad.ily"
\include "/Users/Davi/Composição/2023/cordas-base/cordas/ly/stylesheet.ily"
\include "/opt/local/share/lilypond/2.25.11/ly/articulate.ly"
"""
paper = r"""
% #(set-default-paper-size '(cons (* 410.4 mm) (* 256.5 mm)))
% #(set-default-paper-size '(cons (* 256.6 mm) (* 256.5 mm)))
% #(set-default-paper-size "a3")
#(set-global-staff-size 10)
\paper {
% top-margin = 10
% top-margin = 18
% bottom-margin = 10
% bottom-margin = 18
% left-margin = 20
% right-margin = 20
% systems-per-page = 1
}
"""
if compile_segments is True:
# score = abjad.Score()
total_duration = 0
for seg in segments:
# _score = seg.main().score
segment = seg.main()
if make_parts is True:
segment.make_parts(
ly_path="/Users/Davi/Composição/2023/cordas-base/cordas/parts",
)
# score.append(_score
print(seg.segment.name, "duration:", seg.segment.duration)
total_duration += seg.segment.duration
print("Total duration:", total_duration)
if make_parts is True:
instruments = ["Vl1", "Vl2", "Va", "Vc", "Cb"]
for i in instruments:
if i == "Vl1":
subtitle = "Violino I"
if i == "Vl2":
subtitle = "Violino II"
if i == "Va":
subtitle = "Viola"
if i == "Vc":
subtitle = "Violoncelo"
if i == "Cb":
subtitle = "Contrabaixo"
includes_part=rf"""
\include "/Users/Davi/.pyenv/versions/beta/lib/python3.11/site-packages/abjad/scm/abjad.ily"
\include "/Users/Davi/Composição/2023/cordas-base/cordas/ly/parts_stylesheet.ily"
\header {{title = "Substâncias de uma sanga sem nome" subtitle = "{subtitle}" }}
% #(set-default-paper-size "a4")
% #(set-default-paper-size '(cons (* 410.4 mm) (* 236.5 mm)))
% # (set-global-staff-size 20)
#(set-global-staff-size 16)
\paper {{
max-systems-per-page = 5
%page-breaking = #ly:one-line-auto-height-breaking
system-system-spacing.basic-distance = #18
score-system-spacing =
#'((basic-distance . 12)
(minimum-distance . 6)
(padding . 1)
(stretchability . 12))
top-margin = 20
bottom-margin = 20
left-margin = 20
right-margin = 20
}}
"""
part = rf"""\score {{
{{
\include "A_{i}.ly"
\include "B1_{i}.ly"
\include "B2_{i}.ly"
\include "B3_{i}.ly"
\include "B4_{i}.ly"
\include "B5_{i}.ly"
\include "B6_{i}.ly"
\include "C_{i}.ly"
\include "C_A2_{i}.ly"
\include "C_C2_{i}.ly"
\include "D_{i}.ly"
\include "E_{i}.ly"
\include "F_{i}.ly"
\include "F_fermata_{i}.ly"
\include "G_{i}.ly"
\include "H_{i}.ly"
}}
\layout {{ }}
}}"""
part_vl = rf"""\score {{
{{
\include "A_{i}.ly"
\include "B1_{i}.ly"
\include "B2_{i}.ly"
\include "B3_{i}.ly"
\include "B4_{i}.ly"
\include "B5_{i}.ly"
\include "B6_{i}.ly"
\include "C_{i}.ly"
\include "C_A2_{i}.ly"
\include "C_C2_{i}.ly"
\include "D_{i}.ly"
\include "E_{i}.ly"
\include "F_{i}.ly"
\include "F_fermata_{i}.ly"
\include "G_{i}.ly"
\include "H_{i}.ly"
}}"""
# if "Vl" in i:
# part = part_vl
ly = abjad.LilyPondFile(items=[includes_part, part])
string = f"cordas_part_{i}"
path = "/Users/davi/Composição/2023/cordas-base/cordas/parts/"
def fiveround(x, base=5):
return base * round(x / base)
minutes = fiveround(int(time.strftime("%M")))
file_path = path + time.strftime("%Y%m%d_%H") + str(minutes) + "_" + string
print(file_path)
abjad.persist.as_ly(ly, file_path + ".ly")
abjad.persist.as_pdf(ly, file_path + ".pdf")
# abjad.persist.as_pdf(ly, path + "score.pdf") # para visualização
print("\033[92m", "Time:", round(time.time() - startTime), "seconds\033[0;0m")
score = r"""
\score {
{
\include "A.ly"
\include "B1.ly"
\include "B2.ly"
\include "B3.ly"
\include "B4.ly"
\include "B5.ly"
\include "B6.ly"
\include "C.ly"
\include "C_A2.ly"
\include "C_C2.ly"
\include "D.ly"
\include "E.ly"
\include "F.ly"
\include "F_fermata.ly"
% }
% \layout { }
% }
% \score{
% {
\include "G.ly"
% }
% \layout { }
% }
% \score{
% {
\include "H.ly"
% }
% \layout { }
}
}
\score {
\unfoldRepeats
{
\include "A.ly"
\include "B1.ly"
\include "B2.ly"
\include "B3.ly"
\include "B4.ly"
\include "B5.ly"
\include "B6.ly"
\include "C.ly"
\include "C_A2.ly"
\include "C_C2.ly"
\include "D.ly"
\include "E.ly"
\include "F.ly"
\include "F_fermata.ly"
\include "G.ly"
\include "H.ly"
}
\midi {
}
}
"""
ly = abjad.LilyPondFile(items=[includes, paper, score])
string = "cordas_score_"
path = "/Users/davi/Composição/2023/cordas-base/cordas/score/"
def fiveround(x, base=5):
return base * round(x / base)
minutes = fiveround(int(time.strftime("%M")))
file_path = path + time.strftime("%Y%m%d_%H") + str(minutes) + "_" + string
abjad.persist.as_ly(ly, file_path + ".ly")
abjad.persist.as_pdf(ly, file_path + ".pdf")
abjad.persist.as_pdf(ly, path + "score.pdf") # para visualização
print("\033[92m", "Time:", round(time.time() - startTime), "seconds\033[0;0m")
if __name__ == "__main__":
# main()
main(compile_segments=False, make_parts=True)
pass

26
cordas/apresentação.org Normal file
View file

@ -0,0 +1,26 @@
#+title: Substâncias sem nome
#+subtitle: para orquestra de cordas
#+author: Davi Raubach
#+date: 2024
#+OPTIONS: toc:nil
#+LANGUAGE: pt-br
* Apresentação
Substâncias sem nome é o primeiro resultado de uma pesquisa artística que investiga a liquidez do material musical. Os complexos espectrais utilizados estão sempre a se formar e se deformar, sempre em devir. Esta exploração convida orquestra e ouvintes a imergirem nesta ambiência sonora líquida que permite um temperamento fluido (os quartos de tom não precisam ser estritamente afinados) bem como um andamento fluido que se realiza especialmente na marca de ensaio G.
* Notas técnicas
Todos os naipes apresentam divisi a dois
\\
\\
- Indicações de posição de arco
st.: sul tasto
sp.: sul ponticello
esp.: extremamente sul ponticello
ord.: posição ordinária

56
cordas/apresentação.tex Normal file
View file

@ -0,0 +1,56 @@
% Created 2024-01-10 Wed 15:47
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\makeatletter
\newcommand{\citeprocitem}[2]{\hyper@linkstart{cite}{citeproc_bib_item_#1}#2\hyper@linkend}
\makeatother
\author{Davi Raubach}
\date{2024}
\title{Substâncias sem nome\\\medskip
\large para orquestra de cordas}
\hypersetup{
pdfauthor={Davi Raubach},
pdftitle={Substâncias sem nome},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 29.1 (Org mode 9.6.6)},
pdflang={Portuges}}
\begin{document}
\maketitle
\section{Apresentação}
\label{sec:orgc3d98bf}
Substâncias sem nome é o primeiro resultado de uma pesquisa artística que investiga a liquidez do material musical. Os complexos espectrais utilizados estão sempre a se formar e se deformar, sempre em devir. Esta exploração convida orquestra e ouvintes a imergirem nesta ambiência sonora líquida que permite um temperamento fluido (os quartos de tom não precisam ser estritamente afinados) bem como um andamento fluido que se realiza especialmente na marca de ensaio G.
\\[0pt]
\\[0pt]
\textbf{Todos os naipes apresentam divisi a dois}
\\[0pt]
\\[0pt]
\begin{itemize}
\item Indicações de posição de arco
st.: sul tasto
sp.: sul ponticello
esp.: extremamente sul ponticello
ord.: posição ordinária
\end{itemize}
\end{document}

View file

@ -0,0 +1,202 @@
Hello abjad group,
I would like to get a little help on rewriting meter of contents in short containers.
My system relies on composing containers for different materials. So I have easy access to them later and can treat several containers at once. When writting longer containers I don't have this problem. Now that I want small segments in containers I can not rewrite correctly.
In the following example, in test1, I get a wrong result. In test2, I extract the contents and then get the right result. I would like to have the result of test2 without loosing my containers.
It seems that it is how ~abjad.Meter.rewrite_meter~ works. However, I am wondering if it could someday work with subcontainers or if there is a different approach that I could try.
I am using abjad 3.14.
Thank you,
Davi
#+begin_src python :results output
import abjad
# TEST 1: wrong
material_a = abjad.Container(r"r2 r16")
material_b = abjad.Container(r"c'2 ~ c'16")
material_c = abjad.Container(r"c'8.")
material_d = abjad.Container(r"c'4")
material_e = abjad.Container(r"r2 r8.")
container_test1 = abjad.Container(
[material_a, material_b, material_c,
material_d, material_e]
)
print("written:", abjad.lilypond(container_test1))
print("original container:", container_test1)
meters = [abjad.TimeSignature((5, 4)), abjad.TimeSignature((4, 4))]
def rewrite_meter(
container,
time_signatures,
boundary_depth=1,
rewrite_tuplets=True,
maximum_dot_count=1,
):
"""Rewrite meter according to ``abjad.TimeSignature`` or ``tuple`` list."""
if isinstance(time_signatures[0], abjad.TimeSignature):
durations = [_.duration for _ in time_signatures]
else:
time_signatures = [abjad.TimeSignature(_) for _ in time_signatures]
durations = time_signatures
if container:
shards = abjad.mutate.split(container[:], durations)
print("split container:", shards)
for shard, time_signature in zip(shards, time_signatures):
abjad.Meter.rewrite_meter(
shard,
time_signature,
boundary_depth=boundary_depth,
rewrite_tuplets=rewrite_tuplets,
maximum_dot_count=maximum_dot_count,
)
def write_time_signatures(container, time_signatures):
r"""Write time signatures."""
if isinstance(time_signatures[0], abjad.TimeSignature):
in_time_signatures = [_.pair for _ in time_signatures]
elif isinstance(time_signatures[0], abjad.Meter):
in_time_signatures = [
_.implied_time_signature for _ in time_signatures]
else:
in_time_signatures = time_signatures
abjad.mutate.split(container[:], in_time_signatures)
result = abjad.select.leaves(container)
result = abjad.select.partition_by_durations(
result,
in_time_signatures,
cyclic=False,
fill=abjad.EXACT,
in_seconds=False,
overhang=True,
)
for (i, time_sig), selection in zip(enumerate(in_time_signatures), result):
j = i
if i != 0:
j = i - 1
if in_time_signatures[j] == time_sig:
pass
else:
abjad.attach(
abjad.TimeSignature(time_sig, ),
abjad.select.leaf(selection, 0),
)
else:
abjad.attach(
abjad.TimeSignature(time_sig),
abjad.select.leaf(selection, 0),
)
rewrite_meter(container_test1, meters)
write_time_signatures(container_test1, meters)
print("rewritten test1:", abjad.lilypond(container_test1))
# TEST 2: right but extracting
material_a = abjad.Container(r"r2 r16")
material_b = abjad.Container(r"c'2 ~ c'16")
material_c = abjad.Container(r"c'8.")
material_d = abjad.Container(r"c'4")
material_e = abjad.Container(r"r2 r8.")
container_test2 = abjad.Container(
[material_a, material_b, material_c,
material_d, material_e]
)
for cont in container_test2:
abjad.mutate.extract(cont)
rewrite_meter(container_test2, meters)
write_time_signatures(container_test2, meters)
print("rewritten test2:", abjad.lilypond(container_test2))
staff = abjad.Staff([container_test1, container_test2])
abjad.show(staff)
#+end_src
#+RESULTS:
#+begin_example
written: {
{
r2
r16
}
{
c'2
~
c'16
}
{
c'8.
}
{
c'4
}
{
r2
r8.
}
}
original container: Container("{ r2 r16 } { c'2 c'16 } { c'8. } { c'4 } { r2 r8. }")
split container: [[Container('r2 r16'), Container("c'2 c'16"), Container("c'8")], [Container("c'16"), Container("c'4"), Container('r2 r8.')]]
rewritten test1: {
{
%%% \time 5/4 %%%
r4.
r8.
}
{
c'4.
~
c'8.
}
{
c'8
~
}
{
%%% \time 4/4 %%%
c'16
}
{
c'4
}
{
r8.
r8
r8
r8
r8
}
}
split container: [[Rest('r2'), Rest('r16'), Note("c'2"), Note("c'16"), Note("c'8")], [Note("c'16"), Note("c'4"), Rest('r2'), Rest('r8.')]]
rewritten test2: {
%%% \time 5/4 %%%
r2
r16
c'8.
~
c'4.
c'8
~
%%% \time 4/4 %%%
c'16
c'8.
~
c'16
r8.
r2
}
#+end_example
[[file:~/Desktop/Captura de Tela 2023-06-05 às 10.34.49.png]]

View file

@ -0,0 +1,105 @@
import abjad # 3.14
material_a = abjad.Container(r"r2 r16")
material_b = abjad.Container(r"c'2 ~ c'16")
material_c = abjad.Container(r"c'8.")
material_d = abjad.Container(r"c'4")
material_e = abjad.Container(r"r2 r8.")
container_test1 = abjad.Container(
[material_a, material_b, material_c,
material_d, material_e]
)
print("written:", abjad.lilypond(container_test1))
print("original container:", container_test1)
meters = [abjad.TimeSignature((5, 4)), abjad.TimeSignature((4, 4))]
def rewrite_meter(
container,
time_signatures,
boundary_depth=1,
rewrite_tuplets=True,
maximum_dot_count=1,
):
"""Rewrite meter according to ``abjad.TimeSignature`` or ``tuple`` list."""
if isinstance(time_signatures[0], abjad.TimeSignature):
durations = [_.duration for _ in time_signatures]
else:
time_signatures = [abjad.TimeSignature(_) for _ in time_signatures]
durations = time_signatures
if container:
shards = abjad.mutate.split(container[:], durations)
print("splitted container:", shards)
for shard, time_signature in zip(shards, time_signatures):
abjad.Meter.rewrite_meter(
shard,
time_signature,
boundary_depth=boundary_depth,
rewrite_tuplets=rewrite_tuplets,
maximum_dot_count=maximum_dot_count,
)
def write_time_signatures(container, time_signatures):
r"""Write time signatures."""
if isinstance(time_signatures[0], abjad.TimeSignature):
in_time_signatures = [_.pair for _ in time_signatures]
elif isinstance(time_signatures[0], abjad.Meter):
in_time_signatures = [
_.implied_time_signature for _ in time_signatures]
else:
in_time_signatures = time_signatures
abjad.mutate.split(container[:], in_time_signatures)
result = abjad.select.leaves(container)
result = abjad.select.partition_by_durations(
result,
in_time_signatures,
cyclic=False,
fill=abjad.EXACT,
in_seconds=False,
overhang=True,
)
for (i, time_sig), selection in zip(enumerate(in_time_signatures), result):
j = i
if i != 0:
j = i - 1
if in_time_signatures[j] == time_sig:
pass
else:
abjad.attach(
abjad.TimeSignature(time_sig, ),
abjad.select.leaf(selection, 0),
)
else:
abjad.attach(
abjad.TimeSignature(time_sig),
abjad.select.leaf(selection, 0),
)
rewrite_meter(container_test1, meters)
write_time_signatures(container_test1, meters)
print("rewritten test1:", abjad.lilypond(container_test1))
material_a = abjad.Container(r"r2 r16")
material_b = abjad.Container(r"c'2 ~ c'16")
material_c = abjad.Container(r"c'8.")
material_d = abjad.Container(r"c'4")
material_e = abjad.Container(r"r2 r8.")
container_test2 = abjad.Container(
[material_a, material_b, material_c,
material_d, material_e]
)
for cont in container_test2:
abjad.mutate.extract(cont)
rewrite_meter(container_test2, meters)
write_time_signatures(container_test2, meters)
print("rewritten test2:", abjad.lilypond(container_test2))
staff = abjad.Staff([container_test1, container_test2])
print(abjad.lilypond(staff))
abjad.show(staff)

View file

@ -0,0 +1,131 @@
Well, in Brazil we call it gambiarra.
The code bellow follows these steps:
- Get the name and durations of containers and store in variables
- Extract containers content
- Split and rewrite extracted content according to time signatures
- Split the result again according to the original containers durations
- Set the original name and identifier for each container
So, the problem is kind of solved. But I would appreciate any thought on it.
Obs.: The image illustrates the result on my actual code.
Davi
#+begin_src python :results output
import abjad
material_a = abjad.Container(r"r2 r16", name="a", identifier="% a")
material_b = abjad.Container(r"c'2 ~ c'16", name="b", identifier="% b")
material_c = abjad.Container(r"c'8.", name="c", identifier="% c")
material_d = abjad.Container(r"c'4", name="d", identifier="% d")
material_e = abjad.Container(r"r2 r8.", name="e", identifier="% e")
container_test1 = abjad.Container(
[material_a, material_b, material_c,
material_d, material_e]
)
print("written:", abjad.lilypond(container_test1))
print("original container:", container_test1)
time_signatures = [abjad.TimeSignature((5, 4)), abjad.TimeSignature((4, 4))]
def rewrite_meter(
main_container,
time_signatures,
boundary_depth=0,
rewrite_tuplets=True,
maximum_dot_count=1,
):
"""Rewrite meter according to ``abjad.TimeSignature`` or ``tuple`` list."""
if isinstance(time_signatures[0], abjad.TimeSignature):
durations = [_.duration for _ in time_signatures]
else:
time_signatures = [abjad.TimeSignature(_) for _ in time_signatures]
durations = time_signatures
if main_container:
materials_durations = []
materials_names = []
for container in main_container:
materials_durations.append(container._get_duration())
materials_names.append(container.name)
for _ in main_container:
abjad.mutate.extract(_)
shards = abjad.mutate.split(main_container[:], durations)
print("split container:", shards)
for shard, time_signature in zip(shards, time_signatures):
abjad.Meter.rewrite_meter(
shard,
time_signature,
boundary_depth=boundary_depth,
rewrite_tuplets=rewrite_tuplets,
maximum_dot_count=maximum_dot_count,
)
shards = abjad.mutate.split(main_container, materials_durations)
new_containers = abjad.Container()
for shard, name in zip(shards, materials_names):
for container in shard:
container.name = name
container.identifier = "% " + name
new_containers.append(container)
return new_containers
container_test1 = rewrite_meter(container_test1, time_signatures)
print("rewritten:", abjad.lilypond(container_test1))
#+end_src
#+RESULTS:
#+begin_example
written: {
{ % a
r2
r16
} % a
{ % b
c'2
~
c'16
} % b
{ % c
c'8.
} % c
{ % d
c'4
} % d
{ % e
r2
r8.
} % e
}
original container: Container("{ r2 r16 } { c'2 c'16 } { c'8. } { c'4 } { r2 r8. }")
split container: [[Rest('r2'), Rest('r16'), Note("c'2"), Note("c'16"), Note("c'8")], [Note("c'16"), Note("c'4"), Rest('r2'), Rest('r8.')]]
rewritten: {
{ % a
r2
r16
} % a
{ % b
c'8.
~
c'4.
} % b
{ % c
c'8
~
c'16
} % c
{ % d
c'8.
~
c'16
} % d
{ % e
r8.
r2
} % e
}
#+end_example
[[file:~/Desktop/Captura de Tela 2023-06-05 às 12.10.41.png]]

View file

@ -0,0 +1,663 @@
\version "2.23.6"
\language "english"
\score
{
% OPEN_BRACKETS:
\new Score
<<
% OPEN_BRACKETS:
\new Staff
{
% OPEN_BRACKETS:
\new Voice
{
% OPEN_BRACKETS:
{
% BEFORE:
% COMMANDS:
\tempo 4=60
% OPENING:
% COMMANDS:
\clef "treble"
\time 4/4
r4
r4
% OPEN_BRACKETS:
\times 2/3
{
r8
r32
r32
r16
r8
% CLOSE_BRACKETS:
}
r4
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\new Staff
{
% OPEN_BRACKETS:
\new Voice
{
% OPEN_BRACKETS:
{
% OPEN_BRACKETS:
\times 2/3
{
% OPEN_BRACKETS:
\times 4/5
{
% BEFORE:
% COMMANDS:
\tempo 4=60
% OPENING:
% COMMANDS:
\clef "treble"
\time 4/4
a'''8
% AFTER:
% STEM_TREMOLOS:
:32
% ARTICULATIONS:
\pp
af32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 4/5
{
af32
% AFTER:
% STEM_TREMOLOS:
:32
af'''16.
% AFTER:
% STEM_TREMOLOS:
:32
ef''32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
ef''16
% AFTER:
% STEM_TREMOLOS:
:32
f'16
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 4/5
{
% OPEN_BRACKETS:
\times 2/3
{
f'32
% AFTER:
% STEM_TREMOLOS:
:32
ef''16
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
ef''16
% AFTER:
% STEM_TREMOLOS:
:32
g'32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
g'16
% AFTER:
% STEM_TREMOLOS:
:32
d''''32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
d''''32
% AFTER:
% STEM_TREMOLOS:
:32
g'16
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
g'16
% AFTER:
% STEM_TREMOLOS:
:32
r32
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 4/5
{
% OPEN_BRACKETS:
\times 2/3
{
r32
r32
a''32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
a''16
% AFTER:
% STEM_TREMOLOS:
:32
% OPEN_BRACKETS:
\times 2/3
{
b32
% AFTER:
% STEM_TREMOLOS:
:32
r32
r32
% CLOSE_BRACKETS:
}
r16
r16
% CLOSE_BRACKETS:
}
r4
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\new Staff
{
% OPEN_BRACKETS:
\new Voice
{
% OPEN_BRACKETS:
{
% OPEN_BRACKETS:
\times 2/3
{
% OPEN_BRACKETS:
\times 4/5
{
% BEFORE:
% COMMANDS:
\tempo 4=60
% OPENING:
% COMMANDS:
\clef "alto"
\time 4/4
e''8
% AFTER:
% STEM_TREMOLOS:
:32
% ARTICULATIONS:
\pp
r32
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 4/5
{
r32
r32
r32
r32
ef''32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
ef''16
% AFTER:
% STEM_TREMOLOS:
:32
r16
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 4/5
{
% OPEN_BRACKETS:
\times 2/3
{
r32
a'16
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
a'16
% AFTER:
% STEM_TREMOLOS:
:32
r32
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
r32
r32
e''32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
e''32
% AFTER:
% STEM_TREMOLOS:
:32
r32
r32
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
r32
r32
a'32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 4/5
{
% OPEN_BRACKETS:
\times 2/3
{
a'16
% AFTER:
% STEM_TREMOLOS:
:32
af''32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
af''16
% AFTER:
% STEM_TREMOLOS:
:32
% OPEN_BRACKETS:
\times 2/3
{
a''32
% AFTER:
% STEM_TREMOLOS:
:32
r32
r32
% CLOSE_BRACKETS:
}
r16
r16
% CLOSE_BRACKETS:
}
r4
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\new Staff
{
% OPEN_BRACKETS:
\new Voice
{
% OPEN_BRACKETS:
{
% OPEN_BRACKETS:
\times 4/7
{
% BEFORE:
% COMMANDS:
\tempo 4=60
% OPENING:
% COMMANDS:
\clef "bass"
\time 4/4
cs'8
% AFTER:
% STEM_TREMOLOS:
:32
% ARTICULATIONS:
\pp
r32
r32
r32
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
r16
r16
e''16
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 4/5
{
% OPEN_BRACKETS:
\times 2/3
{
e''32
% AFTER:
% STEM_TREMOLOS:
:32
cs16
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
cs16
% AFTER:
% STEM_TREMOLOS:
:32
ef32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
ef16
% AFTER:
% STEM_TREMOLOS:
:32
a32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
a32
% AFTER:
% STEM_TREMOLOS:
:32
d16
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 2/3
{
d16
% AFTER:
% STEM_TREMOLOS:
:32
b32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 4/5
{
% OPEN_BRACKETS:
\times 2/3
{
b16
% AFTER:
% STEM_TREMOLOS:
:32
a32
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
a16
% AFTER:
% STEM_TREMOLOS:
:32
% OPEN_BRACKETS:
\times 2/3
{
e''32
% AFTER:
% STEM_TREMOLOS:
:32
r32
r32
% CLOSE_BRACKETS:
}
r16
r16
% CLOSE_BRACKETS:
}
r4
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\new Staff
{
% OPEN_BRACKETS:
\new Voice
{
% OPEN_BRACKETS:
{
% OPEN_BRACKETS:
\times 2/3
{
% OPEN_BRACKETS:
\times 4/5
{
% BEFORE:
% COMMANDS:
\tempo 4=60
% OPENING:
% COMMANDS:
\clef "bass"
\time 4/4
d8
% AFTER:
% STEM_TREMOLOS:
:32
% ARTICULATIONS:
\pp
r32
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 4/5
{
r32
d'16.
% AFTER:
% STEM_TREMOLOS:
:32
r32
% CLOSE_BRACKETS:
}
r16
cs16
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% CLOSE_BRACKETS:
}
% OPEN_BRACKETS:
\times 4/7
{
cs32
% AFTER:
% STEM_TREMOLOS:
:32
r32
r32
r32
r32
r32
r32
% CLOSE_BRACKETS:
}
r16
r32
r64
f'64
% AFTER:
% STEM_TREMOLOS:
:32
% SPANNER_STARTS:
~
% OPEN_BRACKETS:
\times 4/5
{
% OPEN_BRACKETS:
\times 2/3
{
f'16
% AFTER:
% STEM_TREMOLOS:
:32
r32
% CLOSE_BRACKETS:
}
r16
% OPEN_BRACKETS:
\times 2/3
{
a,32
% AFTER:
% MARKUP:
^ \markup ord
r32
r32
% CLOSE_BRACKETS:
}
r16
r16
% CLOSE_BRACKETS:
}
r4
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
}
% CLOSE_BRACKETS:
>>
}

View file

@ -0,0 +1,44 @@
\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{eurosym}
\usepackage[a4paper, total={6in, 8in}]{geometry}