======================================================================
=== FILE: narrative/easy_setup.txt
======================================================================
Easy Setup for New Python Users
*******************************
If you're new to Python, the instructions below will help you get set
up with SCAMP running in a simple Python editor called Thonny.
Step 1: Install Thonny
======================
You can download and install the latest version of Thonny from the
Thonny website.
Note:
On Windows, you may run into an issue with Windows Defender not
trusting the installer; just click "More info" and "Run anyway":
+---------+---------+
| [image: | [image: |
| pic1][i | pic2][i |
| mage] | mage] |
+---------+---------+
Step 2: Install SCAMP and its dependencies
==========================================
Open up Thonny, and go to *Tools > Manage Packages* in the menu. You
should be presented with a window that looks like this:
[image: Thonny package manager][image]Installing the *scamp*
package using the Thonny package manager.
Type “scamp” into the textbox and click “Find package from PyPI”. PyPI
is an online repository of Python libraries from which SCAMP can be
downloaded and installed. Click the “Install” button.
Having done that, in order to get the full functionality that SCAMP
has to offer, you will want to use the same method to search for and
install the following:
* "python-rtmidi" (offers the ability to stream MIDI to an external
synthesizer or application)
* "pynput" (offers responsiveness to mouse and keyboard events)
* "scamp_extensions" (offers a range of useful extensions, like scales
and other musical constructs)
* "abjad" (generate PDFs of music notation using LilyPond — see
screenshots below)
Note:
On Linux, in order to install "python-rtmidi" you may have to first
install the Python development headers. On Debian-based distros,
simply run "sudo apt install python3-dev" from a terminal.
Important:
SCAMP is pinned to a specific version of "abjad" (currently "3.31"),
and newer releases sometimes break compatibility. By default Thonny
installs the latest version, so you'll likely need to choose the
matching version manually: in the package window, click the menu
next to "Install" to reveal the alternate-version option (left),
then pick the version SCAMP expects from the dropdown (right).
+----------+----------+
| [image: | [image: |
| pic1b][i | pic2b][i |
| mage] | mage] |
+----------+----------+
Step 3: Install LilyPond
========================
LilyPond is a program for engraving music notation that SCAMP uses to
generate PDFs of the music you create. On Linux, the easiest thing is
to install LilyPond via your package manager. On Windows, you can
download it from here and place it in the Program Files folder (e.g.
"C:\Program Files (x86)"). On a Mac, you have a couple of options —
read on.
When you first try to generate a LilyPond score using SCAMP, SCAMP
will search for LilyPond and post a message informing you that it
(hopefully) found it.
On a Mac: Homebrew (recommended)
--------------------------------
The smoothest path on macOS is to install LilyPond through Homebrew.
Homebrew is a free package manager for the Mac. Setting it up takes a
few extra minutes the first time — install it via the script on the
website, then run "brew install lilypond" from a terminal — but
Homebrew is genuinely useful for installing all sorts of other
developer software down the road, so it's a good investment.
Going this route, the LilyPond binary will be pre-approved as far as
your Mac is concerned, sidestepping the irritating sequence described
below.
On a Mac: Manual download
-------------------------
If you'd rather not install Homebrew, you can download LilyPond
directly. After unzipping, place it in the Applications folder so that
SCAMP can find it.
When you first try to generate notation using LilyPond, you will
likely see a dialog come up saying that LilyPond cannot be opened
because it's from an unidentified developer (first image below). You
have two options to get past this:
**Option 1 — one terminal command.** Open Terminal and run:
find /Applications -maxdepth 2 -iname "lilypond*" -exec sudo xattr -dr com.apple.quarantine {} +
This locates whatever "LilyPond"-named folder you dropped into
"/Applications" (the tarball currently unpacks to something like
"lilypond-2.26.0", and the casing/version may shift over time) and
strips the "downloaded from the internet" flag that triggers
Gatekeeper. You'll be prompted for your password. After it finishes,
you're done.
**Option 2 — click through the security dialogs.** Click "cancel" on
the first dialog, and then open up your security and privacy settings
(second image). You should see an option to "allow" lilypond to run.
Then, the next time you try to generate notation using LilyPond, you
should get a different dialog with the option of opening it (third
image).
+----------+----------+----------+
| [image: | [image: | [image: |
| pic1c][i | pic2c][i | pic3c][i |
| mage] | mage] | mage] |
+----------+----------+----------+
You will then probably have to follow this sequence one more time for
a program called *gs*, which LilyPond depends on.
Note that this whole irritating sequence is Apple's fault: in order to
become an "identified developer" you have no choice but to pay Apple
money, and the developers of LilyPond are volunteers who
understandably don't want to pay Apple to offer you free software.
Testing it Out
==============
To test if everything is working correctly, open up Thonny, and save
and run (by pressing the green arrow) the following script:
from scamp import test_run, print_dependency_status
print_dependency_status()
test_run.play(show_lilypond=True)
If you hear a piano gesture sweeping inward towards middle C, and then
see a PDF pop up with the music, then the setup process has been
successful!
In addition, "print_dependency_status()" prints a table summarizing
which optional dependencies SCAMP has found in your environment —
FluidSynth (the bundled audio synth), python-rtmidi, pynput, abjad,
and so on — along with a brief note about what each one is for. A "✓"
means the feature is ready to use; "✗" means it's not installed (so
the corresponding feature won't work); "~" means it's installed but in
a version SCAMP hasn't been tested against. This is the quickest way
to diagnose "why doesn't *X* work for me?" later on.
======================================================================
=== FILE: narrative/experienced_setup.txt
======================================================================
Setup for Experienced Python Users
**********************************
Basic Installation
==================
SCAMP requires **Python 3.12 or greater**. If you're already familiar
with Python and you know how to install packages using pip, installing
SCAMP is a one-liner:
pip install scamp
The prebuilt wheels on PyPI bundle the FluidSynth library for Linux,
macOS (both Intel and Apple Silicon), and Windows, so soundfont
playback works out of the box on all three platforms — no separate
FluidSynth install is required.
To pull in the optional extras (LilyPond export, MIDI I/O,
keyboard/mouse input) all at once:
pip install "scamp[all]"
This installs "abjad==3.31" (pinned for compatibility), "python-
rtmidi", and "pynput".
A note about FluidSynth
=======================
The way that SCAMP plays notes out of the box is through a free and
open source library called FluidSynth, which renders sound from short
recordings of individual notes stored in soundfonts (.sf2 files). You
usually shouldn't need to think about it — the bundled FluidSynth that
ships with the SCAMP wheels is enough on all supported platforms. It's
worth knowing the mechanism, though, in case you want to swap in a
system copy (especially on Linux, where a package-managed FluidSynth
is often better integrated with the host audio stack — JACK, PipeWire,
PulseAudio routing, etc.).
Two "playback_settings" flags govern what gets loaded:
* "try_system_fluidsynth_first" — if "True", SCAMP tries to "dlopen"
the *system* "libfluidsynth" first and falls back to the bundled
binary if that fails. Defaults to "True" on Linux and "False" on
Mac/Windows. Set it to "True" on any platform if you've installed
FluidSynth yourself (e.g. "brew install fluid-synth", "sudo apt
install fluidsynth") and want SCAMP to use it.
* "use_bundled_pyfluidsynth" — if "True" (the default everywhere),
SCAMP uses its own copy of the *pyfluidsynth* Python wrapper, which
can dlopen either the system or bundled "libfluidsynth". Set to
"False" to use a separately "pip install"ed "pyfluidsynth" instead.
You can change either of these via "PlaybackSettings" and persist with
"save_to_json()". To inspect what actually got loaded in the current
process, see the testing section below.
Optional (but recommended) Components
=====================================
Installing python-rtmidi
------------------------
For midi input, and also to generate an outgoing midi stream (which
could, for instance, be routed to a DAW), you will need the python-
rtmidi library. You can get this by running from the command line:
pip install python-rtmidi
On Linux, if you're running into an error you may need to first
install the python3-dev package, for instance with the command:
sudo apt install python3-dev
For any other python-rtmidi installation woes, take a look at the
installation instructions here.
Installing abjad and LilyPond
-----------------------------
For LilyPond output, you will need the *abjad* library. To do so, run
the following:
pip install abjad==3.31
Note the '==' in the command, which specifies the exact version of
abjad to install. This is the version that SCAMP has been built to be
compatible with. abjad has historically made breaking API changes
between releases, so newer versions may not work; if you're not sure
which version you have, the simplest path is "pip install
"scamp[all]"", which pins this version for you.
After installing *abjad*, you will also need to download and install
LilyPond, since *abjad* relies upon it. You may run into security
issues, which are further explained in Easy Setup for New Python
Users.
Installing scamp_extensions
---------------------------
The *scamp_extensions* package is the place for models of music-
theoretical concepts (e.g. scales, pitch-class sets), additional
conveniences for interacting with various types of input and output,
and in general anything that builds upon SCAMP but is outside of the
scope of the main framework.
The easiest way to install *scamp_extensions* is by running the
command:
pip install scamp_extensions
To install the most up-to-date version (assuming you have git
installed), you can instead run:
pip install git+https://github.com/MarcTheSpark/scamp_extensions
This will install the latest version from this repo.
Testing the install
===================
To make sure that everything is working correctly, you can run the
following short script:
from scamp import test_run, print_dependency_status
print_dependency_status()
test_run.play(show_lilypond=True)
Ideally, you should see a bunch of checkmarks and hear a short piano
gesture sweeping inward toward middle C.
"print_dependency_status()" prints a one-line-per-dependency report
covering FluidSynth (with the wrapper and the resolved "libfluidsynth"
binary path, so you can confirm whether the system or bundled copy got
loaded), "sf2utils", "python-osc", "python-rtmidi", "pynput", and
"abjad" (with installed-vs-tested-version comparison). States are "ok"
/ "warn" / "missing". If you're excessively nerdy and would rather
consume the data programmatically, "dependency_status()" returns the
same information as a list of "(name, state, detail)" tuples.
"test_run.play()" plays the aforementioned piano gesture; with
"show_lilypond=True" it also exercises the abjad → LilyPond → PDF path
to display notation.
======================================================================
=== FILE: narrative/forum.txt
======================================================================
Forum
*****
Join the forum at https://scampsters.marcevanstein.com/, where you can
ask questions, share your creations, make suggestions for the
development of the framework, and generally take part in the wider
SCAMP community. The forum is open-registration, and runs on
Discourse, an open-source discussion platform.
======================================================================
=== FILE: narrative/kadenze.txt
======================================================================
Kadenze Course
**************
If you're new to Python, or making music in Python, a great place to
get started is with my Kadenze Course. Not only is it a great,
beginner-friendly introduction to Python and SCAMP, but the
registration fee also helps support the work that I do!
======================================================================
=== FILE: narrative/music.txt
======================================================================
Music Created using SCAMP
*************************
Here are a few examples of pieces of music recently created in SCAMP.
More coming soon!
Gabriel Dufour-Laperrière: Πάντα ῥεῖ (Pánta rhei), for string quartet
=====================================================================
Performed by Quatuor Bozzini. According to Gabriel, "Each section of
the piece was composed through SCAMP, coding and working out each
algorithm until I was satisfied with the result. I then assembled the
good bits into a coherent whole. SCAMP let me further develop my
musical processes and gain better control over them. It was also
flexible enough to implement a specific microtonal notation that the
musicians wanted."
Marc Evanstein: Searsville 1891-2015, for open ensemble with flute and clarinet solo
====================================================================================
Alex Stephenson: An Elemental Music
===================================
According to Alex, "I used [SCAMP] quite a bit to model the canonic
passages in the second movement. Listen here.
Stewart Engart: A More Sound Outlook
====================================
======================================================================
=== FILE: narrative/note_properties.txt
======================================================================
The Note Properties Argument
****************************
When you play a note in SCAMP, in addition to providing a pitch,
volume and duration, you can provide an optional fourth argument
consisting of various additional note properties:
* *articulations*, such as staccato/legato
* *notations*, such as ornaments, fermatas, tremolo, etc.
* *noteheads*, such as diamond, x, etc.
* *spanners*, such as text brackets, hairpins, pedal markings, etc.
* *dynamics*, such as f, p, fp
* *texts*, such as expressive and technique markings
* *playback_adjustments*, which allow the playback of a note to differ
from its notation. (For example, you might obtain a legato effect by
making the note last longer than notated so that it overlaps with
the next note.)
* *spelling_policy*, which determines how pitches are spelled
* *voice*, which determines which voice a note gets placed in when
generating notation.
* *extra_playback_parameters*, which can be used to control MIDI CC
messages, as well as arbitrary synthesis parameters when a method of
playback supports such parameters.
What you pass to the properties argument can take a number of
different forms, all of which are ultimately converted into a
"NoteProperties" object:
* A string of comma-separated property descriptions
* A single subtype of "NoteProperty", such as a "SpellingPolicy",
"StaffText", "NotePlaybackAdjustment", or any of the "Spanner"
subtypes.
* A dictionary with keys "articulations", "noteheads", "notations",
etc.
* a "NoteProperties" object itself
* A list of any of the the above, which get merged into a single
"NoteProperties"
In practice, the easiest way to use the properties argument is by
passing a string, which acts as a kind of shorthand. For example, if
you simply pass the string, "tenuto", SCAMP will interpret this as an
articulation. Thus, the following are equivalent:
inst.play_note(60, 1, 1, "tenuto")
inst.play_note(60, 1, 1, {"articulations": ["tenuto"]})
In practice, the ability to define note properties in various
different ways --- and to combine these representations on the fly in
a list --- leads to considerable flexibility. Consider the following
example, in which we create a *NoteProperties* object called
*harmonic* that combines a harmonic notehead with a playback
transposition up an octave. We then pass this object as part of a list
of other note properties to the notes being played:
harmonic = NoteProperties("notehead: harmonic", "pitch + 12")
for i, pitch in enumerate(range(70, 79)):
if i % 3 == 0:
inst.play_note(pitch, 1, 1/3, [harmonic, "staccato", StartSlur()])
elif i % 3 == 2:
inst.play_note(pitch, 1, 1 / 3, [harmonic, "staccato", StopSlur()])
else:
inst.play_note(pitch, 1, 1/3, [harmonic, "staccato"])
inst.play_chord([67, 79], 1.0, 1, "accent, fermata")
The result is that the notes with the harmonic sound an octave higher,
and the notation looks like this:
[image: An example of note properties in action.][image]
Below are examples for each kind of note property, along with an
comprehensive catalog of all the possible playback modifications and
notations that are possible in SCAMP.
Articulations | Notations | Noteheads | Spanners | Dynamics | Staff
Text | Playback Adjustments | Spelling Policy | Voices | Extra
Playback Parameters
Articulations
=============
To play a note with a staccato articulation, you can do any of the
following:
inst.play_note(60, 1, 1, "staccato")
inst.play_note(60, 1, 1, "articulation: staccato")
inst.play_note(60, 1, 1, {"articulations": ["staccato"]})
Available articulations are: "staccato", "staccatissimo", "marcato",
"tenuto", and "accent".
Notations
=========
To play a note with a fermata notation, you can do any of the
following:
inst.play_note(60, 1, 1, "fermata")
inst.play_note(60, 1, 1, "notation: fermata")
inst.play_note(60, 1, 1, {"notations": ["fermata"]})
Available notations are: "tremolo", "tremolo1", "tremolo2",
"tremolo3", "tremolo4", "tremolo5", "tremolo6", "tremolo7",
"tremolo8", "down-bow", "up-bow", "open-string", "harmonic",
"stopped", "snap-pizzicato", "arpeggiate", "arpeggiate up",
"arpeggiate down", "non-arpeggiate", "fermata", "turn", "mordent",
"inverted mordent", "trill mark".
Noteheads
=========
To play a note with an "x" as its notehead, you can do any of the
following:
inst.play_note(60, 1, 1, "x")
inst.play_note(60, 1, 1, "notehead: x")
inst.play_note(60, 1, 1, {"noteheads": ["x"]})
If you want to play a chord with different noteheads for different
pitches (for example when playing an artificial harmonic), you can do
any of the following:
inst.play_chord([60, 65], 1, 1, "normal/x")
inst.play_chord([60, 65], 1, 1, "notehead: normal/x")
inst.play_chord([60, 65], 1, 1, {"noteheads": ["normal", "x"]})
Available noteheads (based on the MusicXML standard) are: "normal",
"diamond", "harmonic", "harmonic-black", "harmonic-mixed", "triangle",
"slash", "cross", "x", "circle-x", "xcircle", "inverted triangle",
"square", "arrow down", "arrow up", "circled", "slashed", "back
slashed", "cluster", "circle dot", "left triangle", "rectangle", "do",
"re", "mi", "fa", "fa up", "so", "la", "ti", "none". Any of these can
be preceded by "open" or "filled", e.g. "open triangle" or "filled
diamond".
Spanners
========
Spanners are notations that span multiple notes, so to create a
spanner, you will need a start spanner attached to one note and a stop
spanner attached to another note. For example, in order to play a slur
over several notes you could do:
inst.play_note(60, 1, 0.5, "start slur")
inst.play_note(62, 1, 0.5)
inst.play_note(64, 1, 0.5, "stop slur")
This uses the string shorthand, but you can also start a slur in any
of the following ways:
inst.play_note(60, 1, 0.5, StartSlur())
inst.play_note(60, 1, 0.5, "spanner: start slur")
inst.play_note(60, 1, 0.5, {"spanners": "start slur"})
inst.play_note(60, 1, 0.5, {"spanners": StartSlur()})
While slurs are pretty simple in nature, for other spanners you may
need to specify text, positioning above or below the staff, and other
details. These details can be provided as arguments to the relevant
spanner class, or as additional words or phrases in the string
shorthand. For example, to start a dashed text bracket specifying sul
ponticello technique, you could do either of the following:
inst.play_note(60, 1, 0.5, StartBracket(text="sul pont.", line_type="dashed"))
inst.play_note(60, 1, 0.5, "start bracket dashed 'sul pont.'")
The following table lays out the different possible spanner types, and
examples of their string shorthand.
Spanner Types
^^^^^^^^^^^^^
+---------------------------+----------------------------------------------------+------------------------------------------------------------------------+
| Spanner Type | Associated Classes | String Shorthand Example |
|===========================|====================================================|========================================================================|
| Slur | "StartSlur", "StopSlur" | "start slur", "stop slur" |
+---------------------------+----------------------------------------------------+------------------------------------------------------------------------+
| Phrasing slur | "StartPhrasingSlur", "StopPhrasingSlur" | "start phrasing slur", "stop phrasing slur" |
+---------------------------+----------------------------------------------------+------------------------------------------------------------------------+
| Hairpin | "StartHairpin", "StopHairpin" | "start hairpin >", "start hairpin o< above" |
+---------------------------+----------------------------------------------------+------------------------------------------------------------------------+
| Bracket | "StartBracket", "StopBracket" | "start bracket dashed 'sul pont.'", "stop bracket", "start bracket |
| | | solid below" |
+---------------------------+----------------------------------------------------+------------------------------------------------------------------------+
| Dashes | "StartDashes", "StopDashes" | "start dashes 'cresc.'", "stop dashes" |
+---------------------------+----------------------------------------------------+------------------------------------------------------------------------+
| Trill | "StartTrill", "StopTrill" | "start trill", "start trill flat", "stop trill" |
+---------------------------+----------------------------------------------------+------------------------------------------------------------------------+
| Piano pedal | "StartPedal", "ChangePedal", "StopPedal" | "start pedal", "change pedal", "stop pedal" |
+---------------------------+----------------------------------------------------+------------------------------------------------------------------------+
Spanner Labels
--------------
Lastly, it may on occasion be necessary to distinguish between
multiple spanners of the same type. For example, the following is
ambiguous:
inst.play_note(60, 1, 0.5, "start slur")
inst.play_note(64, 1, 0.5, "start slur")
inst.play_note(62, 1, 0.5, "stop slur")
inst.play_note(66, 1, 0.5, "stop slur")
Is it one slur inside of another slur, or two overlapping slurs? To
specify which you mean, you can use a label. In string shorthand, this
is done with a hashtag
inst.play_note(60, 1, 0.5, "start slur #OUTER")
inst.play_note(64, 1, 0.5, "start slur #INNER")
inst.play_note(62, 1, 0.5, "stop slur #INNER")
inst.play_note(66, 1, 0.5, "stop slur #OUTER")
On the other hand all spanner objects have a label argument. The
following is equivalent:
inst.play_note(60, 1, 0.5, StartSlur(label="OUTER"))
inst.play_note(64, 1, 0.5, StartSlur(label="INNER"))
inst.play_note(62, 1, 0.5, StopSlur(label="INNER"))
inst.play_note(66, 1, 0.5, StopSlur(label="OUTER"))
NOTE: At this time, LilyPond does not allow multiple spanners of the
same time in the same voice simultaneously, so in practice, labels
will only work for MusicXML output. In the special case of slurs
within slurs, however, you can use a regular slur and a phrasing slur.
Dynamics
========
You can attach a dynamic to a note in any of the following ways:
inst.play_note(60, 1, 1, "p")
inst.play_note(60, 1, 1, "dynamic: p")
inst.play_note(60, 1, 1, {"dynamics": ["p"]})
Dynamics can be any of the following: "f", "ff", "fff", "ffff",
"fffff", "ffffff", "fp", "fz", "mf", "mp", "p", "pp", "ppp", "pppp",
"ppppp", "pppppp", "rf", "rfz", "sf", "sffz", "sfp", "sfpp", "sfz".
Staff Text
==========
You can attach text to a note --- such as technique or expressive text
--- in any of the following ways:
inst.play_note(60, 1, 1, "senza vib.")
inst.play_note(60, 1, 1, "text: senza vib.")
inst.play_note(60, 1, 1, {"texts": ["senza vib."]})
inst.play_note(60, 1, 1, StaffText("senza vib.")
Note that if you don't explicitly state that the string you are
providing is text, SCAMP will try to interpret it as one of the other
possible note properties first. For example, the following will get
interpreted as a staccato articulation:
inst.play_note(60, 1, 1, "staccato")
To attach the *text* "staccato" to a note, you have to be more
explicit, e.g.:
inst.play_note(60, 1, 1, "text: staccato")
inst.play_note(60, 1, 1, StaffText("staccato"))
Bold and Italics
----------------
You can make the text bold or italic in a couple of different ways.
The first is to use a "scamp.text.StaffText" object:
inst.play_note(60, 1, 1, StaffText("with emphasis", italic=True))
inst.play_note(60, 1, 1, StaffText("boldly", bold=True))
inst.play_note(60, 1, 1, StaffText("very boldly", italic=True, bold=True)
Alternatively, you can use markdown syntax for this effect
inst.play_note(60, 1, 1, "*with emphasis*")
inst.play_note(60, 1, 1, "**boldly**")
inst.play_note(60, 1, 1, "***very boldly***")
Note, however, that this will only work on the entire text, not on
individual words, and that other markdown syntax is not supported.
Staff Placement
---------------
By default, text is placed above the staff. To place it below the
staff, you have to use a "StaffText" object:
inst.play_note(60, 1, 1, StaffText("cresc.", italic=True, placement="below"))
Playback Adjustments
====================
Sometimes, you want the playback of a note to differ from its
notation. For example, a diamond notehead might represent a harmonic
which should sound an octave (or some other interval) higher than
notated. You can use the note properties argument to do this:
inst.play_note(60, 1, 1, "notehead: diamond, pitch + 12")
The string shorthand "pitch + 12" is equivalent to
*NotePlaybackAdjustment.add_to_params(pitch=12)*. You can pass a
"NotePlaybackAdjustment" directly instead if you want:
inst.play_note(60, 1, 1, ["notehead: diamond", NotePlaybackAdjustment.add_to_params(pitch=12)])
In addition to pitch, volume and length can also be adjusted, and in
each case you can do addition/subtraction, multiplication, or direct
setting to a value. For example, to increase the volume of a note by a
factor of 1.2 and set its playback length to 2.5, you could do:
inst.play_note(60, 1, 1, "volume * 1.2, length = 2.5")
These alterations could also be accomplished using "scale_params()" or
"set_params()".
Note that changing note playback length does *not* change how long the
*play_note* call blocks for. This is useful, for instance, if we want
to create a legato effect, in which each note overlaps with the next:
for p in range(60, 70):
inst.play_note(p, 1, 0.5, "length * 1.2")
Time-Varying Playback Adjustments
---------------------------------
Lastly, it's possible to use a list or "expenvelope.envelope.Envelope"
in a playback adjustment to create a time-varying modification. For
example, the following would play three notes with a forte-piano
effect:
forte_piano_effect = NotePlaybackAdjustment.scale_params(volume=Envelope([1, 0.3], [0.2]))
inst.play_note(60, 0.5, 3, forte_piano_effect)
inst.play_note(60, 0.7, 3, forte_piano_effect)
inst.play_note(60, 1.0, 3, forte_piano_effect)
In the first note, e.g., the actual volume played would start at 0.5
and drop down to 0.15, since we're using a playback adjustment that
scales the original volume.
You can also use lists, which will get interpreted as envelopes, e.g.:
inst.play_note(60, 1.0, 4, "pitch + [0, 1, -1, 0]")
However, it should be noted that, by default, SCAMP stretches the
resulting envelope to last for the duration of the note. This might
not be desired in the case of the forte-piano effect above, where you
want a crisp diminuendo, even for a long note.
Spelling Policy
===============
A "scamp.spelling.SpellingPolicy" specifies how each pitch class
should be spelled. (For example, MIDI pitch 61 could be spelled as a
C# or a Db.) While you can set a default spelling policy for the whole
session or for an individual part, you can also specify spelling on an
individual note basis using the properties argument.
The following are equivalent:
inst.play_note(66, 1.0, 1, SpellingPolicy.from_circle_of_fifths_position(2))
inst.play_note(66, 1.0, 1, "key: D")
inst.play_note(66, 1.0, 1, "spelling: G lydian")
inst.play_note(66, 1.0, 1, "D major")
Spelling policy strings are interpreted according to
"scamp.spelling.SpellingPolicy.from_string()". If you want to directly
specify whether a note should be spelled as a sharp or flat (rather
than give a key signature), you can use the string "#" or "b":
inst.play_note(61, 1.0, 1, "b")
inst.play_note(61, 1.0, 1, "#")
Voices
======
You can use the note properties argument to specify which voice a note
should be placed in within a single staff. For example, this code:
inst.play_note(62, 0.5, 0.5, "voice: 1")
inst.play_note(60, 0.5, 0.5, "voice: 2")
inst.play_note(58, 0.5, 0.5, "voice: 2")
inst.play_note(62, 0.5, 0.5, "voice: 2")
inst.play_note(64, 0.5, 0.5, "voice: 1")
inst.play_note(62, 0.5, 0.5, "voice: 2")
inst.play_note(60, 0.5, 0.5, "voice: 2")
inst.play_note(64, 0.5, 0.5, "voice: 2")
...produces the notation:
[image: Using properties to place notes in different voices][image]
You can also use named voices, which get converted to numbered voices
before exporting to notation. In the following example, the named
voice "top_notes" gets assigned to voice 1, since it is the first
available voice, while "bottom_notes" gets assigned to voice 2. The
notational result is the same as the previous example.
inst.play_note(62, 0.5, 0.5, "voice: top_notes")
inst.play_note(60, 0.5, 0.5, "voice: bottom_notes")
inst.play_note(58, 0.5, 0.5, "voice: bottom_notes")
inst.play_note(62, 0.5, 0.5, "voice: bottom_notes")
inst.play_note(64, 0.5, 0.5, "voice: top_notes")
inst.play_note(62, 0.5, 0.5, "voice: bottom_notes")
inst.play_note(60, 0.5, 0.5, "voice: bottom_notes")
inst.play_note(64, 0.5, 0.5, "voice: bottom_notes")
Using named voices like this can be useful when the goal is to keep
musically related material together in the same voice, bue the exact
number of the voice is not important.
Extra Playback Parameters
=========================
In addition to pitch and volume, you can use SCAMP to control other
parameters of sound, so long as your playback implementation knows how
to make sense of it. For example, when you play notes via OSC messages
to an external synthesizer (e.g. via "new_osc_part()"), you can use
extra playback parameters to send OSC messages controlling vibrato,
brightness of timbre, or any other aspect of sound production. The way
we do this is through the properties argument. For example, the
following will play a note with a vibrato frequency of 7 and a
brightness that gradually diminishes from 1 to 0.
inst.play_note(62, 0.5, 5, "param_vibrato: 7, param_brightness: [1, 0]")
Note that the list [1, 0] gets converted into an "Envelope" that lasts
for the same duration as the note itself. If we're using an OSC part,
this will result in messages of the form
*instrument_name/change_parameter/vibrato* getting sent to the
receiving synthesizer.
Although the above approach is probably the easiest way to set
additional playback parameters, either of the following will have an
equivalent effect:
inst.play_note(62, 0.5, 5, {"param_vibrato": 7, "param_brightness": [1, 0]})
inst.play_note(62, 0.5, 5, {"extra_playback_parameters": {"vibrato": 7, "brightness": [1, 0]}})
Ultimately, whichever way you do it, SCAMP ultimately converts it to
the latter form.
Using Extra Parameters for MIDI CC
----------------------------------
Although the default playback implementation in SCAMP uses the MIDI
protocol to play notes using soundfonts, and therefore can't
understand parameters like brightness, you can use the extra playback
parameters to send MIDI CC messages. When the playback implementation
uses MIDI, SCAMP interprets any parameter name that is an integer
between 0 and 127 as a control change. Not,e however, that all of the
values given should be in the range from 0 to 1, which gets translated
to a range from 0 to 127.
For example, since MIDI CC 10 controls pan, the following will play a
note from the left speaker, a note from the right speaker, and then a
note that oscillates between left and right:
violin.play_note(70, 0.8, 2, "param_10: 0")
violin.play_note(71, 0.8, 2, "param_10: 1")
violin.play_note(70, 0.8, 15, "param_10: [0, 1, 0, 1, 0, 1]")
======================================================================
=== FILE: narrative/support.txt
======================================================================
Support SCAMP!
**************
Although SCAMP will always be free to use and completely open source,
a great deal of time and energy has gone into its development. If
you'd like to support that development, consider becoming a patron on
Patreon or Liberapay! Your support not allows me to devote time and
energy into SCAMP, but also into my YouTube videos and other
educational outreach.
Another great way to supporting my work (and learning something in the
process!) is to purchase my Kadenze course.
======================================================================
=== FILE: narrative/tutorial_videos.txt
======================================================================
Tutorial Videos
***************
The following tutorial videos should help get you up and running with
SCAMP. Each video is split into two halves: the first half is a basic
introduction, and second half goes into more advanced features.
These tutorials assume that you're a beginner in Python as well as in
using the SCAMP library. If you are more experienced with Python, you
will probably still find them useful, but may find you want to fast-
forward through some of the content.
Playing Notes
=============
This video shows the basics of creating a "Session" object, adding an
instrument, and playing some notes using *for* and *while* loops. In
the second half of the video, it goes into blocking vs. non-blocking
"play_note()" calls, the extra *properties* argument, and playing
glissandi, along with other continuous playback animations.
Forking Functions
=================
This video describes how to organize blocks of code into functions,
and then "fork()" them so that they run in parallel (a key step in
creating multi-part music). The second half of the video goes into the
use of function arguments, forking functions that have arguments, and
playing multiple copies of the same function simultaneously with
different arguments and tempos.
Tempo Changes and Polytempo Music
=================================
This video delves into the clock system in SCAMP, discussing how to
set the tempo/rate of a "Clock", how to create ritardandi and
accelerandi with "set_tempo_target()", and the difference between time
and beat duration units. The second half of the video demonstrates the
possibilities for polytempo music in SCAMP, with multiple parts that
each have their own separate tempo curves. It also discusses looping
tempo targets, mapping tempo to a mathematical function, and the
system of tempo inheritance in forked processes.
Generating Music Notation
=========================
This video goes into the process of transcribing and generating music
notation from a SCAMP script. The first half explains how to
transcribe the notes played within a "Session" to a "Performance"
object, convert that Performance to a "Score" object, adjust time
signatures, note spelling, and articulations, and ultimately render to
both LilyPond and MusicXML. The second half goes into the notation of
microtonal music, glissandi, and polytempo music, as well as the
thorny details of quantization.
Building Tools using Classes
============================
This video goes into the process of building your own compositional
tools by defining custom classes.
Connecting SCAMP to SuperCollider
=================================
If you're a SuperCollider user, you can use SCAMP to control
SynthDefs, spawning new synths with each *play_note* call. This video
explains how to install the SuperCollider Quark, and connect the two.
======================================================================
=== FILE: narrative/type_aliases.txt
======================================================================
SCAMP Type Aliases
******************
Type aliases used in SCAMP
^^^^^^^^^^^^^^^^^^^^^^^^^^
+------------+--------------------------------+
| Alias Name | Alias meaning |
|============|================================|
| | str | dict | NoteProperty | |
| | NoteProperties | Sequence['Not |
| | ePropertiesCompatible'] |
+------------+--------------------------------+
| | float | Envelope | |
| | Sequence[float] | |
| | Sequence[Sequence[float]] |
+------------+--------------------------------+
| | float | Envelope | |
| | Sequence[float] | |
| | Sequence[Sequence[float]] |
+------------+--------------------------------+
| | float | tuple[float, ...] |
+------------+--------------------------------+
======================================================================
=== FILE: narrative/youtube.txt
======================================================================
YouTube
*******
For content at the intersection of Python and music, subscribe to my
YouTube Channel, music.py. I post code, compositions, and a weekly
series of Python Music Shorts to spark your imagination. Here's the
first Python Music Short, to whet your appetite:
======================================================================
=== FILE: scamp/scamp.instruments.ChordHandle.txt
======================================================================
scamp.instruments.ChordHandle
*****************************
class scamp.instruments.ChordHandle(note_handles: Sequence[NoteHandle], intervals: Sequence[float])
Bases: "object"
This handle, returned by instrument.start_chord, allows us to
manipulate a chord that we have started, (i.e. by changing pitch,
volume, or another other parameter, or by ending the note). You
would never create one of these directly.
Parameters:
* **note_handles** -- the handles of the notes that make up this
chord
* **intervals** -- the original pitch intervals between the
chord tones
Variables:
**note_handles** -- the handles of the notes that make up this
chord
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "change_pa | Change a custom playback parameter for all notes in this chord to a given target value or |
| rameter"(p | values, over a given duration and with a given curve shape. |
| aram_name, | |
| ...[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_pi | Change the pitches of this chord such that the first note of the chord goes to the given |
| tch"(targe | target value or values, over a given duration and with a given curve shape. |
| t_value_or | |
| _values[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_vo | Change the volume for all notes in this chord to a given target value or values, over a |
| lume"(targ | given duration and with a given curve shape. |
| et_value_o | |
| r_values[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "end"() | Ends all notes in this chord. |
+------------+--------------------------------------------------------------------------------------------+
| "split"() | Adds a split point to this chord, causing it later to be rendered as tied pieces. |
+------------+--------------------------------------------------------------------------------------------+
change_parameter(param_name: str, target_value_or_values: float | Sequence[float], transition_length_or_lengths: float | Sequence[float] = 0, transition_curve_shape_or_shapes: float | Sequence[float] = 0, clock: Clock = None) -> None
Change a custom playback parameter for all notes in this chord
to a given target value or values, over a given duration and
with a given curve shape.
Parameters:
* **param_name** -- name of the parameter to change
* **target_value_or_values** -- either a single value or a
list of values to which we want to change the parameter of
interest.
* **transition_length_or_lengths** -- the duration (in beats)
that we want it to take to reach the target value. The
default value of 0 represents an instantaneous change. If
multiple target values were given, a list of durations
should be given for each segment.
* **transition_curve_shape_or_shapes** -- the curve shape
used in transitioning to the new target value. The default
value of 0 represents an linear change, a value greater
than zero represents late change, and a value less than 0
represents early change. If multiple target values were
given, a list of curve shapes should be given (unless it is
left as the default 0, in which case all segments are
linear).
* **clock** -- The clock with which to interpret the
transition timings. The default value of "from_note", which
you likely don't want to change, carries out the timings on
the clock on which the note was started.
change_pitch(target_value_or_values: float | Sequence[float], transition_length_or_lengths: float | Sequence[float] = 0, transition_curve_shape_or_shapes: float | Sequence[float] = 0, clock: Clock = None) -> None
Change the pitches of this chord such that the first note of the
chord goes to the given target value or values, over a given
duration and with a given curve shape. Only works if the chord
was started with *fixed=False*.
Parameters:
* **target_value_or_values** -- either a single target pitch
or a list of target pitches. Note that this is the pitch
that the first note of the chord gets changed to; all of
the other notes in the chord follow suit, maintaining the
same interval as before with the first note of the chord.
* **transition_length_or_lengths** -- the duration (in beats)
that we want it to take to reach the target pitch. The
default value of 0 represents an instantaneous change. If
multiple target values were given, a list of durations
should be given for each segment.
* **transition_curve_shape_or_shapes** -- the curve shape
used in transitioning to the new target pitch. The default
value of 0 represents an linear change, a value greater
than zero represents late change, and a value less than 0
represents early change. If multiple target values were
given, a list of curve shapes should be given (unless it is
left as the default 0, in which case all segments are
linear).
* **clock** -- The clock with which to interpret the
transition timings. The default value of "from_note", which
you likely don't want to change, carries out the timings on
the clock on which the note was started.
change_volume(target_value_or_values: float | Sequence[float], transition_length_or_lengths: float | Sequence[float] = 0, transition_curve_shape_or_shapes: float | Sequence[float] = 0, clock: Clock = None) -> None
Change the volume for all notes in this chord to a given target
value or values, over a given duration and with a given curve
shape. Requires *fixed=False*, and can only raise volume above
the start value if an explicit *velocity* was given when the
chord was started.
Parameters:
* **target_value_or_values** -- either a single target volume
or a list of target volumes.
* **transition_length_or_lengths** -- the duration (in beats)
that we want it to take to reach the target volume. The
default value of 0 represents an instantaneous change. If
multiple target values were given, a list of durations
should be given for each segment.
* **transition_curve_shape_or_shapes** -- the curve shape
used in transitioning to the new target volume. The default
value of 0 represents an linear change, a value greater
than zero represents late change, and a value less than 0
represents early change. If multiple target values were
given, a list of curve shapes should be given (unless it is
left as the default 0, in which case all segments are
linear).
* **clock** -- The clock with which to interpret the
transition timings. The default value of "from_note", which
you likely don't want to change, carries out the timings on
the clock on which the note was started.
split() -> None
Adds a split point to this chord, causing it later to be
rendered as tied pieces.
end() -> None
Ends all notes in this chord.
======================================================================
=== FILE: scamp/scamp.instruments.Ensemble.txt
======================================================================
scamp.instruments.Ensemble
**************************
class scamp.instruments.Ensemble(default_soundfont: str = 'default', default_audio_driver: str = 'default', default_spelling_policy: SpellingPolicy | str | tuple = None, instruments: Sequence[ScampInstrument] = None)
Bases: "SavesToJSON"
Host for multiple "ScampInstrument" objects, keeping shared
resources, and shared default settings. A "Session" is, among other
things, an Ensemble.
Parameters:
* **default_audio_driver** -- value to initialize
default_audio_driver instance variable to
* **default_soundfont** -- value to initialize default_soundfont
instance variable to
* **default_spelling_policy** -- a "SpellingPolicy" (or a string
or tuple interpretable as such) to use for all instruments in
this ensemble, overriding scamp defaults.
* **instruments** -- list of instruments to populate this
ensemble with. NOTE: generally it is not a good idea to
initialize an Ensemble with this argument, but better to use
the new_part methods after the fact. This is because
instrument playback implementations look to share ensemble
resources when they are created, and this is not possible if
they are not already part of an ensemble.
Variables:
* **default_audio_driver** -- the audio driver instruments in
this ensemble will default to. If "default", then this defers
to the scamp global playback_settings default.
* **default_soundfont** -- the soundfont that instruments in
this ensemble will default to. If "default", then this defers
to the scamp global playback_settings default.
* **instruments** -- List of all of the ScampInstruments within
the Ensemble.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "add_instr | Adds an instance of "ScampInstrument" to this Ensemble. |
| ument"(ins | |
| trument) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_avail | Returns an enumeration of available ports and devices for midi output. |
| able_midi_ | |
| output_dev | |
| ices"() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_instr | Returns the instrument of the given name. |
| ument_by_n | |
| ame"(name[ | |
| , which]) | |
+------------+--------------------------------------------------------------------------------------------+
| "new_midi_ | Creates and returns a new ScampInstrument for this Ensemble that uses a |
| part"([nam | MIDIStreamPlaybackImplementation. |
| e, midi_ou | |
| tput_devic | |
| e, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "new_osc_p | Creates and returns a new ScampInstrument for this Ensemble that uses a |
| art"([name | OSCPlaybackImplementation. |
| , port, ip | |
| _address, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "new_part" | Creates and returns a new ScampInstrument for this Ensemble that uses a |
| ([name, | SoundfontPlaybackImplementation. |
| preset, | |
| soundfont, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "new_silen | Creates and returns a new ScampInstrument for this Ensemble with no |
| t_part"([n | PlaybackImplementations. |
| ame, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "pop_instr | Pops the instrument at the given index, severing its ties to the ensemble. |
| ument"(ind | |
| ex) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_ava | Prints a list of available ports and devices for midi output. |
| ilable_mid | |
| i_output_d | |
| evices"() | |
+------------+--------------------------------------------------------------------------------------------+
| "print_def | Prints a list of presets available with the default soundfont. |
| ault_sound | |
| font_prese | |
| ts"() | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "default_s | Default spelling policy used for transcriptions made with this Ensemble. |
| pelling_po | |
| licy" | |
+------------+--------------------------------------------------------------------------------------------+
| "instrumen | Returns a tuple of the instruments currently in this Ensemble. |
| ts" | |
+------------+--------------------------------------------------------------------------------------------+
property instruments
Returns a tuple of the instruments currently in this Ensemble.
add_instrument(instrument: ScampInstrument) -> ScampInstrument
Adds an instance of "ScampInstrument" to this Ensemble.
Generally, creating of and instrument and adding it to an
ensemble are done simultaneously via one of the "new_instrument"
methods.
Parameters:
**instrument** -- instrument to add to this ensemble
Returns:
self
pop_instrument(index)
Pops the instrument at the given index, severing its ties to the
ensemble.
Parameters:
**index** -- which instrument
new_silent_part(name: str = None, default_spelling_policy: SpellingPolicy | str | tuple = None, clef_preference='from_name', start_note_fixed: bool = True) -> ScampInstrument
Creates and returns a new ScampInstrument for this Ensemble with
no PlaybackImplementations.
Parameters:
* **name** -- name of the new part
* **default_spelling_policy** -- the
"default_spelling_policy" for the new part
* **clef_preference** -- the "clef_preference" for the new
part
* **start_note_fixed** -- the "start_note_fixed" default for
the new part. Only relevant if adding a MIDI playback
implementation.
Returns:
the newly created ScampInstrument
new_part(name: str = None, preset='auto', soundfont: str = 'default', num_channels: int = 8, audio_driver: str = 'default', max_pitch_bend: int = 'default', start_note_fixed: bool = True, default_spelling_policy: SpellingPolicy | str | tuple = None, clef_preference='from_name', volume_cc_num: int = 11, note_on_and_off_only: bool = False) -> ScampInstrument
Creates and returns a new ScampInstrument for this Ensemble that
uses a SoundfontPlaybackImplementation. Unless otherwise
specified, the default soundfont for this Ensemble/Session will
be used, and we will search for the preset that best matches the
name given.
Parameters:
* **name** -- name used for this instrument in score, etc.
* **preset** -- if an int, assumes bank #0; can also be a
tuple of form (bank, preset). If "auto", searches for a
preset of the appropriate name.
* **soundfont** -- the name of the soundfont to use for
fluidsynth playback
* **num_channels** -- maximum of midi channels available to
this midi part. It's wise to use more when doing microtonal
playback, since pitch bends are applied per channel.
* **audio_driver** -- which audio driver to use for this
instrument (defaults to ensemble default)
* **max_pitch_bend** -- max pitch bend to use for this
instrument
* **start_note_fixed** -- default "start_note_fixed" for
notes started with "start_note()" on this part.
* **default_spelling_policy** -- the
"default_spelling_policy" for the new part
* **clef_preference** -- the "clef_preference" for the new
part
* **volume_cc_num** -- The cc value used for volume changes.
Defaults to 11 (expression).
* **note_on_and_off_only** -- Deprecated; use
*start_note_fixed*.
Returns:
the newly created ScampInstrument
new_midi_part(name: str = None, midi_output_device: int | str = None, num_channels: int = 8, midi_output_name: str = None, max_pitch_bend: int = 'default', start_note_fixed: bool = True, default_spelling_policy: SpellingPolicy | str | tuple = None, clef_preference='from_name', start_channel: int = 0, volume_cc_num: int = 11, note_on_and_off_only: bool = False) -> ScampInstrument
Creates and returns a new ScampInstrument for this Ensemble that
uses a MIDIStreamPlaybackImplementation. This means that when
notes are played by this instrument, midi messages are sent out
to the given device.
Parameters:
* **name** -- name used for this instrument in score, etc.
for a preset of the appropriate name.
* **midi_output_device** -- name or number of the device used
to output midi. Call get_available_midi_output_devices to
check what's available.
* **num_channels** -- maximum of midi channels available to
this midi part. It's wise to use more when doing microtonal
playback, since pitch bends are applied per channel.
* **midi_output_name** -- name of this part
* **max_pitch_bend** -- max pitch bend to use for this
instrument
* **start_note_fixed** -- default "start_note_fixed" for
notes started with "start_note()" on this part.
* **default_spelling_policy** -- the
"default_spelling_policy" for the new part
* **clef_preference** -- the "clef_preference" for the new
part
* **start_channel** -- the first channel to use. For
instance, if start_channel is 4, and num_channels is 5, we
will use channels (4, 5, 6, 7, 8). NOTE: channel counting
in SCAMP starts from 0, so this may show up as channels 5-9
in your MIDI software.
* **volume_cc_num** -- The cc value used for volume changes.
Defaults to 11 (expression).
* **note_on_and_off_only** -- Deprecated; use
*start_note_fixed*.
Returns:
the newly created ScampInstrument
new_osc_part(name: str = None, port: int = None, ip_address: str = '127.0.0.1', message_prefix: str = None, osc_message_addresses: dict = 'default', default_spelling_policy: SpellingPolicy | str | tuple = None, clef_preference='from_name', start_note_fixed: bool = True) -> ScampInstrument
Creates and returns a new ScampInstrument for this Ensemble that
uses a OSCPlaybackImplementation. This means that when notes are
played by this instrument, osc messages are sent out to the
specified address
Parameters:
* **name** -- name used for this instrument in score, etc.
for a preset of the appropriate name.
* **port** -- port osc messages are sent to
* **ip_address** -- ip_address osc messages are sent to
* **message_prefix** -- prefix used for this instrument in
osc messages
* **osc_message_addresses** -- dictionary defining the
address used for each type of playback message. defaults to
using "start_note", "end_note", "change_pitch",
"change_volume", "change_parameter". The default can be
changed in playback settings.
* **default_spelling_policy** -- the
"default_spelling_policy" for the new part
* **clef_preference** -- the "clef_preference" for the new
part
* **start_note_fixed** -- default "start_note_fixed" for
notes started with "start_note()" on this part.
Returns:
the newly created ScampInstrument
get_instrument_by_name(name: str, which: int = 0)
Returns the instrument of the given name.
Parameters:
* **name** -- name of the instrument to return
* **which** -- If there are multiple with the same name, this
parameter specifies the one returned. (If none match the
number given by which, the first name match is returned)
print_default_soundfont_presets() -> None
Prints a list of presets available with the default soundfont.
static get_available_midi_output_devices() -> enumerate
Returns an enumeration of available ports and devices for midi
output.
static print_available_midi_output_devices() -> None
Prints a list of available ports and devices for midi output.
property default_spelling_policy: SpellingPolicy
Default spelling policy used for transcriptions made with this
Ensemble.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.instruments.NoteHandle.txt
======================================================================
scamp.instruments.NoteHandle
****************************
class scamp.instruments.NoteHandle(note_id: int, instrument: ScampInstrument)
Bases: "object"
This handle, which is returned by instrument.start_note, allows us
to manipulate the note that we have started, (i.e. by changing
pitch, volume, or another other parameter, or by ending the note).
You would never create one of these directly.
Parameters:
* **note_id** -- the reference id of the note
* **instrument** -- the instrument playing the note
Variables:
* **note_id** -- the reference id of the note
* **instrument** -- the instrument playing the note
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "change_pa | Change a custom playback parameter for this note to a given target value or values, over a |
| rameter"(p | given duration and with a given curve shape. |
| aram_name, | |
| ...[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_pi | Change the pitch of this note to a given target value or values, over a given duration and |
| tch"(targe | with a given curve shape. |
| t_value_or | |
| _values[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_vo | Change the volume of this note to a given target value or values, over a given duration |
| lume"(targ | and with a given curve shape. |
| et_value_o | |
| r_values[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "end"() | Ends this note. |
+------------+--------------------------------------------------------------------------------------------+
| "split"() | Adds a split point to this note, causing it later to be rendered as tied pieces. |
+------------+--------------------------------------------------------------------------------------------+
change_parameter(param_name: str, target_value_or_values: float | Sequence[float], transition_length_or_lengths: float | Sequence[float] = 0, transition_curve_shape_or_shapes: float | Sequence[float] = 0, clock: Clock = None) -> None
Change a custom playback parameter for this note to a given
target value or values, over a given duration and with a given
curve shape.
Parameters:
* **param_name** -- name of the parameter to change
* **target_value_or_values** -- either a single value or a
list of values to which we want to change the parameter of
interest.
* **transition_length_or_lengths** -- the duration (in beats)
that we want it to take to reach the target value. The
default value of 0 represents an instantaneous change. If
multiple target values were given, a list of durations
should be given for each segment.
* **transition_curve_shape_or_shapes** -- the curve shape
used in transitioning to the new target value. The default
value of 0 represents an linear change, a value greater
than zero represents late change, and a value less than 0
represents early change. If multiple target values were
given, a list of curve shapes should be given (unless it is
left as the default 0, in which case all segments are
linear).
* **clock** -- The clock with which to interpret the
transition timings. The default value of "from_note", which
you likely don't want to change, carries out the timings on
the clock on which the note was started.
change_pitch(target_value_or_values: float | Sequence[float], transition_length_or_lengths: float | Sequence[float] = 0, transition_curve_shape_or_shapes: float | Sequence[float] = 0, clock: Clock = None) -> None
Change the pitch of this note to a given target value or values,
over a given duration and with a given curve shape. Only works
if the note was started with *fixed=False*.
Parameters:
* **target_value_or_values** -- either a single target pitch
or a list of target pitches.
* **transition_length_or_lengths** -- the duration (in beats)
that we want it to take to reach the target pitch. The
default value of 0 represents an instantaneous change. If
multiple target values were given, a list of durations
should be given for each segment.
* **transition_curve_shape_or_shapes** -- the curve shape
used in transitioning to the new target pitch. The default
value of 0 represents an linear change, a value greater
than zero represents late change, and a value less than 0
represents early change. If multiple target values were
given, a list of curve shapes should be given (unless it is
left as the default 0, in which case all segments are
linear).
* **clock** -- The clock with which to interpret the
transition timings. The default value of "from_note", which
you likely don't want to change, carries out the timings on
the clock on which the note was started.
change_volume(target_value_or_values: float | Sequence[float], transition_length_or_lengths: float | Sequence[float] = 0, transition_curve_shape_or_shapes: float | Sequence[float] = 0, clock: Clock = None) -> None
Change the volume of this note to a given target value or
values, over a given duration and with a given curve shape.
Requires *fixed=False*, and can only raise volume above the
start value if an explicit *velocity* was given when the note
was started.
Parameters:
* **target_value_or_values** -- either a single target volume
or a list of target volumes.
* **transition_length_or_lengths** -- the duration (in beats)
that we want it to take to reach the target volume. The
default value of 0 represents an instantaneous change. If
multiple target values were given, a list of durations
should be given for each segment.
* **transition_curve_shape_or_shapes** -- the curve shape
used in transitioning to the new target volume. The default
value of 0 represents an linear change, a value greater
than zero represents late change, and a value less than 0
represents early change. If multiple target values were
given, a list of curve shapes should be given (unless it is
left as the default 0, in which case all segments are
linear).
* **clock** -- The clock with which to interpret the
transition timings. The default value of "from_note", which
you likely don't want to change, carries out the timings on
the clock on which the note was started.
split() -> None
Adds a split point to this note, causing it later to be rendered
as tied pieces.
end() -> None
Ends this note.
======================================================================
=== FILE: scamp/scamp.instruments.ScampInstrument.txt
======================================================================
scamp.instruments.ScampInstrument
*********************************
class scamp.instruments.ScampInstrument(name: str = None, ensemble: Ensemble = None, default_spelling_policy: SpellingPolicy | str | tuple = None, clef_preference='from_name', playback_implementations: Sequence[PlaybackImplementation] = None, start_note_fixed: bool = True)
Bases: "SavesToJSON"
Instrument class that does the playing of the notes. Generally this
will be created through one of the "new_part" methods of the
Session or Ensemble class.
Parameters:
* **name** -- name of this instrument (e.g. when printed in a
score)
* **ensemble** -- Ensemble to which this instrument will belong.
* **default_spelling_policy** -- sets
"ScampInstrument.default_spelling_policy"
* **clef_preference** -- sets "ScampInstrument.clef_preference"
* **playback_implementations** -- PlaybackImplementation(s) used
to actually playback notes
Variables:
* **name** -- name of this instrument (e.g. when printed in a
score)
* **name_count** -- when there are multiple instruments of the
same name within an Ensemble, this variable assigns each a
unique index (starting with 0), to distinguish them
* **ensemble** -- Ensemble to which this instrument will belong.
* **playback_implementations** -- list of
PlaybackImplementation(s) used to actually playback notes
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "add_osc_p | Add an OSCPlaybackImplementation for this instrument. |
| layback"(p | |
| ort[, ip_a | |
| ddress, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "add_sound | Add a soundfont playback implementation for this instrument. |
| font_playb | |
| ack"([pres | |
| et, | |
| soundfont, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "add_strea | Add a streaming MIDI playback implementation for this instrument. |
| ming_midi_ | |
| playback"( | |
| [...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Changes the value of parameter of note playback over a given time; can also take a |
| te_paramet | sequence of targets and times |
| er"(note_i | |
| d, param_n | |
| ame, ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Change the pitch of an already started note; can also take a sequence of targets and |
| te_pitch"( | times. |
| note_id, | |
| ...[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Change the volume of an already started note; can also take a sequence of targets and |
| te_volume" | times |
| (note_id, | |
| ...[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "end_all_n | Ends all notes currently playing |
| otes"() | |
+------------+--------------------------------------------------------------------------------------------+
| "end_note" | Ends the note with the given note id. |
| ([note_id] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "num_notes | Returns the number of notes currently playing. |
| _playing"( | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "pedal_cha | Quickly lifts and re-presses the sustain pedal, clearing resonating notes. |
| nge"([dura | |
| tion, pres | |
| s_amount]) | |
+------------+--------------------------------------------------------------------------------------------+
| "pedal_dow | Presses the sustain pedal, by sending a CC 64 message to all midi- based playback |
| n"([press_ | implementations. |
| amount]) | |
+------------+--------------------------------------------------------------------------------------------+
| "pedal_up" | Releases the sustain pedal, by sending a CC 64 message of 0 to all midi-based playback |
| () | implementations. |
+------------+--------------------------------------------------------------------------------------------+
| "play_chor | Play a chord with the given pitches, volume, and length. |
| d"(pitches | |
| , volume, | |
| length[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "play_note | Play a note on this instrument, with the given pitch, volume and length. |
| "(pitch, | |
| volume, | |
| length[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "remove_os | Remove the most recent OSCPlaybackImplementation from this instrument. |
| c_playback | |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "remove_so | Remove the most recent SoundfontPlaybackImplementation from this instrument. |
| undfont_pl | |
| ayback"() | |
+------------+--------------------------------------------------------------------------------------------+
| "remove_st | Remove the most recent MIDIStreamPlaybackImplementation from this instrument. |
| reaming_mi | |
| di_playbac | |
| k"() | |
+------------+--------------------------------------------------------------------------------------------+
| "resolve_c | Resolves the clef preference to a sequence of possible clef choices. |
| lef_prefer | |
| ence"() | |
+------------+--------------------------------------------------------------------------------------------+
| "send_midi | Sends a midi cc message to all midi-based playback implementations, affecting all channels |
| _cc"(cc_nu | this instrument uses. |
| mber, valu | |
| e_from_0_t | |
| o_1) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_ensem | Sets the ensemble that this instrument belongs to. |
| ble"(ensem | |
| ble) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_max_p | Set the max pitch bend for all midi playback implementations on this instrument |
| itch_bend" | |
| (semitones | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "split_not | Adds a split point in a note, causing it later to be rendered as tied pieces. |
| e"(note_id | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "start_cho | Simple utility for starting chords without starting each note individually. |
| rd"(pitche | |
| s, | |
| volume[, p | |
| roperties, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "start_not | Start a note with the given pitch, volume, and properties |
| e"(pitch, | |
| volume[, p | |
| roperties, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "clef_pref | The clef preference for this instrument. |
| erence" | |
+------------+--------------------------------------------------------------------------------------------+
| "default_s | The default spelling policy for notes played back by this instrument. |
| pelling_po | |
| licy" | |
+------------+--------------------------------------------------------------------------------------------+
| "note_info | Dictionary mapping the id of each note currently sounding on this instrument to the |
| _by_id" | bookkeeping information kept about it (the clock that started it, its start/end time |
| | stamps, its current parameter values, any ongoing parameter change segments, and its |
| | "NoteProperties"). |
+------------+--------------------------------------------------------------------------------------------+
set_ensemble(ensemble: Ensemble) -> None
Sets the ensemble that this instrument belongs to. Generally
this happens automatically.
Parameters:
**ensemble** -- the "Ensemble" that this instrument should
belong to.
play_note(pitch: PitchCompatible, volume: VolumeCompatible, length: DurationCompatible, properties: NotePropertiesCompatible = None, blocking: bool = True, clock: Clock = None, velocity: float = None, silent: bool = False, transcribe: bool = True) -> None
Play a note on this instrument, with the given pitch, volume and
length.
Parameters:
* **pitch** -- either a number, an Envelope, or a list used
to create an Envelope. MIDI pitch values are used, with 60
representing middle C. However, microtones are allowed; for
instance, a pitch of 64.7 produces an F4 30 cents flat. A
pitch of *None* simply translates to a rest.
* **volume** -- either a number, an Envelope, or a list used
to create an Envelope. Volume is scaled from 0 to 1, with 0
representing silence and 1 representing max volume.
* **length** -- either a number (of beats), or a tuple
representing a set of tied segments
* **properties** -- Catch-all for a wide range of other
playback and notation details that we may want to convey
about a note. See The Note Properties Argument
* **blocking** -- if True, don't return until the note is
done playing; if False, return immediately
* **clock** -- which clock to use. If None, capture the clock
from context.
* **velocity** -- for MIDI-based playback implementations (or
other implementations that take velocity), fixes the note-
on velocity (0 to 1), turning volume into expression cc. By
default (*None*) velocity follows volume.
* **silent** -- if True, note is not played back, but is
still transcribed when a "Transcriber" is active.
(Generally ignored by end user.)
* **transcribe** -- if False, note is not transcribed even
when a "Transcriber" is active. (Generally ignored by end
user.)
play_chord(pitches: Sequence[TypeAliasForwardRef('PitchCompatible')], volume: VolumeCompatible, length: DurationCompatible, properties: NotePropertiesCompatible = None, blocking: bool = True, clock: Clock = None, velocity: float = None, silent: bool = False, transcribe: bool = True) -> None
Play a chord with the given pitches, volume, and length.
Essentially, this is a convenience method that bundles together
several calls to "play_note" and takes a list of pitches rather
than a single pitch
Parameters:
* **pitches** -- a list of pitches for the notes of this
chord
* **volume** -- see "play_note()"
* **length** -- see "play_note()"
* **properties** -- see The Note Properties Argument
* **blocking** -- see description for "play_note"
* **clock** -- see description for "play_note"
* **velocity** -- see "play_note()"
* **silent** -- see description for "play_note"
* **transcribe** -- see description for "play_note"
start_note(pitch: PitchCompatible, volume: VolumeCompatible, properties: NotePropertiesCompatible = None, clock: Clock = None, fixed: bool | str = 'auto', velocity: float = None, flags: Sequence[str] = None) -> NoteHandle
Start a note with the given pitch, volume, and properties
Parameters:
* **pitch** -- the pitch / starting pitch of the note
* **volume** -- the volume / starting volume of the note
* **properties** -- see The Note Properties Argument
* **clock** -- the clock on which to run any animation of
pitch, volume, etc. If None, captures the clock from
context.
* **fixed** -- whether the note is locked at note-on. *True*
maps volume directly to velocity and allows the note to
share a midi channel with other notes, but forbids any
later changes. *False* gives the note its own channel and
allows pitch, volume, and other parameters to change. A
note with an "Envelope" argument or an explicit *velocity*
must animate, so it is always unfixed, ignoring this
argument. The default *"auto"* falls back to this
instrument's "start_note_fixed".
* **velocity** -- an explicit note-on velocity (0 to 1),
decoupling the attack from volume. By default (*None*)
velocity follows the start volume, so expression starts at
100% and volume can only be lowered. Given a value, the
note attacks at that velocity while the volume argument
drives expression directly, over its full range.
* **flags** -- list of strings that act as flags for how the
note should be processed. Should probably be ignored by a
normal user.
Returns:
a NoteHandle with which to later manipulate the note
start_chord(pitches: Sequence[TypeAliasForwardRef('PitchCompatible')], volume: VolumeCompatible, properties: NotePropertiesCompatible = None, clock: Clock = None, fixed: bool | str = 'auto', velocity: float = None, flags: Sequence[str] = None) -> ChordHandle
Simple utility for starting chords without starting each note
individually.
Parameters:
* **pitches** -- a list of pitches
* **volume** -- see "start_note()"
* **properties** -- see The Note Properties Argument
* **clock** -- see start_note
* **fixed** -- see start_note
* **velocity** -- see start_note
* **flags** -- see start_note
Returns:
a ChordHandle, which is used to manipulate the chord
thereafter. Pitch change calls on the ChordHandle are based
on the first note of the chord; all other notes are shifted
in parallel
change_note_parameter(note_id: int | NoteHandle, param_name: str, target_value_or_values: float | Sequence[float], transition_length_or_lengths: float | Sequence[float] = 0, transition_curve_shape_or_shapes: float | Sequence[float] = 0, clock: Clock = None) -> None
Changes the value of parameter of note playback over a given
time; can also take a sequence of targets and times
Parameters:
* **note_id** -- which note to affect (an id or a NoteHandle)
* **param_name** -- name of the parameter to affect. "pitch"
and "volume" are special cases
* **target_value_or_values** -- target value (or list of
values) for the parameter
* **transition_length_or_lengths** -- transition time(s) in
beats to the target value(s)
* **transition_curve_shape_or_shapes** -- curve shape(s) for
the transition(s)
* **clock** -- which clock all of this happens on; by
default, reuses the clock that the note started on.
change_note_pitch(note_id: int | NoteHandle, target_value_or_values: float | Sequence[float], transition_length_or_lengths: float | Sequence[float] = 0, transition_curve_shape_or_shapes: float | Sequence[float] = 0, clock: Clock = None) -> None
Change the pitch of an already started note; can also take a
sequence of targets and times.
Parameters:
* **note_id** -- which note to affect (an id or a NoteHandle)
* **target_value_or_values** -- target value (or list of
values) for the parameter
* **transition_length_or_lengths** -- transition time(s) in
beats to the target value(s)
* **transition_curve_shape_or_shapes** -- curve shape(s) for
the transition(s)
* **clock** -- which clock all of this happens on; by
default, reuses the clock that the note started on.
change_note_volume(note_id: int | NoteHandle, target_value_or_values: float | Sequence[float], transition_length_or_lengths: float | Sequence[float] = 0, transition_curve_shape_or_shapes: float | Sequence[float] = 0, clock: Clock = None) -> None
Change the volume of an already started note; can also take a
sequence of targets and times
Parameters:
* **note_id** -- which note to affect (an id or a NoteHandle)
* **target_value_or_values** -- target value (or list
thereof) for the parameter
* **transition_length_or_lengths** -- transition time(s) in
beats to the target value(s)
* **transition_curve_shape_or_shapes** -- curve shape(s) for
the transition(s)
* **clock** -- which clock all of this happens on;
"from_note" simply reuses the clock that the note started
on.
split_note(note_id: int | NoteHandle) -> None
Adds a split point in a note, causing it later to be rendered as
tied pieces.
Parameters:
**note_id** -- Which note or NoteHandle to split
end_note(note_id: int | NoteHandle = None) -> None
Ends the note with the given note id. If none is specified, ends
oldest note started. Note that this only applies to notes
started in an open-ended way with "start_note()", notes created
using "play_note()" have their lifecycle controlled
automatically.
Parameters:
**note_id** -- either the id itself or a NoteHandle with that
id. Default of None ends the oldest note
end_all_notes() -> None
Ends all notes currently playing
num_notes_playing() -> int
Returns the number of notes currently playing.
add_soundfont_playback(preset: str | int | tuple[int, int] = 'auto', soundfont: str = 'default', num_channels: int = 8, audio_driver: str = 'default', max_pitch_bend: int = 'default', note_on_and_off_only: bool = False, volume_cc_num: int = 11) -> ScampInstrument
Add a soundfont playback implementation for this instrument.
Parameters:
* **preset** -- either a preset number, a tuple of (bank,
preset), a string giving a name to search for in the
soundfont, or the string "auto", in which case the name of
this instrument is used to search for a preset.
* **soundfont** -- which soundfont to use. This can be either
a path to a soundfont or the name of one of the soundfonts
specified in playback_settings.named_soundfonts. If this
instrument belongs to an Ensemble, "default" means use the
Ensemble default; if not, we will fall back to the default
provided in playback_settings.
* **num_channels** -- how many channels to allocate for
managing pitch bends, etc.
* **audio_driver** -- which driver to use
* **max_pitch_bend** -- max pitch bend to allow
* **note_on_and_off_only** -- Deprecated; set the
instrument's *start_note_fixed* instead.
* **volume_cc_num** -- The cc value used for volume changes.
Defaults to 11 (expression).
Returns:
self, for chaining purposes
remove_soundfont_playback() -> ScampInstrument
Remove the most recent SoundfontPlaybackImplementation from this
instrument.
Returns:
self, for chaining purposes
add_streaming_midi_playback(midi_output_device: int | str = 'default', num_channels: int = 8, midi_output_name: str = None, max_pitch_bend: int = 'default', note_on_and_off_only: bool = False, start_channel: int = 0, volume_cc_num: int = 11) -> ScampInstrument
Add a streaming MIDI playback implementation for this
instrument.
Parameters:
* **midi_output_device** -- name or number of the device to
use
* **num_channels** -- how many channels to allocate for
managing pitch bends, etc.
* **midi_output_name** -- name given to the output stream
* **max_pitch_bend** -- max pitch bend to allow
* **note_on_and_off_only** -- Deprecated; set the
instrument's *start_note_fixed* instead.
* **start_channel** -- the first channel to use. For
instance, if start_channel is 4, and num_channels is 5, we
will use channels (4, 5, 6, 7, 8). NOTE: channel counting
in SCAMP starts from 0, so this may show up as channels 5-9
in your MIDI software.
* **volume_cc_num** -- The cc value used for volume changes.
Defaults to 11 (expression).
Returns:
self, for chaining purposes
remove_streaming_midi_playback() -> ScampInstrument
Remove the most recent MIDIStreamPlaybackImplementation from
this instrument.
Returns:
self, for chaining purposes
add_osc_playback(port: int, ip_address: str = '127.0.0.1', message_prefix: str = None, osc_message_addresses: dict = 'default')
Add an OSCPlaybackImplementation for this instrument.
Parameters:
* **port** -- port to use
* **ip_address** -- ip address to use
* **message_prefix** -- the prefix to give to all outgoing
osc messages; defaults to the instrument name with all
spaces removed.
* **osc_message_addresses** -- the specifix message addresses
to be used for each type of message. Defaults are defined
in playback_settings
Returns:
self, for chaining purposes
remove_osc_playback() -> ScampInstrument
Remove the most recent OSCPlaybackImplementation from this
instrument.
Returns:
self, for chaining purposes
set_max_pitch_bend(semitones: int) -> None
Set the max pitch bend for all midi playback implementations on
this instrument
send_midi_cc(cc_number: int, value_from_0_to_1: float) -> None
Sends a midi cc message to all midi-based playback
implementations, affecting all channels this instrument uses.
This is useful for stuff like pedal messages, that we don't
really want to bundle with note playback, and that we want to
apply to all channels.
Parameters:
* **cc_number** -- the cc number from 0 to 127
* **value_from_0_to_1** -- the value to send, normalized from
0 to 1
pedal_down(press_amount: float = 1.0) -> None
Presses the sustain pedal, by sending a CC 64 message to all
midi-based playback implementations.
Parameters:
**press_amount** -- how far down to press the pedal, from 0
to 1 (values in between allow half-pedaling, if supported by
the receiving device)
pedal_up() -> None
Releases the sustain pedal, by sending a CC 64 message of 0 to
all midi-based playback implementations.
pedal_change(duration: float = 0.2, press_amount: float = None) -> None
Quickly lifts and re-presses the sustain pedal, clearing
resonating notes. Returns immediately, with the re-press
happening in a forked process after the given duration.
Parameters:
* **duration** -- how long (in seconds, regardless of tempo)
to keep the pedal up before re-pressing it
* **press_amount** -- how far down to re-press the pedal,
from 0 to 1; defaults to the press amount of the last call
to "pedal_down()" or "pedal_change()".
property clef_preference
The clef preference for this instrument. Can be any of:
* "from_name", which picks clef based on the instrument name
* "default", which uses the default clef preferences for an
unknown instrument
* the name of a clef
* the name of an instrument whose clef defaults to use
* a list of possible clefs. Each of these choices should be
either a valid clef name string or a tuple of (valid clef name
string, center pitch).
resolve_clef_preference() -> Sequence[str | tuple[str, Real]]
Resolves the clef preference to a sequence of possible clef
choices.
property default_spelling_policy
The default spelling policy for notes played back by this
instrument. (Can be set with a "SpellingPolicy", or a string or
tuple interpretable as such via "interpret()")
property note_info_by_id
Dictionary mapping the id of each note currently sounding on
this instrument to the bookkeeping information kept about it
(the clock that started it, its start/end time stamps, its
current parameter values, any ongoing parameter change segments,
and its "NoteProperties").
This is exposed mostly for the benefit of custom
"PlaybackImplementation" subclasses, which may need to consult
the state of a note in progress.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.instruments.txt
======================================================================
scamp.instruments
*****************
Module containing user-facing playback classes: "Ensemble",
"ScampInstrument", and "NoteHandle"/ "ChordHandle"
The underlying implementation of playback is done by
"PlaybackImplementation" and all of its subclasses, which are found in
playback_implementations.py.
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "ChordHand | This handle, returned by instrument.start_chord, allows us to manipulate a chord that we |
| le"(note_h | have started, (i.e. by changing pitch, volume, or another other parameter, or by ending |
| andles, | the note). |
| intervals) | |
+------------+--------------------------------------------------------------------------------------------+
| "Ensemble" | Host for multiple "ScampInstrument" objects, keeping shared resources, and shared default |
| ([default_ | settings. |
| soundfont, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "NoteHandl | This handle, which is returned by instrument.start_note, allows us to manipulate the note |
| e"(note_id | that we have started, (i.e. by changing pitch, volume, or another other parameter, or by |
| , instrume | ending the note). |
| nt) | |
+------------+--------------------------------------------------------------------------------------------+
| "ScampInst | Instrument class that does the playing of the notes. |
| rument"([n | |
| ame, | |
| ensemble, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.instruments.ChordHandle
* "ChordHandle"
* "ChordHandle.change_parameter()"
* "ChordHandle.change_pitch()"
* "ChordHandle.change_volume()"
* "ChordHandle.split()"
* "ChordHandle.end()"
* scamp.instruments.Ensemble
* "Ensemble"
* "Ensemble.instruments"
* "Ensemble.add_instrument()"
* "Ensemble.pop_instrument()"
* "Ensemble.new_silent_part()"
* "Ensemble.new_part()"
* "Ensemble.new_midi_part()"
* "Ensemble.new_osc_part()"
* "Ensemble.get_instrument_by_name()"
* "Ensemble.print_default_soundfont_presets()"
* "Ensemble.get_available_midi_output_devices()"
* "Ensemble.print_available_midi_output_devices()"
* "Ensemble.default_spelling_policy"
* "Ensemble.duplicate()"
* "Ensemble.json_dumps()"
* "Ensemble.json_loads()"
* "Ensemble.load_from_json()"
* "Ensemble.save_to_json()"
* scamp.instruments.NoteHandle
* "NoteHandle"
* "NoteHandle.change_parameter()"
* "NoteHandle.change_pitch()"
* "NoteHandle.change_volume()"
* "NoteHandle.split()"
* "NoteHandle.end()"
* scamp.instruments.ScampInstrument
* "ScampInstrument"
* "ScampInstrument.set_ensemble()"
* "ScampInstrument.play_note()"
* "ScampInstrument.play_chord()"
* "ScampInstrument.start_note()"
* "ScampInstrument.start_chord()"
* "ScampInstrument.change_note_parameter()"
* "ScampInstrument.change_note_pitch()"
* "ScampInstrument.change_note_volume()"
* "ScampInstrument.split_note()"
* "ScampInstrument.end_note()"
* "ScampInstrument.end_all_notes()"
* "ScampInstrument.num_notes_playing()"
* "ScampInstrument.add_soundfont_playback()"
* "ScampInstrument.remove_soundfont_playback()"
* "ScampInstrument.add_streaming_midi_playback()"
* "ScampInstrument.remove_streaming_midi_playback()"
* "ScampInstrument.add_osc_playback()"
* "ScampInstrument.remove_osc_playback()"
* "ScampInstrument.set_max_pitch_bend()"
* "ScampInstrument.send_midi_cc()"
* "ScampInstrument.pedal_down()"
* "ScampInstrument.pedal_up()"
* "ScampInstrument.pedal_change()"
* "ScampInstrument.clef_preference"
* "ScampInstrument.resolve_clef_preference()"
* "ScampInstrument.default_spelling_policy"
* "ScampInstrument.note_info_by_id"
* "ScampInstrument.duplicate()"
* "ScampInstrument.json_dumps()"
* "ScampInstrument.json_loads()"
* "ScampInstrument.load_from_json()"
* "ScampInstrument.save_to_json()"
======================================================================
=== FILE: scamp/scamp.note_properties.NoteProperties.txt
======================================================================
scamp.note_properties.NoteProperties
************************************
class scamp.note_properties.NoteProperties(*args, **kwargs)
Bases: "SimpleNamespace", "SavesToJSON", "NoteProperty"
Class that holds information about any and all playback or
notational details for a note or chord aside from its pitch, volume
and duration. See The Note Properties Argument for more
information.
Parameters:
* **args** -- Any number of things that are interpretable as
note properties via "NoteProperties.interpret()", which are
merged together into a single object.
* **kwargs** -- individual note properties can be given as
keyword arguments, e.g. *articulation=staccato*
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "apply_pla | Applies both explicit and (if flag is set) derived playback_adjustments to the given |
| yback_adju | pitch, volume, and length |
| stments"(p | |
| itch, | |
| volume, | |
| length) | |
+------------+--------------------------------------------------------------------------------------------+
| "chord_mer | Determines whether this NoteProperties is compatible with another for chord merger |
| geable_wit | purposes. |
| h"(other_p | |
| roperties) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_extra | The value each extra playback parameter starts out at, taking the start level of any |
| _parameter | parameter given as an envelope. |
| _start_val | |
| ues"() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_midi_ | Those extra playback parameters that name a MIDI control change, i.e. whose key is a |
| cc_params" | number from 0 to 127, keyed by that number. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "get_midi_ | The value each MIDI control change parameter starts out at, taking the start level of any |
| cc_start_v | parameter given as an envelope. |
| alues"([di | |
| gits_to_ro | |
| und_to]) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_spell | The spelling policy to use for one of the notes of a chord, falling back to the last one |
| ing_policy | given if fewer policies were specified than there are notes. |
| "([which_n | |
| ote]) | |
+------------+--------------------------------------------------------------------------------------------+
| "incorpora | Incorporates a different NoteProperties or dictionary into this one. |
| te"(other_ | |
| properties | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "interpret | Interprets a properties_object of unknown type into a "NoteProperties". |
| "(properti | |
| es_object) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "PROPERTY_ | |
| TYPES" | |
+------------+--------------------------------------------------------------------------------------------+
| "PROPERTY_ | |
| TYPES_AS_D | |
| ICT" | |
+------------+--------------------------------------------------------------------------------------------+
PROPERTY_TYPES = ({'chord_merger_critical': True, 'default': [], 'key': 'articulations', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^articulations?$', 'regularization_function': None}, {'chord_merger_critical': True, 'default': [], 'key': 'notations', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^notations?$', 'regularization_function': None}, {'chord_merger_critical': True, 'custom_type': <class 'scamp.spanners.Spanner'>, 'default': [], 'key': 'spanners', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^spanners?$', 'regularization_function': None}, {'chord_merger_critical': False, 'default': ['normal'], 'is_default_function': <function NoteProperties.<lambda>>, 'key': 'noteheads', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^noteheads?$', 'regularization_function': None}, {'chord_merger_critical': True, 'default': [], 'key': 'dynamics', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^dynamics?$', 'regularization_function': None}, {'chord_merger_critical': True, 'custom_type': <class 'scamp.text.StaffText'>, 'default': [], 'key': 'texts', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^texts?$', 'regularization_function': <function NoteProperties.<lambda>>}, {'chord_merger_critical': True, 'custom_type': <class 'scamp.playback_adjustments.NotePlaybackAdjustment'>, 'default': [], 'key': 'playback_adjustments', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^(playback_)?adjustments?$', 'regularization_function': <function NoteProperties.<lambda>>}, {'chord_merger_critical': False, 'custom_type': <class 'scamp.spelling.SpellingPolicy'>, 'default': [], 'is_default_function': <function NoteProperties.<lambda>>, 'key': 'spelling_policies', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^(spelling|spelling_policy|spelling_policies|key)$', 'regularization_function': <function NoteProperties.<lambda>>}, {'chord_merger_critical': True, 'default': None, 'key': 'voice', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^voice$', 'regularization_function': None}, {'chord_merger_critical': True, 'default': 0, 'key': 'octave_displacement', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^octave_displacement$', 'regularization_function': None}, {'chord_merger_critical': True, 'default': {}, 'key': 'extra_playback_parameters', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^extra_playback_parameters$', 'regularization_function': None}, {'chord_merger_critical': True, 'default': False, 'key': 'starts_tie', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^starts_tie$', 'regularization_function': None}, {'chord_merger_critical': True, 'default': False, 'key': 'ends_tie', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^ends_tie$', 'regularization_function': None}, {'chord_merger_critical': True, 'default': False, 'key': 'manual_split_point', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^manual_split_point$', 'regularization_function': None})
PROPERTY_TYPES_AS_DICT = {'articulations': {'chord_merger_critical': True, 'default': [], 'key': 'articulations', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^articulations?$', 'regularization_function': None}, 'dynamics': {'chord_merger_critical': True, 'default': [], 'key': 'dynamics', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^dynamics?$', 'regularization_function': None}, 'ends_tie': {'chord_merger_critical': True, 'default': False, 'key': 'ends_tie', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^ends_tie$', 'regularization_function': None}, 'extra_playback_parameters': {'chord_merger_critical': True, 'default': {}, 'key': 'extra_playback_parameters', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^extra_playback_parameters$', 'regularization_function': None}, 'manual_split_point': {'chord_merger_critical': True, 'default': False, 'key': 'manual_split_point', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^manual_split_point$', 'regularization_function': None}, 'notations': {'chord_merger_critical': True, 'default': [], 'key': 'notations', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^notations?$', 'regularization_function': None}, 'noteheads': {'chord_merger_critical': False, 'default': ['normal'], 'is_default_function': <function NoteProperties.<lambda>>, 'key': 'noteheads', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^noteheads?$', 'regularization_function': None}, 'octave_displacement': {'chord_merger_critical': True, 'default': 0, 'key': 'octave_displacement', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^octave_displacement$', 'regularization_function': None}, 'playback_adjustments': {'chord_merger_critical': True, 'custom_type': <class 'scamp.playback_adjustments.NotePlaybackAdjustment'>, 'default': [], 'key': 'playback_adjustments', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^(playback_)?adjustments?$', 'regularization_function': <function NoteProperties.<lambda>>}, 'spanners': {'chord_merger_critical': True, 'custom_type': <class 'scamp.spanners.Spanner'>, 'default': [], 'key': 'spanners', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^spanners?$', 'regularization_function': None}, 'spelling_policies': {'chord_merger_critical': False, 'custom_type': <class 'scamp.spelling.SpellingPolicy'>, 'default': [], 'is_default_function': <function NoteProperties.<lambda>>, 'key': 'spelling_policies', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^(spelling|spelling_policy|spelling_policies|key)$', 'regularization_function': <function NoteProperties.<lambda>>}, 'starts_tie': {'chord_merger_critical': True, 'default': False, 'key': 'starts_tie', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^starts_tie$', 'regularization_function': None}, 'texts': {'chord_merger_critical': True, 'custom_type': <class 'scamp.text.StaffText'>, 'default': [], 'key': 'texts', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^texts?$', 'regularization_function': <function NoteProperties.<lambda>>}, 'voice': {'chord_merger_critical': True, 'default': None, 'key': 'voice', 'merger_function': <function NoteProperties.<lambda>>, 'regex': '^voice$', 'regularization_function': None}}
classmethod interpret(properties_object) -> NoteProperties
Interprets a properties_object of unknown type into a
"NoteProperties".
Parameters:
**properties_object** -- a "NoteProperties" object, dict-like
object, parseable properties string, custom NoteProperties
object or list of any of the above that get merged together.
See The Note Properties Argument for more info.
Returns:
a new "NoteProperties". Note that if a "NoteProperties" is
passed in, the function will simply return the exact same
object (not a duplicate)
incorporate(other_properties: SimpleNamespace | MutableMapping | None) -> NoteProperties
Incorporates a different NoteProperties or dictionary into this
one.
Parameters:
**other_properties** -- A NoteProperties, or a dictionary-
like object with similar structure
Returns:
self, for chaining purposes
chord_mergeable_with(other_properties: NoteProperties) -> bool
Determines whether this NoteProperties is compatible with
another for chord merger purposes.
Parameters:
**other_properties** -- the NoteProperties object of another
note
Returns:
whether the note with this NoteProperties is compatible with
the note with the other NoteProperties as far as combining
them both into a chord is concerned.
apply_playback_adjustments(pitch, volume, length, include_notation_derived=True)
Applies both explicit and (if flag is set) derived
playback_adjustments to the given pitch, volume, and length
Parameters:
* **pitch** -- unadjusted pitch
* **volume** -- unadjusted volume
* **length** -- unadjusted length
* **include_notation_derived** -- if true, include
adjustments based on notations like staccato, by searching
the playback_settings.adjustments dictionary
Returns:
adjusted pitch, volume, length, as well as a boolean stating
whether anything changed
get_spelling_policy(which_note=0)
The spelling policy to use for one of the notes of a chord,
falling back to the last one given if fewer policies were
specified than there are notes.
Parameters:
**which_note** -- index of the note within the chord
get_midi_cc_params()
Those extra playback parameters that name a MIDI control change,
i.e. whose key is a number from 0 to 127, keyed by that number.
(Values may be numbers or "Envelope"s.)
get_midi_cc_start_values(digits_to_round_to=10)
The value each MIDI control change parameter starts out at,
taking the start level of any parameter given as an envelope.
Parameters:
**digits_to_round_to** -- how many decimal places to round
the values to
get_extra_parameter_start_values()
The value each extra playback parameter starts out at, taking
the start level of any parameter given as an envelope.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.note_properties.txt
======================================================================
scamp.note_properties
*********************
Module containing the NoteProperties object, which is a dictionary
that stores a variety of playback and notation options that affect a
given note.
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "NotePrope | Class that holds information about any and all playback or notational details for a note |
| rties"(*ar | or chord aside from its pitch, volume and duration. |
| gs, | |
| **kwargs) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.note_properties.NoteProperties
* "NoteProperties"
* "NoteProperties.PROPERTY_TYPES"
* "NoteProperties.PROPERTY_TYPES_AS_DICT"
* "NoteProperties.interpret()"
* "NoteProperties.incorporate()"
* "NoteProperties.chord_mergeable_with()"
* "NoteProperties.apply_playback_adjustments()"
* "NoteProperties.get_spelling_policy()"
* "NoteProperties.get_midi_cc_params()"
* "NoteProperties.get_midi_cc_start_values()"
* "NoteProperties.get_extra_parameter_start_values()"
* "NoteProperties.duplicate()"
* "NoteProperties.json_dumps()"
* "NoteProperties.json_loads()"
* "NoteProperties.load_from_json()"
* "NoteProperties.save_to_json()"
======================================================================
=== FILE: scamp/scamp.performance.Performance.txt
======================================================================
scamp.performance.Performance
*****************************
class scamp.performance.Performance(parts: Sequence[PerformancePart] = None, tempo_envelope: TempoEnvelope = None)
Bases: "SavesToJSON", "_NoteFiltersMixin"
Representation of note playback events, usually a transcription of
the notes played by an "Ensemble". Operates in continuous time,
without regard to any particular way of notating it. (As opposed to
a "Score", which represents the notated music.)
Parameters:
* **parts** -- list of parts ("PerformancePart" objects) to
start with (defaults to empty list)
* **tempo_envelope** -- a tempo_envelope to associate with this
performance
Variables:
* **parts** -- list of parts ("PerformancePart" objects) in this
Performance
* **tempo_envelope** -- the tempo_envelope associated this
performance and used for playback by default
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "add_part" | Add the given PerformancePart to this performance |
| (part) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_to | Exports the Performance to a MIDI file. |
| _midi_file | |
| "(output_f | |
| ile[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_note_ | Returns an iterator returning all the notes from start_beat to stop_beat in the selected |
| iterator"( | voices, in all parts. |
| [start_bea | |
| t, | |
| stop_beat, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_part_ | Get the part with the given index (Parts are numbered starting with 0, in order that they |
| by_index"( | are added/created.) |
| index) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_parts | Get all parts with the given instrument |
| _by_instru | |
| ment"(inst | |
| rument) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_parts | Get all parts with the given name |
| _by_name"( | |
| name) | |
+------------+--------------------------------------------------------------------------------------------+
| "is_quanti | Checks if this Performance has been quantized |
| zed"() | |
+------------+--------------------------------------------------------------------------------------------+
| "length"() | Total length of this performance. |
+------------+--------------------------------------------------------------------------------------------+
| "new_part" | Construct and add a new PerformancePart to this Performance |
| ([instrume | |
| nt]) | |
+------------+--------------------------------------------------------------------------------------------+
| "num_measu | If this Performance has been quantized, gets the number of measures |
| res"() | |
+------------+--------------------------------------------------------------------------------------------+
| "play"([st | Play back this Performance (or a selection of it) |
| art_beat, | |
| stop_beat, | |
| ensemble, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "quantize" | Quantizes all parts according to the quantization_scheme |
| ([quantiza | |
| tion_schem | |
| e, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "quantized | Same as quantize, except that it returns a new copy, rather than changing this Performance |
| "([quantiz | in place. |
| ation_sche | |
| me, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "remap_to_ | Remaps this performance to use the given tempo or tempo envelope. |
| tempo"(tem | |
| po) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_instr | Set the playback instruments for each part in this Performance by their best match in the |
| uments_fro | ensemble given. |
| m_ensemble | |
| "(ensemble | |
| [, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_score" | Convert this Performance (list of note events in continuous time and pitch) to a Score |
| ([quantiza | object, which represents the music in traditional western notation. |
| tion_schem | |
| e, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "apply_not | Applies a filter function to every note in this Performance. |
| e_filter"( | |
| filter_fun | |
| ction[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "apply_pit | Applies a filter function to transform the pitch of every note in this Performance. |
| ch_filter" | |
| (filter_fu | |
| nction[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "apply_vol | Applies a filter function to transform the volume of every note in this Performance. |
| ume_filter | |
| "(filter_f | |
| unction[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
| "transpose | Transposes all notes in this Performance up or down by the desired interval. |
| "(interval | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "end_beat" | The end beat of this performance. |
+------------+--------------------------------------------------------------------------------------------+
new_part(instrument: ScampInstrument = None) -> PerformancePart
Construct and add a new PerformancePart to this Performance
Parameters:
**instrument** -- the instrument to use as a default for
playing back the part
Returns:
the newly constructed part
add_part(part: PerformancePart) -> None
Add the given PerformancePart to this performance
Parameters:
**part** -- a PerformancePart to add
get_part_by_index(index: int) -> PerformancePart
Get the part with the given index (Parts are numbered starting
with 0, in order that they are added/created.)
Parameters:
**index** -- the index of the part in question
Returns:
the PerformancePart
get_parts_by_name(name: str) -> Sequence[PerformancePart]
Get all parts with the given name
Parameters:
**name** -- the part name to search for
Returns:
a list of parts with this name
get_parts_by_instrument(instrument: ScampInstrument) -> Sequence[PerformancePart]
Get all parts with the given instrument
Parameters:
**instrument** -- the instrument to search for
Returns:
a list of parts with this instrument
property end_beat: float
The end beat of this performance. (i.e. the beat corresponding
to the end of the last note)
Returns:
float representing the beat at which all notes are done
playing
length() -> float
Total length of this performance. (Identical to
Performance.end_beat)
Returns:
float representing the total length of the Performance
get_note_iterator(start_beat: float = 0, stop_beat: float = None, selected_voices: Sequence[str] = None) -> Iterator[PerformanceNote]
Returns an iterator returning all the notes from start_beat to
stop_beat in the selected voices, in all parts. In order of
start time, jumping from part to part as needed.
Parameters:
* **start_beat** -- beat to start on
* **stop_beat** -- beat to stop on (None keeps going until
the end of the part)
* **selected_voices** -- which voices to take notes from
(defaults to all if None)
Returns:
an iterator
remap_to_tempo(tempo: TempoEnvelope | float)
Remaps this performance to use the given tempo or tempo
envelope. All notes will happen at the same time, but on
different beats.
Parameters:
**tempo** -- the new tempo envelope to use
Returns:
self, for chaining purposes
play(start_beat: float = 0, stop_beat: float = None, ensemble: Ensemble = 'auto', clock: Clock = 'auto', blocking: bool = True, tempo_envelope: TempoEnvelope = 'auto', note_filter: Callable[[PerformanceNote], PerformanceNote] = None) -> Clock
Play back this Performance (or a selection of it)
Parameters:
* **start_beat** -- Place to start playing from
* **stop_beat** -- Place to stop playing at
* **ensemble** -- The Ensemble whose instruments to use for
playback. If "auto", checks to see if we are operating in a
particular Session, and uses those instruments if so.
* **clock** -- clock to use for playback
* **blocking** -- if True, don't return until the part is
done playing; if False, return immediately
* **tempo_envelope** -- the TempoEnvelope with which to play
back this performance. The default value of "auto" uses
the tempo_envelope associated with the performance, and
None uses a flat tempo of rate 60bpm
* **note_filter** -- a function that takes the
PerformanceNote about to be played and returns a modified
PerformanceNote to play. NB: this will modify the original
note unless the input to the function is duplicated and
left unaltered!
Returns:
the clock on which this performance is playing back
set_instruments_from_ensemble(ensemble: Ensemble, override: bool = True) -> Performance
Set the playback instruments for each part in this Performance
by their best match in the ensemble given. If override is False,
only set the instrument for parts that don't already have one
set.
Parameters:
* **ensemble** -- the Ensemble in which to search for
instruments
* **override** -- Whether or not to override any instruments
already assigned to parts
Returns:
self
quantize(quantization_scheme: QuantizationScheme = 'default', onset_weighting: float = 'default', termination_weighting: float = 'default') -> Performance
Quantizes all parts according to the quantization_scheme
Parameters:
* **quantization_scheme** -- the QuantizationScheme to use.
If "default", uses the default time signature defined in
the quantization_settings.
* **onset_weighting** -- how much to weight note onsets in
the quantization. If "default", uses the default value
defined in the quantization_settings.
* **termination_weighting** -- how much to weight note
terminations in the quantization. If "default", uses the
default value defined in the quantization_settings.
Returns:
this Performance, having been quantized
quantized(quantization_scheme: QuantizationScheme = 'default', onset_weighting: float = 'default', termination_weighting: float = 'default') -> Performance
Same as quantize, except that it returns a new copy, rather than
changing this Performance in place.
Parameters:
* **quantization_scheme** -- the QuantizationScheme to use.
If "default", uses the default time signature defined in
the quantization_settings.
* **onset_weighting** -- how much to weight note onsets in
the quantization. If "default", uses the default value
defined in the quantization_settings.
* **termination_weighting** -- how much to weight note
terminations in the quantization. If "default", uses the
default value defined in the quantization_settings.
Returns:
a quantized copy of this Performance
is_quantized() -> bool
Checks if this Performance has been quantized
Returns:
True if all parts are quantized, False if not
num_measures() -> int
If this Performance has been quantized, gets the number of
measures
Returns:
number of measures
export_to_midi_file(output_file, flatten_tempo_to=None, max_channels: int = 16, ring_time: float = 0.5, pitch_bend_range: float = 2, envelope_precision: float = 0.01, tempo_precision: float = 0.1)
Exports the Performance to a MIDI file.
Parameters:
* **output_file** -- path of the MIDI file to create and
write to.
* **flatten_tempo_to** -- If not None, then everything is
flattened to the tempo given, and notes at a faster tempo
are simply made shorter. If None, tempo changes are
exported as part of the MIDI file.
* **max_channels** -- maximum number of channels to use for
different notes. By default, notes with different pitch
bends and cc messages will be placed on different channels
to avoid interference.
* **ring_time** -- When multiple channels are used for
juggling different pitch bends and cc messages, channels
are reused when the notes on them have finished. However,
if they're reused right away, this can cause the note that
just finished and is perhaps ringing/reverberating to get
altered undesirably. ring_time is the amount of time that
we wait before reassigning a channel.
* **pitch_bend_range** -- By default +- 2 semitones. If a
greater pitch bend is needed, this parameter will scale all
pitch bend messages accordingly. It will also attempt to
send RPN messages to let the synthesizer know, though in
practice many softsynths ignore this and will need to have
their pitch bend range set manually.
* **envelope_precision** -- For glissandi, volume curves, and
any other parameter that is being given an "Envelope", this
is the temporal precision of the corresponding midi events.
* **tempo_precision** -- if flatten_tempo_changes is False,
then this determines the precision of tempo change MIDI
events during gradual accelerandi/ritardandi.
apply_note_filter(filter_function: Callable[[PerformanceNote], None], start_beat: float = 0, stop_beat: float = None, selected_voices: Sequence[str] = None)
Applies a filter function to every note in this Performance.
This can be used to apply a transformation to the entire
Performance on a note-by-note basis.
Parameters:
* **filter_function** -- function taking a PerformanceNote
object and modifying it in place
* **start_beat** -- beat to start on
* **stop_beat** -- beat to stop on (None keeps going until
the end of the part)
* **selected_voices** -- which voices to take notes from
(defaults to all if None)
Returns:
self, for chaining purposes
apply_pitch_filter(filter_function: Callable[[Envelope | float], Envelope | float], start_beat: float = 0, stop_beat: float = None, selected_voices: Sequence[str] = None)
Applies a filter function to transform the pitch of every note
in this Performance.
Parameters:
* **filter_function** -- function taking a pitch (can be
envelope, float, or even a chord tuple) and returning
another pitch-like object. If the performance hasn't been
quantized and you're not using any glissandi, though, you
can assume the pitch is a float.
* **start_beat** -- beat to start on
* **stop_beat** -- beat to stop on (None keeps going until
the end of the part)
* **selected_voices** -- which voices to take notes from
(defaults to all if None)
Returns:
self, for chaining purposes
apply_volume_filter(filter_function: Callable[[Envelope | float], Envelope | float], start_beat: float = 0, stop_beat: float = None, selected_voices: Sequence[str] = None)
Applies a filter function to transform the volume of every note
in this Performance.
Parameters:
* **filter_function** -- function taking a volume (can be
envelope or float) and returning another volume-like
object. If you haven't used any envelopes, though, you can
assume the pitch is a float.
* **start_beat** -- beat to start on
* **stop_beat** -- beat to stop on (None keeps going until
the end of the part)
* **selected_voices** -- which voices to take notes from
(defaults to all if None)
Returns:
self, for chaining purposes
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
to_score(quantization_scheme: QuantizationScheme = None, time_signature: str | Sequence = None, bar_line_locations: Sequence[float] = None, max_divisor: int = None, max_divisor_indigestibility: int = None, simplicity_preference: float = None, title: str = 'default', composer: str = 'default') -> Score
Convert this Performance (list of note events in continuous time
and pitch) to a Score object, which represents the music in
traditional western notation. In the process, the music must be
quantized, for which two different options are available: one
can either pass a QuantizationScheme to the first argument,
which is very flexible but rather verbose to create, or one can
specify arguments such as time signature and max divisor
directly.
Parameters:
* **quantization_scheme** -- The quantization scheme to be
used when converting this performance into a score. If this
is defined, none of the other quantization-related
arguments should be defined.
* **time_signature** -- the time signature to be used,
represented as a string, e.g. "3/4", or a tuple, e.g. (3,
2). Alternatively, a list of time signatures can be given.
If this list ends in "loop", then the pattern specified by
the list will be looped. For example, ["4/4", "2/4", "3/4",
"loop"] will cause the fourth measure to be in "4/4", the
fifth in "2/4", etc. If the list does not end in "loop",
all measures after the final time signature specified will
continue to be in that time signature.
* **bar_line_locations** -- As an alternative to defining the
time signatures, a list of numbers representing the bar
line locations can be given. For instance, [4.5, 6.5, 8,
11] would result in bars of time signatures 9/8, 2/4, 3/8,
and 3/4
* **max_divisor** -- The largest divisor that will be allowed
to divide the beat.
* **max_divisor_indigestibility** -- Indigestibility, devised
by composer Clarence Barlow, is a measure of the
"primeness" of a beat divisor, and therefore of its
complexity from the point of view of a performer. For
instance, it is easier to divide a beat in 8 than in 7,
even though 7 is a smaller number. See Clarence's paper
here: https://mat.ucsb.edu/Publications/Quantification_of_H
armony_and_Metre.pdf. By setting a max indigestibility, we
can allow larger divisions of the beat, but only so long as
they are easy ones. For instance, a max_divisor of 16 and a
max_divisor_indigestibility of 8 would allow the beat to be
divided in 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, and 16.
* **simplicity_preference** -- This defines the degree to
which the quantizer will favor simple divisors. The higher
the simplicity preference, the more precisely the notes
have to fit for you to get a divisor like 7. Simplicity
preference can range from 0 (in which case the divisor is
chosen purely based on the lowest error) to infinity, with
a typical value somewhere around 1.
* **title** -- Title of the piece to be printed on the score.
* **composer** -- Composer of the piece to be printed on the
score.
Returns:
the resulting Score object, which can then be rendered either
as XML or LilyPond
transpose(interval: float)
Transposes all notes in this Performance up or down by the
desired interval. For greater flexibility, use the
"apply_pitch_filter" and "apply_note_filter" methods.
Parameters:
**interval** -- the interval by which to transpose this
Performance
Returns:
self, for chaining purposes
======================================================================
=== FILE: scamp/scamp.performance.PerformanceNote.txt
======================================================================
scamp.performance.PerformanceNote
*********************************
class scamp.performance.PerformanceNote(start_beat: float, length: float | tuple[float, ...], pitch: float | Envelope | Sequence, volume: float | Envelope, properties: dict, velocity: float = None)
Bases: "SavesToJSON"
Represents a single note played by a "ScampInstrument".
Parameters:
* **start_beat** -- the start beat of the note
* **length** -- the length of the note in beats (either a float
or a tuple of floats representing tied segments)
* **pitch** -- the pitch of the note (float or Envelope)
* **volume** -- the volume of the note (float or Envelope)
* **properties** -- dictionary of note properties, or string
representing those properties
* **velocity** -- the note-on velocity (0 to 1) if it was
explicitly set independently of volume, else None. This is
playback-only, so it does not affect notation, but it is
preserved so that playback and MIDI export can reproduce the
original attack.
Variables:
* **start_beat** -- the start beat of the note
* **length** -- the length of the note in beats (either a float
or a tuple of floats representing tied segments)
* **pitch** -- the pitch of the note (float or Envelope); note
that this can also be a tuple of pitches representing a chord,
but that this usually happens in the process of quantization
when notes that can be merged into chords are merged.
* **volume** -- the volume of the note (float or Envelope)
* **properties** -- dictionary of note properties, or string
representing those properties
* **velocity** -- the note-on velocity (0 to 1) if explicitly
set independently of volume, else None
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "attempt_c | Try to merge this note with another note to form a chord. |
| hord_merge | |
| r_with"(ot | |
| her) | |
+------------+--------------------------------------------------------------------------------------------+
| "average_p | Averages the pitch of this note, accounting for if it's a glissando or a chord |
| itch"() | |
+------------+--------------------------------------------------------------------------------------------+
| "length_su | Total length of this note, adding together any tied segments. |
| m"() | |
+------------+--------------------------------------------------------------------------------------------+
| "next_id"( | Return a new unique ID number for this note, different from all PerformanceNotes created |
| ) | so far. |
+------------+--------------------------------------------------------------------------------------------+
| "play"(ins | Play this note with the given instrument on the given clock |
| trument[, | |
| clock, | |
| blocking]) | |
+------------+--------------------------------------------------------------------------------------------+
| "split_at_ | Splits this note at the given beat, returning a tuple of the pieces created |
| beat"(spli | |
| t_beat) | |
+------------+--------------------------------------------------------------------------------------------+
| "split_at_ | If the self.length is a tuple, indicating a set of tied constituents, splits this into |
| length_div | separate PerformanceNotes |
| isions"() | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "end_beat" | End beat of this note |
+------------+--------------------------------------------------------------------------------------------+
length_sum() -> float
Total length of this note, adding together any tied segments.
(The attribute "length" can be a list of floats representing
tied segments.)
Returns:
length of note as a float
property end_beat: float
End beat of this note
average_pitch() -> float
Averages the pitch of this note, accounting for if it's a
glissando or a chord
Returns:
the averaged pitch as a float
play(instrument: ScampInstrument, clock: Clock = None, blocking: bool = True) -> None
Play this note with the given instrument on the given clock
Parameters:
* **instrument** -- instrument to play back with
* **clock** -- the clock to play back on (if None, infers it
from context)
* **blocking** -- if True, don't return until the note is
done playing; if False, return immediately
static next_id() -> int
Return a new unique ID number for this note, different from all
PerformanceNotes created so far.
Returns:
id number (int)
split_at_beat(split_beat: float) -> Sequence[PerformanceNote]
Splits this note at the given beat, returning a tuple of the
pieces created
Parameters:
**split_beat** -- where to split (relative to the performance
start time, not the note start time)
Returns:
tuple of (first half note, second half note) if split beat is
within the note. Otherwise just return the unchanged note in
a length-1 tuple.
split_at_length_divisions() -> Sequence[PerformanceNote]
If the self.length is a tuple, indicating a set of tied
constituents, splits this into separate PerformanceNotes
Returns:
a list of pieces
attempt_chord_merger_with(other: PerformanceNote) -> bool
Try to merge this note with another note to form a chord.
Returns whether it worked or not, and when it did, has the side
effect of changing this note into a chord that incorporates the
other note.
Parameters:
**other** -- another PerformanceNote
Returns:
True if the merger works, False otherwise
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.performance.PerformancePart.txt
======================================================================
scamp.performance.PerformancePart
*********************************
class scamp.performance.PerformancePart(instrument: ScampInstrument = None, name: str = None, voices: dict | Sequence = None, instrument_id: tuple[str, int] = None, voice_quantization_records: dict = None, clef_preference: Sequence[str | tuple[str, Real]] = None)
Bases: "SavesToJSON", "_NoteFiltersMixin"
Transcription of the notes played by a single "ScampInstrument".
Can be saved to and loaded from a json file and played back on a
clock.
Parameters:
* **instrument** -- the ScampInstrument associated with this
part; used for playback
* **name** -- The name of this part
* **voices** -- either a list of PerformanceNotes (which is
interpreted as one unnamed voice), a list of lists of
PerformanceNotes (which is interpreted as several numbered
voices), or a dictionary mapping voice names to lists of
notes.
* **instrument_id** -- a json serializable record of the
instrument used
* **voice_quantization_records** -- a record of how this part
was quantized if it has been quantized
Variables:
* **instrument** -- the ScampInstrument associated with this
part; used for playback
* **name** -- The name of this part
* **voices** -- dictionary mapping voice names to lists of
notes.
* **instrument_id** -- a json serializable record of the
instrument used
* **voice_quantization_records** -- dictionary mapping voice
names to QuantizationRecords, if this is quantized
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "add_note" | Add a new Performance note to this PerformancePart. |
| (note[, | |
| voice]) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_note_ | Returns an iterator returning all the notes from start_beat to stop_beat in the selected |
| iterator"( | voices |
| [start_bea | |
| t, | |
| stop_beat, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "is_quanti | Checks if this part has been quantized |
| zed"() | |
+------------+--------------------------------------------------------------------------------------------+
| "name_coun | When there are multiple instrument of the same name in an ensemble, keeps track of which |
| t"() | one we mean |
+------------+--------------------------------------------------------------------------------------------+
| "new_note" | Construct and add a new PerformanceNote to this Performance |
| (start_bea | |
| t, length, | |
| pitch, | |
| volume, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "num_measu | If this PerformancePart has been quantized, gets the number of measures |
| res"() | |
+------------+--------------------------------------------------------------------------------------------+
| "play"([st | Play this PerformancePart (or a selection of it) |
| art_beat, | |
| stop_beat, | |
| instrument | |
| , ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "quantize" | Quantizes this PerformancePart according to the quantization_scheme |
| ([quantiza | |
| tion_schem | |
| e, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "quantized | Same as quantize, except that it returns a new copy, rather than changing this |
| "([quantiz | PerformancePart in place. |
| ation_sche | |
| me, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_instr | Set the instrument with which this PerformancePart will play back by default |
| ument"(ins | |
| trument) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_instr | Set the default instrument to play back with based on the best fit in the given ensemble |
| ument_from | |
| _ensemble" | |
| (ensemble) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_staff_ | Converts this PerformancePart to a StaffGroup object. |
| group"() | |
+------------+--------------------------------------------------------------------------------------------+
| "write_to_ | Writes the contents of this part to a track of a midiutil.MIDIFile. |
| midi_file_ | |
| track"(mid | |
| i_file, | |
| track_num) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "apply_not | Applies a filter function to every note in this Performance. |
| e_filter"( | |
| filter_fun | |
| ction[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "apply_pit | Applies a filter function to transform the pitch of every note in this Performance. |
| ch_filter" | |
| (filter_fu | |
| nction[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "apply_vol | Applies a filter function to transform the volume of every note in this Performance. |
| ume_filter | |
| "(filter_f | |
| unction[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
| "transpose | Transposes all notes in this Performance up or down by the desired interval. |
| "(interval | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "end_beat" | End beat of the last note in this part. |
+------------+--------------------------------------------------------------------------------------------+
| "measure_l | If this PerformancePart has been quantized, gets the lengths of all the measures |
| engths" | |
+------------+--------------------------------------------------------------------------------------------+
add_note(note: PerformanceNote, voice: str = None) -> PerformanceNote
Add a new Performance note to this PerformancePart.
Parameters:
* **note** -- the note to add
* **voice** -- name of the voice to which to add it (defaults
to "_unspecified_")
Returns:
the note you just added (for chaining purposes)
new_note(start_beat: float, length, pitch, volume, properties: dict, velocity: float = None) -> PerformanceNote
Construct and add a new PerformanceNote to this Performance
Parameters:
* **start_beat** -- the start beat of the note
* **length** -- length of the note in beats (either a float
or a list of floats representing tied segments)
* **pitch** -- pitch of the note (float, Envelope, or list to
interpret as an envelope)
* **volume** -- volume of the note (float or Envelope, or
list to interpret as an envelope)
* **properties** -- dictionary of note properties, or string
representing those properties
* **velocity** -- an explicit note-on velocity (0 to 1) set
independently of volume, else None
Returns:
the note just added
set_instrument(instrument: ScampInstrument) -> None
Set the instrument with which this PerformancePart will play
back by default
Parameters:
**instrument** -- the instrument to use
property end_beat: float
End beat of the last note in this part.
get_note_iterator(start_beat: float = 0, stop_beat: float = None, selected_voices: Sequence[str] = None) -> Iterator[PerformanceNote]
Returns an iterator returning all the notes from start_beat to
stop_beat in the selected voices
Parameters:
* **start_beat** -- beat to start on
* **stop_beat** -- beat to stop on (None keeps going until
the end of the part)
* **selected_voices** -- which voices to take notes from
(defaults to all if None)
Returns:
an iterator
play(start_beat: float = 0, stop_beat: float = None, instrument: ScampInstrument = None, clock: Clock = None, blocking: bool = True, tempo_envelope: TempoEnvelope = None, selected_voices: Sequence[str] = None, note_filter: Callable[[PerformanceNote], PerformanceNote] = None) -> Clock
Play this PerformancePart (or a selection of it)
Parameters:
* **start_beat** -- Place to start playing from
* **stop_beat** -- Place to stop playing at
* **instrument** -- instrument to play back with
* **clock** -- clock to use for playback
* **blocking** -- if True, don't return until the part is
done playing; if False, return immediately
* **tempo_envelope** -- (optional) a tempo envelope to use
for playback
* **selected_voices** -- which voices to play back (defaults
to all if None)
* **note_filter** -- a function that takes the
PerformanceNote about to be played and returns a modified
PerformanceNote to play. NB: this will modify the original
note unless the input to the function is duplicated and
left unaltered!
Returns:
the Clock on which playback takes place
set_instrument_from_ensemble(ensemble: Ensemble) -> PerformancePart
Set the default instrument to play back with based on the best
fit in the given ensemble
Parameters:
**ensemble** -- the ensemble to search in
Returns:
self
write_to_midi_file_track(midi_file: MIDIFile, track_num: int, max_channels=16, ring_time=0.5, pitch_bend_range=2, envelope_precision=0.01) -> None
Writes the contents of this part to a track of a
midiutil.MIDIFile. Used by "Performance.export_to_midi_file()".
Parameters:
* **midi_file** -- a midiutil.MIDIFile
* **track_num** -- which track to write to
* **max_channels** -- maximum number of channels to use for
different notes. By default, notes with different pitch
bends and cc messages will be placed on different channels
to avoid interference.
* **ring_time** -- When multiple channels are used for
juggling different pitch bends and cc messages, channels
are reused when the notes on them have finished. However,
if they're reused right away, this can cause the note that
just finished and is perhaps ringing/reverberating to get
altered undesirably. ring_time is the amount of time that
we wait before reassigning a channel.
* **pitch_bend_range** -- By default +- 2 semitones. If a
greater pitch bend is needed, this parameter will scale all
pitch bend messages accordingly. It will also attempt to
send RPN messages to let the synthesizer know, though in
practice many softsynths ignore this and will need to have
their pitch bend range set manually.
* **envelope_precision** -- For glissandi, volume curves, and
any other parameter that is being given an "Envelope", this
is the temporal precision of the corresponding midi events.
quantize(quantization_scheme: QuantizationScheme = 'default', onset_weighting: float = 'default', termination_weighting: float = 'default') -> PerformancePart
Quantizes this PerformancePart according to the
quantization_scheme
Parameters:
* **quantization_scheme** -- the QuantizationScheme to use.
If "default", uses the default time signature defined in
the quantization_settings.
* **onset_weighting** -- how much to weight note onsets in
the quantization. If "default", uses the default value
defined in the quantization_settings.
* **termination_weighting** -- how much to weight note
terminations in the quantization. If "default", uses the
default value defined in the quantization_settings.
Returns:
this PerformancePart, having been quantized
quantized(quantization_scheme: QuantizationScheme = 'default', onset_weighting: float = 'default', termination_weighting: float = 'default') -> PerformancePart
Same as quantize, except that it returns a new copy, rather than
changing this PerformancePart in place.
Parameters:
* **quantization_scheme** -- the QuantizationScheme to use.
If "default", uses the default time signature defined in
the quantization_settings.
* **onset_weighting** -- how much to weight note onsets in
the quantization. If "default", uses the default value
defined in the quantization_settings.
* **termination_weighting** -- how much to weight note
terminations in the quantization. If "default", uses the
default value defined in the quantization_settings.
Returns:
a quantized copy of this PerformancePart
is_quantized() -> bool
Checks if this part has been quantized
Returns:
True if quantized, False if not
property measure_lengths: Sequence[float]
If this PerformancePart has been quantized, gets the lengths of
all the measures
Returns:
list of measure lengths
num_measures() -> int
If this PerformancePart has been quantized, gets the number of
measures
Returns:
number of measures
to_staff_group() -> StaffGroup
Converts this PerformancePart to a StaffGroup object. (Quantizes
in a default way, if necessary, but it should be quantized
already.)
Returns:
a new StaffGroup made from this PerformancePart
name_count() -> int
When there are multiple instrument of the same name in an
ensemble, keeps track of which one we mean
Returns:
int representing which instrument we mean
apply_note_filter(filter_function: Callable[[PerformanceNote], None], start_beat: float = 0, stop_beat: float = None, selected_voices: Sequence[str] = None)
Applies a filter function to every note in this Performance.
This can be used to apply a transformation to the entire
Performance on a note-by-note basis.
Parameters:
* **filter_function** -- function taking a PerformanceNote
object and modifying it in place
* **start_beat** -- beat to start on
* **stop_beat** -- beat to stop on (None keeps going until
the end of the part)
* **selected_voices** -- which voices to take notes from
(defaults to all if None)
Returns:
self, for chaining purposes
apply_pitch_filter(filter_function: Callable[[Envelope | float], Envelope | float], start_beat: float = 0, stop_beat: float = None, selected_voices: Sequence[str] = None)
Applies a filter function to transform the pitch of every note
in this Performance.
Parameters:
* **filter_function** -- function taking a pitch (can be
envelope, float, or even a chord tuple) and returning
another pitch-like object. If the performance hasn't been
quantized and you're not using any glissandi, though, you
can assume the pitch is a float.
* **start_beat** -- beat to start on
* **stop_beat** -- beat to stop on (None keeps going until
the end of the part)
* **selected_voices** -- which voices to take notes from
(defaults to all if None)
Returns:
self, for chaining purposes
apply_volume_filter(filter_function: Callable[[Envelope | float], Envelope | float], start_beat: float = 0, stop_beat: float = None, selected_voices: Sequence[str] = None)
Applies a filter function to transform the volume of every note
in this Performance.
Parameters:
* **filter_function** -- function taking a volume (can be
envelope or float) and returning another volume-like
object. If you haven't used any envelopes, though, you can
assume the pitch is a float.
* **start_beat** -- beat to start on
* **stop_beat** -- beat to stop on (None keeps going until
the end of the part)
* **selected_voices** -- which voices to take notes from
(defaults to all if None)
Returns:
self, for chaining purposes
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
transpose(interval: float)
Transposes all notes in this Performance up or down by the
desired interval. For greater flexibility, use the
"apply_pitch_filter" and "apply_note_filter" methods.
Parameters:
**interval** -- the interval by which to transpose this
Performance
Returns:
self, for chaining purposes
======================================================================
=== FILE: scamp/scamp.performance.txt
======================================================================
scamp.performance
*****************
Module containing the "PerformanceNote", "PerformancePart", and
"Performance" classes, which represent transcriptions of notes played
by a group of "ScampInstrument" objects. These classes contain
continuous time, pitch, volume, and other parameter data, which can
then be quantized and converted into the notation-based classes in the
score module.
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "Performan | Representation of note playback events, usually a transcription of the notes played by an |
| ce"([parts | "Ensemble". |
| , tempo_en | |
| velope]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Performan | Represents a single note played by a "ScampInstrument". |
| ceNote"(st | |
| art_beat, | |
| length, | |
| pitch, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "Performan | Transcription of the notes played by a single "ScampInstrument". |
| cePart"([i | |
| nstrument, | |
| name, | |
| voices, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.performance.Performance
* "Performance"
* "Performance.new_part()"
* "Performance.add_part()"
* "Performance.get_part_by_index()"
* "Performance.get_parts_by_name()"
* "Performance.get_parts_by_instrument()"
* "Performance.end_beat"
* "Performance.length()"
* "Performance.get_note_iterator()"
* "Performance.remap_to_tempo()"
* "Performance.play()"
* "Performance.set_instruments_from_ensemble()"
* "Performance.quantize()"
* "Performance.quantized()"
* "Performance.is_quantized()"
* "Performance.num_measures()"
* "Performance.export_to_midi_file()"
* "Performance.apply_note_filter()"
* "Performance.apply_pitch_filter()"
* "Performance.apply_volume_filter()"
* "Performance.duplicate()"
* "Performance.json_dumps()"
* "Performance.json_loads()"
* "Performance.load_from_json()"
* "Performance.save_to_json()"
* "Performance.to_score()"
* "Performance.transpose()"
* scamp.performance.PerformanceNote
* "PerformanceNote"
* "PerformanceNote.length_sum()"
* "PerformanceNote.end_beat"
* "PerformanceNote.average_pitch()"
* "PerformanceNote.play()"
* "PerformanceNote.next_id()"
* "PerformanceNote.split_at_beat()"
* "PerformanceNote.split_at_length_divisions()"
* "PerformanceNote.attempt_chord_merger_with()"
* "PerformanceNote.duplicate()"
* "PerformanceNote.json_dumps()"
* "PerformanceNote.json_loads()"
* "PerformanceNote.load_from_json()"
* "PerformanceNote.save_to_json()"
* scamp.performance.PerformancePart
* "PerformancePart"
* "PerformancePart.add_note()"
* "PerformancePart.new_note()"
* "PerformancePart.set_instrument()"
* "PerformancePart.end_beat"
* "PerformancePart.get_note_iterator()"
* "PerformancePart.play()"
* "PerformancePart.set_instrument_from_ensemble()"
* "PerformancePart.write_to_midi_file_track()"
* "PerformancePart.quantize()"
* "PerformancePart.quantized()"
* "PerformancePart.is_quantized()"
* "PerformancePart.measure_lengths"
* "PerformancePart.num_measures()"
* "PerformancePart.to_staff_group()"
* "PerformancePart.name_count()"
* "PerformancePart.apply_note_filter()"
* "PerformancePart.apply_pitch_filter()"
* "PerformancePart.apply_volume_filter()"
* "PerformancePart.duplicate()"
* "PerformancePart.json_dumps()"
* "PerformancePart.json_loads()"
* "PerformancePart.load_from_json()"
* "PerformancePart.save_to_json()"
* "PerformancePart.transpose()"
======================================================================
=== FILE: scamp/scamp.playback_adjustments.NotePlaybackAdjustment.txt
======================================================================
scamp.playback_adjustments.NotePlaybackAdjustment
*************************************************
class scamp.playback_adjustments.NotePlaybackAdjustment(pitch_adjustment: ParamPlaybackAdjustment = None, volume_adjustment: ParamPlaybackAdjustment = None, length_adjustment: ParamPlaybackAdjustment = None, scale_envelopes_to_length=False)
Bases: "SavesToJSON", "NoteProperty"
Represents an adjustment to the pitch, volume and/or length of the
playback of a single note
Parameters:
* **pitch_adjustment** -- The desired adjustment for the note's
pitch. (None indicates no adjustment)
* **volume_adjustment** -- The desired adjustment for the note's
volume. (None indicates no adjustment)
* **length_adjustment** -- The desired adjustment for the note's
length. (None indicates no adjustment)
Variables:
* **pitch_adjustment** -- The desired adjustment for the note's
pitch. (None indicates no adjustment)
* **volume_adjustment** -- The desired adjustment for the note's
volume. (None indicates no adjustment)
* **length_adjustment** -- The desired adjustment for the note's
length. (None indicates no adjustment)
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "add_to_pa | Constructs a NotePlaybackAdjustment that adds to the parameters |
| rams"([pit | |
| ch, | |
| volume, | |
| length]) | |
+------------+--------------------------------------------------------------------------------------------+
| "adjust_pa | Carry out the adjustments represented by this object on the pitch, volume and length |
| rameters"( | given. |
| pitch, | |
| volume, | |
| length) | |
+------------+--------------------------------------------------------------------------------------------+
| "from_stri | Construct a NotePlaybackAdjustment from a string using a particular grammar. |
| ng"(string | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "scale_par | Constructs a NotePlaybackAdjustment that scales the parameters |
| ams"([pitc | |
| h, volume, | |
| length]) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_param | Constructs a NotePlaybackAdjustment that directly resets the parameters |
| s"([pitch, | |
| volume, | |
| length]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
classmethod from_string(string: str) -> NotePlaybackAdjustment
Construct a NotePlaybackAdjustment from a string using a
particular grammar.
Parameters:
**string** -- should take the form of, e.g. "volume * 0.5
pitch = 69 length * 2 - 1". This would cause the volume to be
halved, the pitch to be set to 69, and the length to be
doubled plus 1. Note that "/" for division is not understood
and that where a multiplication and an addition/subtraction
are used together, the multiplication must come first. The
parameters can be separated by commas or semicolons
optionally, for visual clarity.
Returns:
a shiny new NotePlaybackAdjustment
classmethod scale_params(pitch=1, volume=1, length=1) -> NotePlaybackAdjustment
Constructs a NotePlaybackAdjustment that scales the parameters
Parameters:
* **pitch** -- pitch scale factor
* **volume** -- volume scale factor
* **length** -- length scale factor
Returns:
a shiny new NotePlaybackAdjustment
classmethod add_to_params(pitch=None, volume=None, length=None) -> NotePlaybackAdjustment
Constructs a NotePlaybackAdjustment that adds to the parameters
Parameters:
* **pitch** -- pitch addition
* **volume** -- volume addition
* **length** -- length addition
Returns:
a shiny new NotePlaybackAdjustment
classmethod set_params(pitch=None, volume=None, length=None) -> NotePlaybackAdjustment
Constructs a NotePlaybackAdjustment that directly resets the
parameters
Parameters:
* **pitch** -- new pitch setting
* **volume** -- new volume setting
* **length** -- new length setting
Returns:
a shiny new NotePlaybackAdjustment
adjust_parameters(pitch, volume, length)
Carry out the adjustments represented by this object on the
pitch, volume and length given.
Parameters:
* **pitch** -- pitch to adjust
* **volume** -- volume to adjust
* **length** -- length to adjust
Returns:
tuple of (adjusted_pitch, adjusted_volume, adjusted_length)
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.playback_adjustments.ParamPlaybackAdjustment.txt
======================================================================
scamp.playback_adjustments.ParamPlaybackAdjustment
**************************************************
class scamp.playback_adjustments.ParamPlaybackAdjustment(multiply: Real | Envelope | Sequence = 1, add: Real | Envelope | Sequence = 0)
Bases: "SavesToJSON"
Represents a multiply/add playback adjustment to a single
parameter. (The multiply happens first, then the add.)
Parameters:
* **multiply** -- how much to multiply by
* **add** -- how much to add
Variables:
* **multiply** -- how much to multiply by
* **add** -- how much to add
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "add"(valu | Class method for a simple additive adjustment. |
| e) | |
+------------+--------------------------------------------------------------------------------------------+
| "adjust_va | Apply this adjustment to a given parameter value |
| lue"(param | |
| _value[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "from_stri | Construct a ParamPlaybackAdjustment from an appropriately formatted string. |
| ng"(string | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "scale"(va | Class method for a simple scaling adjustment. |
| lue) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_to"(v | Class method for an adjustment that resets the value of the parameter, ignoring its |
| alue) | original value |
+------------+--------------------------------------------------------------------------------------------+
| "uses_enve | Whether this adjustment varies over the course of the note, i.e. whether either the amount |
| lope"() | added or the amount multiplied by is an "Envelope". |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
classmethod from_string(string: str) -> ParamPlaybackAdjustment
Construct a ParamPlaybackAdjustment from an appropriately
formatted string.
Parameters:
**string** -- written using either "*", "+"/"-", both "*" and
"+"/"-" or equals followed by numbers. For example, "* 0.5"
multiplies by 0.5, "= 7" sets equal to 87, "* 1.1 - 3"
multiplies by 1.1 and then subtracts 3. Note that "/" for
division is not understood (instead multiply by the inverse),
and that where a multiplication and an addition/subtraction
are used together, the multiplication must come first.
Returns:
a ParamPlaybackAdjustment
classmethod set_to(value) -> ParamPlaybackAdjustment
Class method for an adjustment that resets the value of the
parameter, ignoring its original value
Parameters:
**value** -- the value to set the parameter to
classmethod scale(value) -> ParamPlaybackAdjustment
Class method for a simple scaling adjustment.
Parameters:
**value** -- the factor to scale by
classmethod add(value) -> ParamPlaybackAdjustment
Class method for a simple additive adjustment.
Parameters:
**value** -- how much to add
adjust_value(param_value, normalize_envelope_to_length=None)
Apply this adjustment to a given parameter value
Parameters:
* **param_value** -- the parameter value to adjust
* **normalize_envelope_to_length** -- if given, and the add
or multiply is an Envelope object, normalize the length of
that envelope object to this.
Returns:
the adjusted value of the parameter
uses_envelope()
Whether this adjustment varies over the course of the note, i.e.
whether either the amount added or the amount multiplied by is
an "Envelope".
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.playback_adjustments.txt
======================================================================
scamp.playback_adjustments
**************************
Module containing classes for defining adjustments to the playback of
note parameters, as well as the "PlaybackAdjustmentsDictionary", which
defines how particular notations should be played back.
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "NotePlayb | Represents an adjustment to the pitch, volume and/or length of the playback of a single |
| ackAdjustm | note |
| ent"([pitc | |
| h_adjustme | |
| nt, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "ParamPlay | Represents a multiply/add playback adjustment to a single parameter. |
| backAdjust | |
| ment"([mul | |
| tiply, | |
| add]) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.playback_adjustments.NotePlaybackAdjustment
* "NotePlaybackAdjustment"
* "NotePlaybackAdjustment.from_string()"
* "NotePlaybackAdjustment.scale_params()"
* "NotePlaybackAdjustment.add_to_params()"
* "NotePlaybackAdjustment.set_params()"
* "NotePlaybackAdjustment.adjust_parameters()"
* "NotePlaybackAdjustment.duplicate()"
* "NotePlaybackAdjustment.json_dumps()"
* "NotePlaybackAdjustment.json_loads()"
* "NotePlaybackAdjustment.load_from_json()"
* "NotePlaybackAdjustment.save_to_json()"
* scamp.playback_adjustments.ParamPlaybackAdjustment
* "ParamPlaybackAdjustment"
* "ParamPlaybackAdjustment.from_string()"
* "ParamPlaybackAdjustment.set_to()"
* "ParamPlaybackAdjustment.scale()"
* "ParamPlaybackAdjustment.add()"
* "ParamPlaybackAdjustment.adjust_value()"
* "ParamPlaybackAdjustment.uses_envelope()"
* "ParamPlaybackAdjustment.duplicate()"
* "ParamPlaybackAdjustment.json_dumps()"
* "ParamPlaybackAdjustment.json_loads()"
* "ParamPlaybackAdjustment.load_from_json()"
* "ParamPlaybackAdjustment.save_to_json()"
======================================================================
=== FILE: scamp/scamp.playback_implementations.MIDIStreamPlaybackImplementation.txt
======================================================================
scamp.playback_implementations.MIDIStreamPlaybackImplementation
***************************************************************
class scamp.playback_implementations.MIDIStreamPlaybackImplementation(midi_output_device: str = 'default', num_channels=8, midi_output_name: str | None = None, max_pitch_bend: int = 'default', start_channel=0, volume_cc_num: int = 11)
Bases: "_MIDIPlaybackImplementation"
Playback implementation that sends an outgoing MIDI stream to an
external synthesizer / program
Parameters:
* **midi_output_device** -- name or port number of the midi
output device to use.
* **num_channels** -- How many MIDI channels to use for this
instrument. Where channel-wide messages (such as pitch-bend
messages) are involved, it is essential to have several
channels at our disposal.
* **midi_output_name** -- name to use when sending messages
* **max_pitch_bend** -- max pitch bend allowed on this
instrument. Defaults to the one defined in
playback_settings.default_max_streaming_midi_pitch_bend.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "cc"(chan, | Sends an arbitrary midi CC message |
| cc_number, | |
| value_from | |
| _0_to_1) | |
+------------+--------------------------------------------------------------------------------------------+
| "note_off" | Sends a note_off MIDI message |
| (chan, | |
| pitch) | |
+------------+--------------------------------------------------------------------------------------------+
| "note_on"( | Sends a note_on MIDI message |
| chan, | |
| pitch, vel | |
| ocity_from | |
| _0_to_1) | |
+------------+--------------------------------------------------------------------------------------------+
| "pitch_ben | Sends a MIDI pitch bend message |
| d"(chan, b | |
| end_in_sem | |
| itones) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_max_p | Sets the max pitch bend for this MIDI device |
| itch_bend" | |
| (max_bend_ | |
| in_semiton | |
| es) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Method that implements the change of a parameter other than pitch or volume |
| te_paramet | |
| er"(note_i | |
| d, ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Method that implements the change of a note's pitch |
| te_pitch"( | |
| note_id, | |
| new_pitch) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Method that implements the change of a note's volume |
| te_volume" | |
| (note_id, | |
| new_volume | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "end_note" | Method that implements the end of a note |
| (note_id) | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
| "start_not | Method that implements the start of a note |
| e"(note_id | |
| , pitch, | |
| volume, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "volume_cc | Sends a midi expression message |
| "(chan, vo | |
| lume_from_ | |
| 0_to_1) | |
+------------+--------------------------------------------------------------------------------------------+
note_on(chan: int, pitch: int, velocity_from_0_to_1: float)
Sends a note_on MIDI message
Parameters:
* **chan** -- channel to send message on
* **pitch** -- integer MIDI pitch value
* **velocity_from_0_to_1** -- velocity to send (NB: scaled
from 0 to 1)
note_off(chan: int, pitch: int)
Sends a note_off MIDI message
Parameters:
* **chan** -- channel to send message on
* **pitch** -- integer MIDI pitch value
pitch_bend(chan: int, bend_in_semitones: float)
Sends a MIDI pitch bend message
Parameters:
* **chan** -- channel to send message on
* **bend_in_semitones** -- the pitch bend amount (in
semitones!)
set_max_pitch_bend(max_bend_in_semitones: int)
Sets the max pitch bend for this MIDI device
Parameters:
**max_bend_in_semitones** -- value to set as maximum pitch
bend
cc(chan: int, cc_number: int, value_from_0_to_1: float)
Sends an arbitrary midi CC message
Parameters:
* **chan** -- channel to send the message on
* **cc_number** -- number representing the type of the
control change message
* **value_from_0_to_1** -- value to send (NB: scaled from 0
to 1)
change_note_parameter(note_id, parameter_name, new_value)
Method that implements the change of a parameter other than
pitch or volume
Parameters:
* **note_id** -- unique identifier of the note to effect
* **parameter_name** -- name of the parameter to change
* **new_value** -- new floating-point value of that parameter
change_note_pitch(note_id, new_pitch)
Method that implements the change of a note's pitch
Parameters:
* **note_id** -- unique identifier of the note whose pitch to
change
* **new_pitch** -- new (floating-point) MIDI pitch value
change_note_volume(note_id, new_volume)
Method that implements the change of a note's volume
Parameters:
* **note_id** -- unique identifier of the note whose volume
to change
* **new_volume** -- new floating point volume value from 0 to
1
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
end_note(note_id)
Method that implements the end of a note
Parameters:
**note_id** -- unique identifier of the note to end
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
start_note(note_id, pitch, volume, properties, note_info_dict)
Method that implements the start of a note
Parameters:
* **note_id** -- unique identifier for the note we are
starting
* **pitch** -- floating-point MIDI pitch value
* **volume** -- floating-point volume value (from 0 to 1)
* **properties** -- a NotePropertiesDictionary
* **other_parameter_values** -- dictionary mapping parameter
name to parameter value for parameters other than pitch and
volume. (This information was extracted from the properties
dictionary.)
* **note_info_dict** -- dictionary with auxiliary info about
this note (e.g. the clock it's running on, time stamp,
various flags)
volume_cc(chan, volume_from_0_to_1) -> None
Sends a midi expression message
Parameters:
* **chan** -- channel to send message on
* **volume_from_0_to_1** -- volume to send (NB: scaled from 0
to 1)
======================================================================
=== FILE: scamp/scamp.playback_implementations.OSCPlaybackImplementation.txt
======================================================================
scamp.playback_implementations.OSCPlaybackImplementation
********************************************************
class scamp.playback_implementations.OSCPlaybackImplementation(port: int, ip_address: str = '127.0.0.1', message_prefix: str = 'scamp', osc_message_addresses: dict = 'default')
Bases: "PlaybackImplementation"
Playback implementation that sends outgoing OSC messages to an
external synthesizer / program
Parameters:
* **port** -- OSC port to use for playback
* **ip_address** -- ip_address to send OSC messages to
* **message_prefix** -- prefix used in the address of all
messages sent. Defaults to the name of the instrument
* **osc_message_addresses** -- dictionary mapping the kind of
the message to the address for that message. Defaults to
playback_settings.osc_message_addresses
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Method that implements the change of a parameter other than pitch or volume |
| te_paramet | |
| er"(note_i | |
| d, ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Method that implements the change of a note's pitch |
| te_pitch"( | |
| note_id, | |
| new_pitch) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Method that implements the change of a note's volume |
| te_volume" | |
| (note_id, | |
| new_volume | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "end_note" | Method that implements the end of a note |
| (note_id) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_max_p | This method does nothing in the case of an OSC-based implementation |
| itch_bend" | |
| (semitones | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "start_not | Method that implements the start of a note |
| e"(note_id | |
| , pitch, | |
| volume, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
start_note(note_id: int, pitch: float, volume: float, properties: NoteProperties, note_info_dict: dict) -> None
Method that implements the start of a note
Parameters:
* **note_id** -- unique identifier for the note we are
starting
* **pitch** -- floating-point MIDI pitch value
* **volume** -- floating-point volume value (from 0 to 1)
* **properties** -- a NotePropertiesDictionary
* **other_parameter_values** -- dictionary mapping parameter
name to parameter value for parameters other than pitch and
volume. (This information was extracted from the properties
dictionary.)
* **note_info_dict** -- dictionary with auxiliary info about
this note (e.g. the clock it's running on, time stamp,
various flags)
end_note(note_id: int) -> None
Method that implements the end of a note
Parameters:
**note_id** -- unique identifier of the note to end
change_note_pitch(note_id: int, new_pitch: float) -> None
Method that implements the change of a note's pitch
Parameters:
* **note_id** -- unique identifier of the note whose pitch to
change
* **new_pitch** -- new (floating-point) MIDI pitch value
change_note_volume(note_id: int, new_volume: float) -> None
Method that implements the change of a note's volume
Parameters:
* **note_id** -- unique identifier of the note whose volume
to change
* **new_volume** -- new floating point volume value from 0 to
1
change_note_parameter(note_id: int, parameter_name: str, new_value: float) -> None
Method that implements the change of a parameter other than
pitch or volume
Parameters:
* **note_id** -- unique identifier of the note to effect
* **parameter_name** -- name of the parameter to change
* **new_value** -- new floating-point value of that parameter
set_max_pitch_bend(semitones: int) -> None
This method does nothing in the case of an OSC-based
implementation
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.playback_implementations.PlaybackImplementation.txt
======================================================================
scamp.playback_implementations.PlaybackImplementation
*****************************************************
class scamp.playback_implementations.PlaybackImplementation
Bases: "SavesToJSON"
Abstract base class for playback implementations, which do the
actual work of playback, either by playing sounds or by sending
messages to external synthesizers to play sounds.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Method that implements the change of a parameter other than pitch or volume |
| te_paramet | |
| er"(note_i | |
| d, ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Method that implements the change of a note's pitch |
| te_pitch"( | |
| note_id, | |
| new_pitch) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Method that implements the change of a note's volume |
| te_volume" | |
| (note_id, | |
| new_volume | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "end_note" | Method that implements the end of a note |
| (note_id) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_max_p | Method that sets the max pitch bend for MIDI-based playback implementations This is only |
| itch_bend" | relevant when playback is happening via the MIDI protocol. |
| (semitones | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "start_not | Method that implements the start of a note |
| e"(note_id | |
| , pitch, | |
| volume, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
abstractmethod start_note(note_id: int, pitch: float, volume: float, properties: NoteProperties, note_info_dict: dict) -> None
Method that implements the start of a note
Parameters:
* **note_id** -- unique identifier for the note we are
starting
* **pitch** -- floating-point MIDI pitch value
* **volume** -- floating-point volume value (from 0 to 1)
* **properties** -- a NotePropertiesDictionary
* **other_parameter_values** -- dictionary mapping parameter
name to parameter value for parameters other than pitch and
volume. (This information was extracted from the properties
dictionary.)
* **note_info_dict** -- dictionary with auxiliary info about
this note (e.g. the clock it's running on, time stamp,
various flags)
abstractmethod end_note(note_id: int) -> None
Method that implements the end of a note
Parameters:
**note_id** -- unique identifier of the note to end
abstractmethod change_note_pitch(note_id: int, new_pitch: float) -> None
Method that implements the change of a note's pitch
Parameters:
* **note_id** -- unique identifier of the note whose pitch to
change
* **new_pitch** -- new (floating-point) MIDI pitch value
abstractmethod change_note_volume(note_id: int, new_volume: float) -> None
Method that implements the change of a note's volume
Parameters:
* **note_id** -- unique identifier of the note whose volume
to change
* **new_volume** -- new floating point volume value from 0 to
1
abstractmethod change_note_parameter(note_id: int, parameter_name: str, new_value: float) -> None
Method that implements the change of a parameter other than
pitch or volume
Parameters:
* **note_id** -- unique identifier of the note to effect
* **parameter_name** -- name of the parameter to change
* **new_value** -- new floating-point value of that parameter
abstractmethod set_max_pitch_bend(semitones: int) -> None
Method that sets the max pitch bend for MIDI-based playback
implementations This is only relevant when playback is happening
via the MIDI protocol.
Parameters:
**semitones** -- unique identifier of the note to effect
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.playback_implementations.SoundfontPlaybackImplementation.txt
======================================================================
scamp.playback_implementations.SoundfontPlaybackImplementation
**************************************************************
class scamp.playback_implementations.SoundfontPlaybackImplementation(bank_and_preset: tuple[int, int] = (0, 0), soundfont: str = 'default', num_channels: int = 8, audio_driver: str = 'default', max_pitch_bend: int = 'default', volume_cc_num: int = 11)
Bases: "_MIDIPlaybackImplementation"
Playback implementation that does Soundfont playback, via the MIDI
protocol.
Parameters:
* **bank_and_preset** -- The bank and preset within the given
soundfont to use for playback
* **soundfont** -- String representing the soundfont to use for
playback. Defaults to the one defined in
playback_settings.default_soundfont
* **num_channels** -- How many MIDI channels to use for this
instrument. Where channel-wide messages (such as pitch-bend
messages) are involved, it is essential to have several
channels at our disposal.
* **audio_driver** -- name of the audio_driver to use. Defaults
to the one defined in playback_settings.default_audio_driver
* **max_pitch_bend** -- max pitch bend allowed on this
instrument. Defaults to the one defined in
playback_settings.default_max_soundfont_pitch_bend.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "cc"(chan, | Sends an arbitrary midi CC message |
| cc_number, | |
| value_from | |
| _0_to_1) | |
+------------+--------------------------------------------------------------------------------------------+
| "note_off" | Sends a note_off MIDI message |
| (chan, | |
| pitch) | |
+------------+--------------------------------------------------------------------------------------------+
| "note_on"( | Sends a note_on MIDI message |
| chan, | |
| pitch, vel | |
| ocity_from | |
| _0_to_1) | |
+------------+--------------------------------------------------------------------------------------------+
| "pitch_ben | Sends a MIDI pitch bend message |
| d"(chan, b | |
| end_in_sem | |
| itones) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_max_p | Sets the max pitch bend for this MIDI device |
| itch_bend" | |
| (semitones | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Method that implements the change of a parameter other than pitch or volume |
| te_paramet | |
| er"(note_i | |
| d, ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Method that implements the change of a note's pitch |
| te_pitch"( | |
| note_id, | |
| new_pitch) | |
+------------+--------------------------------------------------------------------------------------------+
| "change_no | Method that implements the change of a note's volume |
| te_volume" | |
| (note_id, | |
| new_volume | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "end_note" | Method that implements the end of a note |
| (note_id) | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
| "start_not | Method that implements the start of a note |
| e"(note_id | |
| , pitch, | |
| volume, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "volume_cc | Sends a midi expression message |
| "(chan, vo | |
| lume_from_ | |
| 0_to_1) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "soundfont | |
| _hosts" | |
+------------+--------------------------------------------------------------------------------------------+
soundfont_hosts = {}
note_on(chan: int, pitch: int, velocity_from_0_to_1: float)
Sends a note_on MIDI message
Parameters:
* **chan** -- channel to send message on
* **pitch** -- integer MIDI pitch value
* **velocity_from_0_to_1** -- velocity to send (NB: scaled
from 0 to 1)
note_off(chan: int, pitch: int)
Sends a note_off MIDI message
Parameters:
* **chan** -- channel to send message on
* **pitch** -- integer MIDI pitch value
pitch_bend(chan: int, bend_in_semitones: float)
Sends a MIDI pitch bend message
Parameters:
* **chan** -- channel to send message on
* **bend_in_semitones** -- the pitch bend amount (in
semitones!)
set_max_pitch_bend(semitones: int)
Sets the max pitch bend for this MIDI device
Parameters:
**max_bend_in_semitones** -- value to set as maximum pitch
bend
cc(chan: int, cc_number: int, value_from_0_to_1: float)
Sends an arbitrary midi CC message
Parameters:
* **chan** -- channel to send the message on
* **cc_number** -- number representing the type of the
control change message
* **value_from_0_to_1** -- value to send (NB: scaled from 0
to 1)
change_note_parameter(note_id, parameter_name, new_value)
Method that implements the change of a parameter other than
pitch or volume
Parameters:
* **note_id** -- unique identifier of the note to effect
* **parameter_name** -- name of the parameter to change
* **new_value** -- new floating-point value of that parameter
change_note_pitch(note_id, new_pitch)
Method that implements the change of a note's pitch
Parameters:
* **note_id** -- unique identifier of the note whose pitch to
change
* **new_pitch** -- new (floating-point) MIDI pitch value
change_note_volume(note_id, new_volume)
Method that implements the change of a note's volume
Parameters:
* **note_id** -- unique identifier of the note whose volume
to change
* **new_volume** -- new floating point volume value from 0 to
1
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
end_note(note_id)
Method that implements the end of a note
Parameters:
**note_id** -- unique identifier of the note to end
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
start_note(note_id, pitch, volume, properties, note_info_dict)
Method that implements the start of a note
Parameters:
* **note_id** -- unique identifier for the note we are
starting
* **pitch** -- floating-point MIDI pitch value
* **volume** -- floating-point volume value (from 0 to 1)
* **properties** -- a NotePropertiesDictionary
* **other_parameter_values** -- dictionary mapping parameter
name to parameter value for parameters other than pitch and
volume. (This information was extracted from the properties
dictionary.)
* **note_info_dict** -- dictionary with auxiliary info about
this note (e.g. the clock it's running on, time stamp,
various flags)
volume_cc(chan, volume_from_0_to_1) -> None
Sends a midi expression message
Parameters:
* **chan** -- channel to send message on
* **volume_from_0_to_1** -- volume to send (NB: scaled from 0
to 1)
======================================================================
=== FILE: scamp/scamp.playback_implementations.txt
======================================================================
scamp.playback_implementations
******************************
Module containing the abstract base class "PlaybackImplementation", as
well as several of its concrete subclasses:
"SoundfontPlaybackImplementation", "MidiPlaybackImplementations", and
"OSCPlaybackImplementation". "PlaybackImplementations" do the actual
work of playback, either by playing sounds or by sending messages to
external synthesizers to play sounds. A "ScampInstrument" can have one
or more "PlaybackImplementations".
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "MIDIStrea | Playback implementation that sends an outgoing MIDI stream to an external synthesizer / |
| mPlaybackI | program |
| mplementat | |
| ion"([...] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "OSCPlayba | Playback implementation that sends outgoing OSC messages to an external synthesizer / |
| ckImplemen | program |
| tation"(po | |
| rt[, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "PlaybackI | Abstract base class for playback implementations, which do the actual work of playback, |
| mplementat | either by playing sounds or by sending messages to external synthesizers to play sounds. |
| ion"() | |
+------------+--------------------------------------------------------------------------------------------+
| "Soundfont | Playback implementation that does Soundfont playback, via the MIDI protocol. |
| PlaybackIm | |
| plementati | |
| on"([...]) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.playback_implementations.MIDIStreamPlaybackImplementation
* "MIDIStreamPlaybackImplementation"
* "MIDIStreamPlaybackImplementation.note_on()"
* "MIDIStreamPlaybackImplementation.note_off()"
* "MIDIStreamPlaybackImplementation.pitch_bend()"
* "MIDIStreamPlaybackImplementation.set_max_pitch_bend()"
* "MIDIStreamPlaybackImplementation.cc()"
* "MIDIStreamPlaybackImplementation.change_note_parameter()"
* "MIDIStreamPlaybackImplementation.change_note_pitch()"
* "MIDIStreamPlaybackImplementation.change_note_volume()"
* "MIDIStreamPlaybackImplementation.duplicate()"
* "MIDIStreamPlaybackImplementation.end_note()"
* "MIDIStreamPlaybackImplementation.json_dumps()"
* "MIDIStreamPlaybackImplementation.json_loads()"
* "MIDIStreamPlaybackImplementation.load_from_json()"
* "MIDIStreamPlaybackImplementation.save_to_json()"
* "MIDIStreamPlaybackImplementation.start_note()"
* "MIDIStreamPlaybackImplementation.volume_cc()"
* scamp.playback_implementations.OSCPlaybackImplementation
* "OSCPlaybackImplementation"
* "OSCPlaybackImplementation.start_note()"
* "OSCPlaybackImplementation.end_note()"
* "OSCPlaybackImplementation.change_note_pitch()"
* "OSCPlaybackImplementation.change_note_volume()"
* "OSCPlaybackImplementation.change_note_parameter()"
* "OSCPlaybackImplementation.set_max_pitch_bend()"
* "OSCPlaybackImplementation.duplicate()"
* "OSCPlaybackImplementation.json_dumps()"
* "OSCPlaybackImplementation.json_loads()"
* "OSCPlaybackImplementation.load_from_json()"
* "OSCPlaybackImplementation.save_to_json()"
* scamp.playback_implementations.PlaybackImplementation
* "PlaybackImplementation"
* "PlaybackImplementation.start_note()"
* "PlaybackImplementation.end_note()"
* "PlaybackImplementation.change_note_pitch()"
* "PlaybackImplementation.change_note_volume()"
* "PlaybackImplementation.change_note_parameter()"
* "PlaybackImplementation.set_max_pitch_bend()"
* "PlaybackImplementation.duplicate()"
* "PlaybackImplementation.json_dumps()"
* "PlaybackImplementation.json_loads()"
* "PlaybackImplementation.load_from_json()"
* "PlaybackImplementation.save_to_json()"
* scamp.playback_implementations.SoundfontPlaybackImplementation
* "SoundfontPlaybackImplementation"
* "SoundfontPlaybackImplementation.soundfont_hosts"
* "SoundfontPlaybackImplementation.note_on()"
* "SoundfontPlaybackImplementation.note_off()"
* "SoundfontPlaybackImplementation.pitch_bend()"
* "SoundfontPlaybackImplementation.set_max_pitch_bend()"
* "SoundfontPlaybackImplementation.cc()"
* "SoundfontPlaybackImplementation.change_note_parameter()"
* "SoundfontPlaybackImplementation.change_note_pitch()"
* "SoundfontPlaybackImplementation.change_note_volume()"
* "SoundfontPlaybackImplementation.duplicate()"
* "SoundfontPlaybackImplementation.end_note()"
* "SoundfontPlaybackImplementation.json_dumps()"
* "SoundfontPlaybackImplementation.json_loads()"
* "SoundfontPlaybackImplementation.load_from_json()"
* "SoundfontPlaybackImplementation.save_to_json()"
* "SoundfontPlaybackImplementation.start_note()"
* "SoundfontPlaybackImplementation.volume_cc()"
======================================================================
=== FILE: scamp/scamp.quantization.BeatQuantizationScheme.txt
======================================================================
scamp.quantization.BeatQuantizationScheme
*****************************************
class scamp.quantization.BeatQuantizationScheme(length: float, divisors: Sequence, simplicity_preference: float = 'default')
Bases: "object"
Scheme for making a decision about which divisor to use to quantize
a beat
Parameters:
* **length** -- In quarter-notes
* **divisors** -- A list of allowed divisors or a list of tuples
of (divisor, undesirability). If just divisors are given, the
undesirability for each will be calculated based on its
indigestibility.
* **simplicity_preference** -- ranges 0 - whatever. A
simplicity_preference of 0 means all divisions are treated
equally; a 7 is as good as a 4. A simplicity_preference of 1
means that the error for a given divisor is weighted by that
divisor's indigestibility, and a simplicity_preference of 2
means the error is weighted by the indigestibility squared,
etc.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "from_max_ | Takes a max divisor argument instead of a list of allowed divisors. |
| divisor"(l | |
| ength, max | |
| _divisor[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "from_max_ | Takes a max_divisor and max_divisor_indigestibility to determine the list of divisors. |
| divisor_in | |
| digestibil | |
| ity"(lengt | |
| h, ...) | |
+------------+--------------------------------------------------------------------------------------------+
classmethod from_max_divisor(length: float, max_divisor: int, simplicity_preference: float = 'default') -> BeatQuantizationScheme
Takes a max divisor argument instead of a list of allowed
divisors.
Parameters:
* **length** -- In quarter-notes
* **max_divisor** -- The largest allowable divisor
* **simplicity_preference** -- Preference for simple divisors
(see class description)
classmethod from_max_divisor_indigestibility(length: float, max_divisor: int, max_divisor_indigestibility: float, simplicity_preference: float = 'default') -> BeatQuantizationScheme
Takes a max_divisor and max_divisor_indigestibility to determine
the list of divisors.
Parameters:
* **length** -- In quarter-notes
* **max_divisor** -- The largest allowable divisor
* **max_divisor_indigestibility** -- sets a hard limit on the
indigestibility of divisors that we will consider, in
contrast to simplicity_preference, which simply penalizes
indigestible divisors. (See Clarence Barlow's writing on
indigestibility.)
* **simplicity_preference** -- Preference for simple divisors
(see class description)
======================================================================
=== FILE: scamp/scamp.quantization.MeasureQuantizationScheme.txt
======================================================================
scamp.quantization.MeasureQuantizationScheme
********************************************
class scamp.quantization.MeasureQuantizationScheme(beat_schemes: Sequence[BeatQuantizationScheme], time_signature: TimeSignature | str, beat_groupings: Sequence = 'auto')
Bases: "object"
Scheme for quantizing a measure, including beat lengths and which
beat divisors to allow.
Parameters:
* **beat_schemes** -- list of BeatQuantizationSchemes for each
beat in the measure
* **time_signature** -- a TimeSignature or string representing a
time signature for this measure
* **beat_groupings** -- a (potentially nested) list/tuple
representing how beats come together to form larger groupings.
For instance, in 4/4 time the beat_groupings will default to
(2, 2).
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "from_time | Constructs a MeasureQuantizationScheme from a time signature. |
| _signature | |
| "(time_sig | |
| nature[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_beat_ | Generates a list of hierarchies representing how nested a subdivision is within the metric |
| hierarchie | structure. |
| s"(subdivi | |
| sion_lengt | |
| h) | |
+------------+--------------------------------------------------------------------------------------------+
classmethod from_time_signature(time_signature: TimeSignature | str | float, max_divisor: int = 'default', max_divisor_indigestibility: float = 'default', simplicity_preference: float = 'default') -> MeasureQuantizationScheme
Constructs a MeasureQuantizationScheme from a time signature.
All beats will follow the same quantization scheme, as dictated
by the parameters.
Parameters:
* **time_signature** -- Either a TimeSignature object or
something that can be interpreted as such (e.g. a string to
parse as a time signature, a measure length)
* **max_divisor** -- the max divisor for all beats in the is
measure (see "BeatQuantizationScheme")
* **max_divisor_indigestibility** -- the max indigestibility
for all beats in the is measure (see
"BeatQuantizationScheme")
* **simplicity_preference** -- the simplicity preference for
all beats in the is measure (see "BeatQuantizationScheme")
get_beat_hierarchies(subdivision_length: float) -> Sequence[int]
Generates a list of hierarchies representing how nested a
subdivision is within the metric structure. For instance, if
called on a 4/4 measure, with subdivision_length, 0.5, this will
return the list [0, 3, 2, 3, 1, 3, 2, 3], showing that the first
subdivision (downbeat) is the strongest, the 5th (3rd beat) is
one level down, etc.
Parameters:
**subdivision_length** -- length (in quarter notes) of the
subdivision
======================================================================
=== FILE: scamp/scamp.quantization.QuantizationRecord.txt
======================================================================
scamp.quantization.QuantizationRecord
*************************************
class scamp.quantization.QuantizationRecord(quantized_measures: Sequence[QuantizedMeasure])
Bases: "SavesToJSON"
Record of how a "PerformancePart" was quantized.
Parameters:
**quantized_measures** (*Sequence**[**QuantizedMeasure**]*) --
list of quantized measures
Variables:
**quantized_measures** -- list of quantized measures
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "measure_l | Tuple of all measure lengths |
| engths" | |
+------------+--------------------------------------------------------------------------------------------+
| "time_sign | Tuple of the TimeSignature object for each measure |
| atures" | |
+------------+--------------------------------------------------------------------------------------------+
property measure_lengths: Sequence[float]
Tuple of all measure lengths
property time_signatures: Sequence[TimeSignature]
Tuple of the TimeSignature object for each measure
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.quantization.QuantizationScheme.txt
======================================================================
scamp.quantization.QuantizationScheme
*************************************
class scamp.quantization.QuantizationScheme(measure_schemes: Sequence[MeasureQuantizationScheme], loop: bool = False)
Bases: "object"
Scheme for quantizing a "PerformancePart" or "Performance"
Parameters:
* **measure_schemes** -- list of MeasureQuantizationSchemes to
use
* **loop** -- if True, loops through the list of
MeasureQuantizationSchemes; if False, keeps reusing the last
MeasureQuantizationScheme given after it reaches the end of
the list
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "beat_sche | Iterates through the beats of this QuantizationScheme, returning tuples of (beat_scheme, |
| me_iterato | start_beat) |
| r"() | |
+------------+--------------------------------------------------------------------------------------------+
| "from_attr | Constructs a QuantizationScheme from some key attributes. |
| ibutes"([t | |
| ime_signat | |
| ure, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "from_time | Constructs a QuantizationScheme using a single time signature for the whole piece. |
| _signature | |
| "(time_sig | |
| nature[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "from_time | Constructs a QuantizationScheme using a list of time signatures |
| _signature | |
| _list"(tim | |
| e_signatur | |
| es_list) | |
+------------+--------------------------------------------------------------------------------------------+
| "measure_s | Iterates through the measures of this QuantizationScheme, returning tuples of |
| cheme_iter | (measure_scheme, start_beat) |
| ator"() | |
+------------+--------------------------------------------------------------------------------------------+
classmethod from_attributes(time_signature: str | TimeSignature | Sequence = None, bar_line_locations: Sequence[float] = None, max_divisor: int = None, max_divisor_indigestibility: float = None, simplicity_preference: float = None) -> QuantizationScheme
Constructs a QuantizationScheme from some key attributes.
Parameters:
* **time_signature** -- either a time signature (represented
in string form or as a "TimeSignature" object), or a list
of time signatures. If a list, and the last element of that
list is the string "loop", then the list is repeatedly
looped through; if not, the last time signature specified
continues to be used.
* **bar_line_locations** -- a list of locations (in beats
since the start of the performance) at which to place bar
lines. Use either this parameter or the time_signature
parameter, but not both.
* **max_divisor** -- the max divisor for all beats in the is
measure (see "BeatQuantizationScheme")
* **max_divisor_indigestibility** -- the max indigestibility
for all beats in the is measure (see
"BeatQuantizationScheme")
* **simplicity_preference** -- the simplicity preference for
all beats in the is measure (see "BeatQuantizationScheme")
classmethod from_time_signature(time_signature: str | TimeSignature, max_divisor: int = 'default', max_divisor_indigestibility: float = 'default', simplicity_preference: float = 'default') -> QuantizationScheme
Constructs a QuantizationScheme using a single time signature
for the whole piece.
Parameters:
* **time_signature** -- the time signature to use
(represented in string form or as a "TimeSignature" object)
* **max_divisor** -- the max divisor for all beats in the is
measure (see "BeatQuantizationScheme")
* **max_divisor_indigestibility** -- the max indigestibility
for all beats in the is measure (see
"BeatQuantizationScheme")
* **simplicity_preference** -- the simplicity preference for
all beats in the is measure (see "BeatQuantizationScheme")
classmethod from_time_signature_list(time_signatures_list: Sequence, loop: bool = False, max_divisor: int = 'default', max_divisor_indigestibility: float = 'default', simplicity_preference: float = 'default') -> QuantizationScheme
Constructs a QuantizationScheme using a list of time signatures
Parameters:
* **time_signatures_list** -- list of time signatures to use
(represented in string form or as "TimeSignature" objects)
* **loop** -- if True, then the list of time signatures is
repeatedly looped through; if not, the last time signature
specified continues to be used.
* **max_divisor** -- the max divisor for all beats in the is
measure (see "BeatQuantizationScheme")
* **max_divisor_indigestibility** -- the max indigestibility
for all beats in the is measure (see
"BeatQuantizationScheme")
* **simplicity_preference** -- the simplicity preference for
all beats in the is measure (see "BeatQuantizationScheme")
measure_scheme_iterator() -> Iterator[tuple[MeasureQuantizationScheme, float]]
Iterates through the measures of this QuantizationScheme,
returning tuples of (measure_scheme, start_beat)
beat_scheme_iterator() -> Iterator[tuple[BeatQuantizationScheme, float]]
Iterates through the beats of this QuantizationScheme, returning
tuples of (beat_scheme, start_beat)
======================================================================
=== FILE: scamp/scamp.quantization.QuantizedBeat.txt
======================================================================
scamp.quantization.QuantizedBeat
********************************
class scamp.quantization.QuantizedBeat(start_beat, start_beat_in_measure, length, divisor)
Bases: "tuple"
Record of how a beat was quantized (named tuple)
Parameters:
* **start_beat** -- the start beat of the note relative to the
whole performance
* **start_beat_in_measure** -- the start beat of the note
relative to the start of the measure
* **length** -- the length of the beat in quarter notes
* **divisor** -- the divisor chosen for the beat
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "count"(va | Return number of occurrences of value. |
| lue, /) | |
+------------+--------------------------------------------------------------------------------------------+
| "index"(va | Return first index of value. |
| lue[, | |
| start, | |
| stop]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "divisor" | Alias for field number 3 |
+------------+--------------------------------------------------------------------------------------------+
| "length" | Alias for field number 2 |
+------------+--------------------------------------------------------------------------------------------+
| "start_bea | Alias for field number 0 |
| t" | |
+------------+--------------------------------------------------------------------------------------------+
| "start_bea | Alias for field number 1 |
| t_in_measu | |
| re" | |
+------------+--------------------------------------------------------------------------------------------+
count(value, /)
Return number of occurrences of value.
divisor
Alias for field number 3
index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
length
Alias for field number 2
start_beat
Alias for field number 0
start_beat_in_measure
Alias for field number 1
======================================================================
=== FILE: scamp/scamp.quantization.QuantizedMeasure.txt
======================================================================
scamp.quantization.QuantizedMeasure
***********************************
class scamp.quantization.QuantizedMeasure(start_beat, measure_length, beats, time_signature, beat_depths)
Bases: "tuple"
Record of how a measure was quantized (named tuple).
Parameters:
* **start_beat** -- the start beat of the measure relative to
the whole performance
* **measure_length** -- the start beat of the note relative to
the start of the measure
* **beats** -- a list of QuantizedBeat objects
* **time_signature** -- the "TimeSignature" used for this
measure
* **beat_depths** -- tuple of (length of minimum duple
subdivision, list of integers representing the nestedness of
each subdivision).
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "count"(va | Return number of occurrences of value. |
| lue, /) | |
+------------+--------------------------------------------------------------------------------------------+
| "index"(va | Return first index of value. |
| lue[, | |
| start, | |
| stop]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "beat_dept | Alias for field number 4 |
| hs" | |
+------------+--------------------------------------------------------------------------------------------+
| "beats" | Alias for field number 2 |
+------------+--------------------------------------------------------------------------------------------+
| "measure_l | Alias for field number 1 |
| ength" | |
+------------+--------------------------------------------------------------------------------------------+
| "start_bea | Alias for field number 0 |
| t" | |
+------------+--------------------------------------------------------------------------------------------+
| "time_sign | Alias for field number 3 |
| ature" | |
+------------+--------------------------------------------------------------------------------------------+
beat_depths
Alias for field number 4
beats
Alias for field number 2
count(value, /)
Return number of occurrences of value.
index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
measure_length
Alias for field number 1
start_beat
Alias for field number 0
time_signature
Alias for field number 3
======================================================================
=== FILE: scamp/scamp.quantization.TimeSignature.txt
======================================================================
scamp.quantization.TimeSignature
********************************
class scamp.quantization.TimeSignature(numerator: int | Sequence[int], denominator: int, beat_lengths: Sequence[float] = None)
Bases: "SavesToJSON"
Class representing the time signature of a measure
Parameters:
* **numerator** -- time signature numerator. Can be a list/tuple
of ints, in the case of an additive time signature
* **denominator** -- time signature denominator
* **beat_lengths** -- (optional) This is a hint as to how the
time signature is divided up into beats. By default, it is
None, meaning that a sensible default will be constructed.
Should add up to the length of the time signature.
Variables:
* **numerator** -- time signature numerator. Can be a list/tuple
of ints, in the case of an additive time signature
* **denominator** -- time signature denominator
* **beat_lengths** -- Representation of how the time signature
is divided up into beats. (Affects the quantization process.)
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "as_string | Returns a string representation of the time signature, e.g. "5/4" or "3+2+1/8". |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "as_tuple" | Returns a tuple representation of the time signature, e.g. (5, 4) or ((3, 2, 1), 8). |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "from_meas | Constructs a TimeSignature of the appropriate measure length. |
| ure_length | |
| "(measure_ | |
| length) | |
+------------+--------------------------------------------------------------------------------------------+
| "from_stri | Constructs a TimeSignature from its string representation |
| ng"(time_s | |
| ignature_s | |
| tring) | |
+------------+--------------------------------------------------------------------------------------------+
| "measure_l | Get the length of the measure in quarter notes |
| ength"() | |
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Returns the abjad version of this time signature |
| () | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
classmethod from_measure_length(measure_length: float) -> TimeSignature
Constructs a TimeSignature of the appropriate measure length.
(Defaults to the simple rather than compound)
Parameters:
**measure_length** -- length of the measure in quarter notes
Returns:
the TimeSignature so constructed
classmethod from_string(time_signature_string: str)
Constructs a TimeSignature from its string representation
Parameters:
**time_signature_string** -- e.g. "7/8", or "3+5+2/8" in the
case of a compound time signature
Returns:
the TimeSignature so constructed
as_string() -> str
Returns a string representation of the time signature, e.g.
"5/4" or "3+2+1/8"
as_tuple() -> tuple
Returns a tuple representation of the time signature, e.g. (5,
4) or ((3, 2, 1), 8)
measure_length() -> float
Get the length of the measure in quarter notes
to_abjad() -> abjad.TimeSignature
Returns the abjad version of this time signature
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.quantization.quantize_performance_part.txt
======================================================================
scamp.quantization.quantize_performance_part
********************************************
scamp.quantization.quantize_performance_part(part: PerformancePart, quantization_scheme: QuantizationScheme, onset_weighting: float = 'default', termination_weighting: float = 'default', inner_split_weighting: float = 'default')
Quantizes a performance part (in place) and sets its
voice_quantization_records
Parameters:
* **part** -- a PerformancePart
* **quantization_scheme** -- a QuantizationScheme
* **onset_weighting** -- How much do we care about accurate
onsets
* **termination_weighting** -- How much do we care about
accurate terminations
* **inner_split_weighting** -- How much do we care about inner
segmentation timing (e.g. tuple note lengths)
Returns:
a QuantizationRecord, detailing all of the time signatures, beat
divisions selected, etc.
======================================================================
=== FILE: scamp/scamp.quantization.txt
======================================================================
scamp.quantization
******************
Module containing classes and functions related to the quantization of
performances. (This includes the "TimeSignature" class, which also has
bearing on musical notation.)
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "BeatQuant | Scheme for making a decision about which divisor to use to quantize a beat |
| izationSch | |
| eme"(lengt | |
| h, | |
| divisors[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "MeasureQu | Scheme for quantizing a measure, including beat lengths and which beat divisors to allow. |
| antization | |
| Scheme"(be | |
| at_schemes | |
| , ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "Quantizat | Record of how a "PerformancePart" was quantized. |
| ionRecord" | |
| (quantized | |
| _measures) | |
+------------+--------------------------------------------------------------------------------------------+
| "Quantizat | Scheme for quantizing a "PerformancePart" or "Performance" |
| ionScheme" | |
| (measure_s | |
| chemes[, | |
| loop]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Quantized | Record of how a beat was quantized (named tuple) |
| Beat"(star | |
| t_beat, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "Quantized | Record of how a measure was quantized (named tuple). |
| Measure"(s | |
| tart_beat, | |
| measure_le | |
| ngth, ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "TimeSigna | Class representing the time signature of a measure |
| ture"(nume | |
| rator, den | |
| ominator[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.quantization.BeatQuantizationScheme
* "BeatQuantizationScheme"
* "BeatQuantizationScheme.from_max_divisor()"
* "BeatQuantizationScheme.from_max_divisor_indigestibility()"
* scamp.quantization.MeasureQuantizationScheme
* "MeasureQuantizationScheme"
* "MeasureQuantizationScheme.from_time_signature()"
* "MeasureQuantizationScheme.get_beat_hierarchies()"
* scamp.quantization.QuantizationRecord
* "QuantizationRecord"
* "QuantizationRecord.measure_lengths"
* "QuantizationRecord.time_signatures"
* "QuantizationRecord.duplicate()"
* "QuantizationRecord.json_dumps()"
* "QuantizationRecord.json_loads()"
* "QuantizationRecord.load_from_json()"
* "QuantizationRecord.save_to_json()"
* scamp.quantization.QuantizationScheme
* "QuantizationScheme"
* "QuantizationScheme.from_attributes()"
* "QuantizationScheme.from_time_signature()"
* "QuantizationScheme.from_time_signature_list()"
* "QuantizationScheme.measure_scheme_iterator()"
* "QuantizationScheme.beat_scheme_iterator()"
* scamp.quantization.QuantizedBeat
* "QuantizedBeat"
* "QuantizedBeat.count()"
* "QuantizedBeat.divisor"
* "QuantizedBeat.index()"
* "QuantizedBeat.length"
* "QuantizedBeat.start_beat"
* "QuantizedBeat.start_beat_in_measure"
* scamp.quantization.QuantizedMeasure
* "QuantizedMeasure"
* "QuantizedMeasure.beat_depths"
* "QuantizedMeasure.beats"
* "QuantizedMeasure.count()"
* "QuantizedMeasure.index()"
* "QuantizedMeasure.measure_length"
* "QuantizedMeasure.start_beat"
* "QuantizedMeasure.time_signature"
* scamp.quantization.TimeSignature
* "TimeSignature"
* "TimeSignature.from_measure_length()"
* "TimeSignature.from_string()"
* "TimeSignature.as_string()"
* "TimeSignature.as_tuple()"
* "TimeSignature.measure_length()"
* "TimeSignature.to_abjad()"
* "TimeSignature.duplicate()"
* "TimeSignature.json_dumps()"
* "TimeSignature.json_loads()"
* "TimeSignature.load_from_json()"
* "TimeSignature.save_to_json()"
-[ Functions ]-
+------------+--------------------------------------------------------------------------------------------+
| "quantize_ | Quantizes a performance part (in place) and sets its voice_quantization_records |
| performanc | |
| e_part"(pa | |
| rt, ...[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.quantization.quantize_performance_part
* "quantize_performance_part()"
======================================================================
=== FILE: scamp/scamp.score.Measure.txt
======================================================================
scamp.score.Measure
*******************
class scamp.score.Measure(voices: Sequence[Voice], time_signature: TimeSignature, show_time_signature: bool = True, clef: str | None = None)
Bases: "ScoreComponent", "ScoreContainer"
Representation of a single measure within in a Staff
Parameters:
* **voices** -- list of voices in this measure, in numbered
order
* **time_signature** -- the time signature for this measure
* **show_time_signature** -- whether or not to show the time
signature. By default, when scamp is turning a quantized
Performance into a Score, this will be set to true when the
time signature changes and False otherwise.
* **clef** -- Which clef to use for the measure. If none, clef
is left unspecified.
Variables:
* **time_signature** -- the time signature for this measure
* **show_time_signature** -- Whether or not to display the time
signature
* **clef** -- Which clef to use for the measure. If none, clef
is left unspecified.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "empty_mea | Constructs an empty measure (one voice with a bar rest) |
| sure"(time | |
| _signature | |
| [, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "from_list | Constructs a Measure for a specially formatted list of voices |
| _of_perfor | |
| mance_voic | |
| es"(voices | |
| _list, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_appro | Pick the best clef for this measure by comparing its average pitch against the given |
| priate_cle | choices. |
| f"(clef_ch | |
| oices) | |
+------------+--------------------------------------------------------------------------------------------+
| "non_empty | Length of the part of this measure that has something in it. |
| _length"() | |
+------------+--------------------------------------------------------------------------------------------+
| "to_music_ | Convert this score component to its corresponding pymusicxml component |
| xml"([sour | |
| ce_id_dict | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "append"(i | Add a child ScoreComponent of the appropriate type |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_li | Convert and wrap as a LilyPond (.ly) file, and save to the given path. |
| lypond"(fi | |
| le_path[, | |
| non_score_ | |
| blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_mu | Convert and wrap as a MusicXML score, and save to the given path. |
| sic_xml"(f | |
| ile_path[, | |
| pretty_pri | |
| nt]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_pd | Exports score as a PDF file and saves it to the given file_path |
| f"(file_pa | |
| th[, non_s | |
| core_block | |
| s]) | |
+------------+--------------------------------------------------------------------------------------------+
| "extend"(i | Add several child ScoreComponents of the appropriate type |
| tems) | |
+------------+--------------------------------------------------------------------------------------------+
| "index"(it | Get the index of the given child ScoreComponent |
| em) | |
+------------+--------------------------------------------------------------------------------------------+
| "insert"(i | Insert a child ScoreComponent at the given index. |
| ndex, | |
| item) | |
+------------+--------------------------------------------------------------------------------------------+
| "pop"([i]) | Pop and return the child ScoreComponent at the given index. |
+------------+--------------------------------------------------------------------------------------------+
| "print_lil | Convert and print LilyPond code, via the *abjad* library. |
| ypond"([wr | |
| ap_as_file | |
| , non_scor | |
| e_blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_mus | Convert and wrap as a MusicXML score, and print the resulting XML. |
| ic_xml"([p | |
| retty_prin | |
| t]) | |
+------------+--------------------------------------------------------------------------------------------+
| "remove"(i | Remove the given child ScoreComponent. |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "show"([no | Using the *abjad.show* command, generates and opens a PDF of the music represented by this |
| n_score_bl | component |
| ocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "show_xml" | Convert and wrap as a MusicXML score, and open it up in notation software. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Convert this score component to its corresponding abjad component |
| ([wrap_as_ | |
| file, non_ | |
| score_bloc | |
| ks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_lilypo | Convert to LilyPond code, via the *abjad* library. |
| nd"([wrap_ | |
| as_file, n | |
| on_score_b | |
| locks]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "length" | Length of this measure in quarter notes |
+------------+--------------------------------------------------------------------------------------------+
| "voices" | List of Voices within this measure, in numbered order |
+------------+--------------------------------------------------------------------------------------------+
property voices: Sequence[Voice]
List of Voices within this measure, in numbered order
property length: float
Length of this measure in quarter notes
non_empty_length() -> float
Length of the part of this measure that has something in it.
(i.e. the length not counting trailing rests that aren't part of
a tuplet)
classmethod empty_measure(time_signature: TimeSignature, show_time_signature: bool = True) -> Measure
Constructs an empty measure (one voice with a bar rest)
Parameters:
* **time_signature** -- the time signature for this measure
* **show_time_signature** -- Whether or not to display the
time signature
classmethod from_list_of_performance_voices(voices_list, time_signature: TimeSignature, show_time_signature: bool = True) -> Measure
Constructs a Measure for a specially formatted list of voices
Parameters:
* **voices_list** -- list consisting of elements each of
which is either: - a (list of PerformanceNotes, measure
quantization record) tuple for an active voice - None, for
an empty voice
* **time_signature** -- the time signature for this measure
* **show_time_signature** -- Whether or not to display the
time signature
get_appropriate_clef(clef_choices: Sequence[str | tuple[str, Real]])
Pick the best clef for this measure by comparing its average
pitch against the given choices.
to_music_xml(source_id_dict=None) -> Measure
Convert this score component to its corresponding pymusicxml
component
append(item: ScoreComponent) -> None
Add a child ScoreComponent of the appropriate type
export_lilypond(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and wrap as a LilyPond (.ly) file, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
export_music_xml(file_path: str, pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
export_pdf(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Exports score as a PDF file and saves it to the given file_path
Parameters:
* **file_path** -- where to save the PDF
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
extend(items) -> None
Add several child ScoreComponents of the appropriate type
index(item) -> int
Get the index of the given child ScoreComponent
insert(index, item) -> None
Insert a child ScoreComponent at the given index.
pop(i=-1) -> ScoreComponent
Pop and return the child ScoreComponent at the given index.
print_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and print LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
print_music_xml(pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and print the resulting
XML.
Parameters:
**pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
remove(item) -> None
Remove the given child ScoreComponent.
show(non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Using the *abjad.show* command, generates and opens a PDF of the
music represented by this component
Parameters:
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
show_xml() -> None
Convert and wrap as a MusicXML score, and open it up in notation
software. (The software to use is defined in
engraving_settings.music_xml_open_command.)
to_abjad(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> abjad.Component
Convert this score component to its corresponding abjad
component
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
to_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> str
Convert to LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
Returns:
a string containing the LilyPond code
======================================================================
=== FILE: scamp/scamp.score.NoteLike.txt
======================================================================
scamp.score.NoteLike
********************
class scamp.score.NoteLike(pitch: Envelope | float | tuple | None, volume: Envelope | float | None, written_length: float, properties: NoteProperties)
Bases: "ScoreComponent"
Represents a note, chord, or rest that can be notated without ties
Parameters:
* **pitch** -- float if single pitch, Envelope if a glissando,
tuple if a chord, None if a rest
* **volume** -- the volume of the note, sometimes an Envelope
* **written_length** -- the notated length of the note,
disregarding any tuplets it is part of
* **properties** -- a properties dictionary, same as found in a
PerformanceNote
Variables:
* **pitch** -- float if single pitch, Envelope if a glissando,
tuple if a chord, None if a rest
* **written_length** -- the notated length of the note,
disregarding any tuplets it is part of
* **properties** -- a properties dictionary, same as found in a
PerformanceNote
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "average_p | Averages the pitch of this note, accounting for if it's a glissando or a chord |
| itch"() | |
+------------+--------------------------------------------------------------------------------------------+
| "does_glis | Returns whether or not this does a glissando. |
| sando"() | |
+------------+--------------------------------------------------------------------------------------------+
| "is_chord" | Returns whether or not this is a chord. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "is_rest"( | Returns whether or not this is a rest. |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "merge_wit | Merges other into this note, adding its length and combining its articulations |
| h"(other) | |
+------------+--------------------------------------------------------------------------------------------+
| "source_id | ID representing the original PerformanceNote that this came from. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "to_music_ | Convert this score component to its corresponding pymusicxml component |
| xml"([sour | |
| ce_id_dict | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "export_li | Convert and wrap as a LilyPond (.ly) file, and save to the given path. |
| lypond"(fi | |
| le_path[, | |
| non_score_ | |
| blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_mu | Convert and wrap as a MusicXML score, and save to the given path. |
| sic_xml"(f | |
| ile_path[, | |
| pretty_pri | |
| nt]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_pd | Exports score as a PDF file and saves it to the given file_path |
| f"(file_pa | |
| th[, non_s | |
| core_block | |
| s]) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_lil | Convert and print LilyPond code, via the *abjad* library. |
| ypond"([wr | |
| ap_as_file | |
| , non_scor | |
| e_blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_mus | Convert and wrap as a MusicXML score, and print the resulting XML. |
| ic_xml"([p | |
| retty_prin | |
| t]) | |
+------------+--------------------------------------------------------------------------------------------+
| "show"([no | Using the *abjad.show* command, generates and opens a PDF of the music represented by this |
| n_score_bl | component |
| ocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "show_xml" | Convert and wrap as a MusicXML score, and open it up in notation software. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Convert this score component to its corresponding abjad component |
| ([wrap_as_ | |
| file, non_ | |
| score_bloc | |
| ks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_lilypo | Convert to LilyPond code, via the *abjad* library. |
| nd"([wrap_ | |
| as_file, n | |
| on_score_b | |
| locks]) | |
+------------+--------------------------------------------------------------------------------------------+
is_rest() -> bool
Returns whether or not this is a rest.
is_chord() -> bool
Returns whether or not this is a chord.
does_glissando()
Returns whether or not this does a glissando.
average_pitch() -> float
Averages the pitch of this note, accounting for if it's a
glissando or a chord
Returns:
the averaged pitch as a float
merge_with(other: NoteLike) -> NoteLike
Merges other into this note, adding its length and combining its
articulations
Parameters:
**other** -- another NoteLike
Returns:
self, having been merged with other
to_music_xml(source_id_dict=None) -> Sequence[_XMLNote]
Convert this score component to its corresponding pymusicxml
component
source_id() -> int | None
ID representing the original PerformanceNote that this came
from. Since PerformanceNotes are split up into tied segments, we
need to keep track of which ones belonged together so that we
can rejoin them with ties, glissandi, etc. (This is done via
_join_same_source_abjad_note_group or
_join_same_source_xml_note_group)
export_lilypond(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and wrap as a LilyPond (.ly) file, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
export_music_xml(file_path: str, pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
export_pdf(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Exports score as a PDF file and saves it to the given file_path
Parameters:
* **file_path** -- where to save the PDF
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
print_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and print LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
print_music_xml(pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and print the resulting
XML.
Parameters:
**pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
show(non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Using the *abjad.show* command, generates and opens a PDF of the
music represented by this component
Parameters:
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
show_xml() -> None
Convert and wrap as a MusicXML score, and open it up in notation
software. (The software to use is defined in
engraving_settings.music_xml_open_command.)
to_abjad(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> abjad.Component
Convert this score component to its corresponding abjad
component
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
to_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> str
Convert to LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
Returns:
a string containing the LilyPond code
======================================================================
=== FILE: scamp/scamp.score.Score.txt
======================================================================
scamp.score.Score
*****************
class scamp.score.Score(parts: Sequence[Staff | StaffGroup] = None, title: str = None, composer: str = None, tempo_envelope: TempoEnvelope = None)
Bases: "ScoreComponent", "ScoreContainer"
Representation of a score in traditional western notation.
Exportable as either LilyPond or MusicXML.
Parameters:
* **parts** -- A list of parts represented by either StaffGroup
or Staff objects
* **title** -- title to be used
* **composer** -- composer to be used
* **tempo_envelope** -- a TempoEnvelope function describing how
the tempo changes over time
Variables:
* **title** -- title to be used in the score
* **composer** -- composer to be written on the score
* **tempo_envelope** -- a TempoEnvelope function describing how
the tempo changes over time
* **final_barline** -- what barline to use at the end of the
score. Must be one of: "double", "end", "regular", "dotted",
"dashed", "heavy", "light-light" (same as "double"), "light-
heavy" (same as "end"), "heavy-light", "heavy-heavy", "tick",
"short", or "none".
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "from_perf | Builds a new Score from a Performance (list of note events in continuous time and pitch). |
| ormance"(p | |
| erformance | |
| [, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "from_quan | Constructs a new Score from an already quantized Performance. |
| tized_perf | |
| ormance"(p | |
| erformance | |
| [, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "length"() | Length of this score in beats. |
+------------+--------------------------------------------------------------------------------------------+
| "print_lil | Convert and print LilyPond code, via the *abjad* library. |
| ypond"([wr | |
| ap_as_file | |
| , non_scor | |
| e_blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Convert this score component to its corresponding abjad component |
| ([wrap_as_ | |
| file, non_ | |
| score_bloc | |
| ks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_lilypo | Convert to LilyPond code, via the *abjad* library. |
| nd"([wrap_ | |
| as_file, n | |
| on_score_b | |
| locks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_music_ | Convert this score component to its corresponding pymusicxml component |
| xml"() | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "append"(i | Add a child ScoreComponent of the appropriate type |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_li | Convert and wrap as a LilyPond (.ly) file, and save to the given path. |
| lypond"(fi | |
| le_path[, | |
| non_score_ | |
| blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_mu | Convert and wrap as a MusicXML score, and save to the given path. |
| sic_xml"(f | |
| ile_path[, | |
| pretty_pri | |
| nt]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_pd | Exports score as a PDF file and saves it to the given file_path |
| f"(file_pa | |
| th[, non_s | |
| core_block | |
| s]) | |
+------------+--------------------------------------------------------------------------------------------+
| "extend"(i | Add several child ScoreComponents of the appropriate type |
| tems) | |
+------------+--------------------------------------------------------------------------------------------+
| "index"(it | Get the index of the given child ScoreComponent |
| em) | |
+------------+--------------------------------------------------------------------------------------------+
| "insert"(i | Insert a child ScoreComponent at the given index. |
| ndex, | |
| item) | |
+------------+--------------------------------------------------------------------------------------------+
| "pop"([i]) | Pop and return the child ScoreComponent at the given index. |
+------------+--------------------------------------------------------------------------------------------+
| "print_mus | Convert and wrap as a MusicXML score, and print the resulting XML. |
| ic_xml"([p | |
| retty_prin | |
| t]) | |
+------------+--------------------------------------------------------------------------------------------+
| "remove"(i | Remove the given child ScoreComponent. |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "show"([no | Using the *abjad.show* command, generates and opens a PDF of the music represented by this |
| n_score_bl | component |
| ocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "show_xml" | Convert and wrap as a MusicXML score, and open it up in notation software. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "parts" | List of parts (StaffGroup or Staff objects). |
+------------+--------------------------------------------------------------------------------------------+
| "staves" | List of all staves in this score, expanding out those inside of StaffGroups. |
+------------+--------------------------------------------------------------------------------------------+
property parts: Sequence[Staff | StaffGroup]
List of parts (StaffGroup or Staff objects).
property staves: Sequence[Staff]
List of all staves in this score, expanding out those inside of
StaffGroups.
length() -> float
Length of this score in beats. (i.e. end beat of the last
measure in any of the parts)
classmethod from_performance(performance: Performance, quantization_scheme: QuantizationScheme = None, time_signature: str | Sequence = None, bar_line_locations: Sequence[float] = None, max_divisor: int = None, max_divisor_indigestibility: int = None, simplicity_preference: float = None, title: str = 'default', composer: str = 'default') -> Score
Builds a new Score from a Performance (list of note events in
continuous time and pitch). In the process, the music must be
quantized, for which two different options are available: one
can either pass a QuantizationScheme to the first argument,
which is very flexible but rather verbose to create, or one can
specify arguments such as time_signature and max_divisor
directly.
Parameters:
* **performance** -- The Performance object we are building
the score from.
* **quantization_scheme** -- The quantization scheme to be
used when converting this performance into a score. If this
is defined, none of the other quantization-related
arguments should be defined.
* **time_signature** -- the time signature to be used,
represented as a string, e.g. "3/4", or a tuple, e.g. (3,
2). Alternatively, a list of time signatures can be given.
If this list ends in "loop", then the pattern specified by
the list will be looped. For example, ["4/4", "2/4", "3/4",
"loop"] will cause the fourth measure to be in "4/4", the
fifth in "2/4", etc. If the list does not end in "loop",
all measures after the final time signature specified will
continue to be in that time signature.
* **bar_line_locations** -- As an alternative to defining the
time signatures, a list of numbers representing the bar
line locations can be given. For instance, [4.5, 6.5, 8,
11] would result in bars of time signatures 9/8, 2/4, 3/8,
and 3/4
* **max_divisor** -- The largest divisor that will be allowed
to divide the beat.
* **max_divisor_indigestibility** -- Indigestibility, devised
by composer Clarence Barlow, is a measure of the
"primeness" of a beat divisor, and therefore of its
complexity from the point of view of a performer. For
instance, it is easier to divide a beat in 8 than in 7,
even though 7 is a smaller number. See Clarence's paper
here: https://mat.ucsb.edu/Publications/Quantification_of_H
armony_and_Metre.pdf. By setting a max indigestibility, we
can allow larger divisions of the beat, but only so long as
they are easy ones. For instance, a max_divisor of 16 and a
max_divisor_indigestibility of 8 would allow the beat to be
divided in 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, and 16.
* **simplicity_preference** -- This defines the degree to
which the quantizer will favor simple divisors. The higher
the simplicity preference, the more precisely the notes
have to fit for you to get a divisor like 7. Simplicity
preference can range from 0 (in which case the divisor is
chosen simply based on the lowest error) to infinity, with
a typical value somewhere around 1.
* **title** -- Title of the piece to be printed on the score.
* **composer** -- Composer of the piece to be printed on the
score.
Returns:
the resulting Score object, which can then be rendered either
as XML or LilyPond
classmethod from_quantized_performance(performance: Performance, title: str = 'default', composer: str = 'default') -> Score
Constructs a new Score from an already quantized Performance.
Parameters:
* **performance** -- the quantized Performance to convert
into a new score
* **title** -- title to give the score
* **composer** -- composer to put on the score
to_music_xml() -> Score
Convert this score component to its corresponding pymusicxml
component
to_abjad(wrap_as_file: bool = True, non_score_blocks: Sequence = None, **lilypond_file_args) -> abjad.Component
Convert this score component to its corresponding abjad
component
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
to_lilypond(wrap_as_file: bool = True, non_score_blocks: Sequence = None, **lilypond_file_args) -> str
Convert to LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
Returns:
a string containing the LilyPond code
print_lilypond(wrap_as_file: bool = True, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and print LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
append(item: ScoreComponent) -> None
Add a child ScoreComponent of the appropriate type
export_lilypond(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and wrap as a LilyPond (.ly) file, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
export_music_xml(file_path: str, pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
export_pdf(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Exports score as a PDF file and saves it to the given file_path
Parameters:
* **file_path** -- where to save the PDF
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
extend(items) -> None
Add several child ScoreComponents of the appropriate type
index(item) -> int
Get the index of the given child ScoreComponent
insert(index, item) -> None
Insert a child ScoreComponent at the given index.
pop(i=-1) -> ScoreComponent
Pop and return the child ScoreComponent at the given index.
print_music_xml(pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and print the resulting
XML.
Parameters:
**pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
remove(item) -> None
Remove the given child ScoreComponent.
show(non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Using the *abjad.show* command, generates and opens a PDF of the
music represented by this component
Parameters:
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
show_xml() -> None
Convert and wrap as a MusicXML score, and open it up in notation
software. (The software to use is defined in
engraving_settings.music_xml_open_command.)
======================================================================
=== FILE: scamp/scamp.score.ScoreComponent.txt
======================================================================
scamp.score.ScoreComponent
**************************
class scamp.score.ScoreComponent
Bases: "ABC"
Abstract class from which all of the user-facing classes in this
module inherit. Provides a consistent interface for wrapping any
object up as a Score and converting to LilyPond and MusicXML
output.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "export_li | Convert and wrap as a LilyPond (.ly) file, and save to the given path. |
| lypond"(fi | |
| le_path[, | |
| non_score_ | |
| blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_mu | Convert and wrap as a MusicXML score, and save to the given path. |
| sic_xml"(f | |
| ile_path[, | |
| pretty_pri | |
| nt]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_pd | Exports score as a PDF file and saves it to the given file_path |
| f"(file_pa | |
| th[, non_s | |
| core_block | |
| s]) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_lil | Convert and print LilyPond code, via the *abjad* library. |
| ypond"([wr | |
| ap_as_file | |
| , non_scor | |
| e_blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_mus | Convert and wrap as a MusicXML score, and print the resulting XML. |
| ic_xml"([p | |
| retty_prin | |
| t]) | |
+------------+--------------------------------------------------------------------------------------------+
| "show"([no | Using the *abjad.show* command, generates and opens a PDF of the music represented by this |
| n_score_bl | component |
| ocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "show_xml" | Convert and wrap as a MusicXML score, and open it up in notation software. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Convert this score component to its corresponding abjad component |
| ([wrap_as_ | |
| file, non_ | |
| score_bloc | |
| ks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_lilypo | Convert to LilyPond code, via the *abjad* library. |
| nd"([wrap_ | |
| as_file, n | |
| on_score_b | |
| locks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_music_ | Convert this score component to its corresponding pymusicxml component |
| xml"() | |
+------------+--------------------------------------------------------------------------------------------+
abstractmethod to_music_xml() -> MusicXMLComponent
Convert this score component to its corresponding pymusicxml
component
export_music_xml(file_path: str, pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
print_music_xml(pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and print the resulting
XML.
Parameters:
**pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
show_xml() -> None
Convert and wrap as a MusicXML score, and open it up in notation
software. (The software to use is defined in
engraving_settings.music_xml_open_command.)
to_abjad(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> abjad.Component
Convert this score component to its corresponding abjad
component
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
export_lilypond(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and wrap as a LilyPond (.ly) file, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
export_pdf(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Exports score as a PDF file and saves it to the given file_path
Parameters:
* **file_path** -- where to save the PDF
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
to_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> str
Convert to LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
Returns:
a string containing the LilyPond code
print_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and print LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
show(non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Using the *abjad.show* command, generates and opens a PDF of the
music represented by this component
Parameters:
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
======================================================================
=== FILE: scamp/scamp.score.ScoreContainer.txt
======================================================================
scamp.score.ScoreContainer
**************************
class scamp.score.ScoreContainer(contents: Sequence[ScoreComponent], contents_argument_name: str, allowable_child_types: Type | tuple[Type, ...], extra_field_names=())
Bases: "ABC"
Abstract class representing a ScoreComponent that contains other
components. (e.g. A Measure contains Voices)
Parameters:
* **contents** -- the ScoreComponents contained within this
container
* **contents_argument_name** -- name of the property that
fetches the contents. E.g. a score should have "parts", and a
Staff should have "measures". The class should define that
property and point it to self._contents. This is basically
just used in __repr__ so that we don't have to implement it
separately for each subclass.
* **allowable_child_types** -- Type or list of types that should
be allowed as child components. For instance, a Score can have
Staff and StaffGroup children; a Measure can only have Voices.
* **extra_field_names** -- again this is basically just used in
__repr__ so that we don't have to implement it separately for
each subclass.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "append"(i | Add a child ScoreComponent of the appropriate type |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "extend"(i | Add several child ScoreComponents of the appropriate type |
| tems) | |
+------------+--------------------------------------------------------------------------------------------+
| "index"(it | Get the index of the given child ScoreComponent |
| em) | |
+------------+--------------------------------------------------------------------------------------------+
| "insert"(i | Insert a child ScoreComponent at the given index. |
| ndex, | |
| item) | |
+------------+--------------------------------------------------------------------------------------------+
| "pop"([i]) | Pop and return the child ScoreComponent at the given index. |
+------------+--------------------------------------------------------------------------------------------+
| "remove"(i | Remove the given child ScoreComponent. |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
append(item: ScoreComponent) -> None
Add a child ScoreComponent of the appropriate type
extend(items) -> None
Add several child ScoreComponents of the appropriate type
index(item) -> int
Get the index of the given child ScoreComponent
insert(index, item) -> None
Insert a child ScoreComponent at the given index.
pop(i=-1) -> ScoreComponent
Pop and return the child ScoreComponent at the given index.
remove(item) -> None
Remove the given child ScoreComponent.
======================================================================
=== FILE: scamp/scamp.score.Staff.txt
======================================================================
scamp.score.Staff
*****************
class scamp.score.Staff(measures: Sequence[Measure], name: str = None)
Bases: "ScoreComponent", "ScoreContainer"
Representation of a single staff of a western-notated score
Parameters:
* **measures** -- Chronological list of Measure objects
contained in this staff
* **name** -- Name of this staff in the score
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "length"() | Length of this Staff in beats. |
+------------+--------------------------------------------------------------------------------------------+
| "to_music_ | Convert this score component to its corresponding pymusicxml component |
| xml"() | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "append"(i | Add a child ScoreComponent of the appropriate type |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_li | Convert and wrap as a LilyPond (.ly) file, and save to the given path. |
| lypond"(fi | |
| le_path[, | |
| non_score_ | |
| blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_mu | Convert and wrap as a MusicXML score, and save to the given path. |
| sic_xml"(f | |
| ile_path[, | |
| pretty_pri | |
| nt]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_pd | Exports score as a PDF file and saves it to the given file_path |
| f"(file_pa | |
| th[, non_s | |
| core_block | |
| s]) | |
+------------+--------------------------------------------------------------------------------------------+
| "extend"(i | Add several child ScoreComponents of the appropriate type |
| tems) | |
+------------+--------------------------------------------------------------------------------------------+
| "index"(it | Get the index of the given child ScoreComponent |
| em) | |
+------------+--------------------------------------------------------------------------------------------+
| "insert"(i | Insert a child ScoreComponent at the given index. |
| ndex, | |
| item) | |
+------------+--------------------------------------------------------------------------------------------+
| "pop"([i]) | Pop and return the child ScoreComponent at the given index. |
+------------+--------------------------------------------------------------------------------------------+
| "print_lil | Convert and print LilyPond code, via the *abjad* library. |
| ypond"([wr | |
| ap_as_file | |
| , non_scor | |
| e_blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_mus | Convert and wrap as a MusicXML score, and print the resulting XML. |
| ic_xml"([p | |
| retty_prin | |
| t]) | |
+------------+--------------------------------------------------------------------------------------------+
| "remove"(i | Remove the given child ScoreComponent. |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "show"([no | Using the *abjad.show* command, generates and opens a PDF of the music represented by this |
| n_score_bl | component |
| ocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "show_xml" | Convert and wrap as a MusicXML score, and open it up in notation software. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Convert this score component to its corresponding abjad component |
| ([wrap_as_ | |
| file, non_ | |
| score_bloc | |
| ks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_lilypo | Convert to LilyPond code, via the *abjad* library. |
| nd"([wrap_ | |
| as_file, n | |
| on_score_b | |
| locks]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "measures" | Chronological list of Measure objects contained in this staff |
+------------+--------------------------------------------------------------------------------------------+
property measures: Sequence[Measure]
Chronological list of Measure objects contained in this staff
length() -> float
Length of this Staff in beats. (i.e. end beat of its last
measure)
to_music_xml() -> Part
Convert this score component to its corresponding pymusicxml
component
append(item: ScoreComponent) -> None
Add a child ScoreComponent of the appropriate type
export_lilypond(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and wrap as a LilyPond (.ly) file, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
export_music_xml(file_path: str, pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
export_pdf(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Exports score as a PDF file and saves it to the given file_path
Parameters:
* **file_path** -- where to save the PDF
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
extend(items) -> None
Add several child ScoreComponents of the appropriate type
index(item) -> int
Get the index of the given child ScoreComponent
insert(index, item) -> None
Insert a child ScoreComponent at the given index.
pop(i=-1) -> ScoreComponent
Pop and return the child ScoreComponent at the given index.
print_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and print LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
print_music_xml(pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and print the resulting
XML.
Parameters:
**pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
remove(item) -> None
Remove the given child ScoreComponent.
show(non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Using the *abjad.show* command, generates and opens a PDF of the
music represented by this component
Parameters:
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
show_xml() -> None
Convert and wrap as a MusicXML score, and open it up in notation
software. (The software to use is defined in
engraving_settings.music_xml_open_command.)
to_abjad(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> abjad.Component
Convert this score component to its corresponding abjad
component
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
to_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> str
Convert to LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
Returns:
a string containing the LilyPond code
======================================================================
=== FILE: scamp/scamp.score.StaffGroup.txt
======================================================================
scamp.score.StaffGroup
**********************
class scamp.score.StaffGroup(staves: Sequence[Staff], name: str = None, clef_choices: Sequence[str | tuple[str, Real]] = None)
Bases: "ScoreComponent", "ScoreContainer"
Representation of a StaffGroup (used for the multiple staves of a
single instrument)
Parameters:
* **staves** -- a list of Staff objects in this group
* **name** -- the name of the staff group on the score
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "from_quan | Constructs a new StaffGroup from an already quantized PerformancePart. |
| tized_perf | |
| ormance_pa | |
| rt"(...) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_music_ | Convert this score component to its corresponding pymusicxml component |
| xml"() | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "append"(i | Add a child ScoreComponent of the appropriate type |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_li | Convert and wrap as a LilyPond (.ly) file, and save to the given path. |
| lypond"(fi | |
| le_path[, | |
| non_score_ | |
| blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_mu | Convert and wrap as a MusicXML score, and save to the given path. |
| sic_xml"(f | |
| ile_path[, | |
| pretty_pri | |
| nt]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_pd | Exports score as a PDF file and saves it to the given file_path |
| f"(file_pa | |
| th[, non_s | |
| core_block | |
| s]) | |
+------------+--------------------------------------------------------------------------------------------+
| "extend"(i | Add several child ScoreComponents of the appropriate type |
| tems) | |
+------------+--------------------------------------------------------------------------------------------+
| "index"(it | Get the index of the given child ScoreComponent |
| em) | |
+------------+--------------------------------------------------------------------------------------------+
| "insert"(i | Insert a child ScoreComponent at the given index. |
| ndex, | |
| item) | |
+------------+--------------------------------------------------------------------------------------------+
| "pop"([i]) | Pop and return the child ScoreComponent at the given index. |
+------------+--------------------------------------------------------------------------------------------+
| "print_lil | Convert and print LilyPond code, via the *abjad* library. |
| ypond"([wr | |
| ap_as_file | |
| , non_scor | |
| e_blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_mus | Convert and wrap as a MusicXML score, and print the resulting XML. |
| ic_xml"([p | |
| retty_prin | |
| t]) | |
+------------+--------------------------------------------------------------------------------------------+
| "remove"(i | Remove the given child ScoreComponent. |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "show"([no | Using the *abjad.show* command, generates and opens a PDF of the music represented by this |
| n_score_bl | component |
| ocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "show_xml" | Convert and wrap as a MusicXML score, and open it up in notation software. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Convert this score component to its corresponding abjad component |
| ([wrap_as_ | |
| file, non_ | |
| score_bloc | |
| ks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_lilypo | Convert to LilyPond code, via the *abjad* library. |
| nd"([wrap_ | |
| as_file, n | |
| on_score_b | |
| locks]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "name" | Name of the staff group on the score. |
+------------+--------------------------------------------------------------------------------------------+
| "staves" | List of staves in this score. |
+------------+--------------------------------------------------------------------------------------------+
property name: str
Name of the staff group on the score.
property staves
List of staves in this score.
classmethod from_quantized_performance_part(quantized_performance_part: PerformancePart) -> StaffGroup
Constructs a new StaffGroup from an already quantized
PerformancePart.
Parameters:
**quantized_performance_part** -- an already quantized
PerformancePart
to_music_xml() -> PartGroup
Convert this score component to its corresponding pymusicxml
component
append(item: ScoreComponent) -> None
Add a child ScoreComponent of the appropriate type
export_lilypond(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and wrap as a LilyPond (.ly) file, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
export_music_xml(file_path: str, pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
export_pdf(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Exports score as a PDF file and saves it to the given file_path
Parameters:
* **file_path** -- where to save the PDF
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
extend(items) -> None
Add several child ScoreComponents of the appropriate type
index(item) -> int
Get the index of the given child ScoreComponent
insert(index, item) -> None
Insert a child ScoreComponent at the given index.
pop(i=-1) -> ScoreComponent
Pop and return the child ScoreComponent at the given index.
print_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and print LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
print_music_xml(pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and print the resulting
XML.
Parameters:
**pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
remove(item) -> None
Remove the given child ScoreComponent.
show(non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Using the *abjad.show* command, generates and opens a PDF of the
music represented by this component
Parameters:
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
show_xml() -> None
Convert and wrap as a MusicXML score, and open it up in notation
software. (The software to use is defined in
engraving_settings.music_xml_open_command.)
to_abjad(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> abjad.Component
Convert this score component to its corresponding abjad
component
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
to_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> str
Convert to LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
Returns:
a string containing the LilyPond code
======================================================================
=== FILE: scamp/scamp.score.Tuplet.txt
======================================================================
scamp.score.Tuplet
******************
class scamp.score.Tuplet(tuplet_divisions: int, normal_divisions: int, division_length: float, contents: Sequence[NoteLike] = None)
Bases: "ScoreComponent", "ScoreContainer"
Representation of a Tuplet object within a single voice of music.
Reads as: tuplet_divisions in the space of normal_divisions of
division_length e.g. 7, 4, and 0.25 would mean '7 in the space of 4
sixteenth notes'
Parameters:
* **tuplet_divisions** -- The new number that the tuplet is
divided into
* **normal_divisions** -- the normal number of divisions of
division_length that would fill the time
* **division_length** -- length in quarter notes of the tuplet
note type
* **contents** -- List of NoteLike objects (notes and rests)
contained in this tuplet
Variables:
* **tuplet_divisions** -- The new number that the tuplet is
divided into
* **normal_divisions** -- the normal number of divisions of
division_length that would fill the time
* **division_length** -- length in quarter notes of the tuplet
note type
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "dilation_ | Factor by which the amount of "room" in the tuplet is expanded. |
| factor"() | |
+------------+--------------------------------------------------------------------------------------------+
| "from_leng | Constructs and returns the appropriate tuplet from the length and the divisor. |
| th_and_div | |
| isor"(leng | |
| th, | |
| divisor) | |
+------------+--------------------------------------------------------------------------------------------+
| "length"() | The actual length, in quarter notes, of the tuplet from the outside. |
+------------+--------------------------------------------------------------------------------------------+
| "length_wi | The length, in quarter notes, of the tuplet from the inside. |
| thin_tuple | |
| t"() | |
+------------+--------------------------------------------------------------------------------------------+
| "to_music_ | Convert this score component to its corresponding pymusicxml component |
| xml"([sour | |
| ce_id_dict | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "append"(i | Add a child ScoreComponent of the appropriate type |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_li | Convert and wrap as a LilyPond (.ly) file, and save to the given path. |
| lypond"(fi | |
| le_path[, | |
| non_score_ | |
| blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_mu | Convert and wrap as a MusicXML score, and save to the given path. |
| sic_xml"(f | |
| ile_path[, | |
| pretty_pri | |
| nt]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_pd | Exports score as a PDF file and saves it to the given file_path |
| f"(file_pa | |
| th[, non_s | |
| core_block | |
| s]) | |
+------------+--------------------------------------------------------------------------------------------+
| "extend"(i | Add several child ScoreComponents of the appropriate type |
| tems) | |
+------------+--------------------------------------------------------------------------------------------+
| "index"(it | Get the index of the given child ScoreComponent |
| em) | |
+------------+--------------------------------------------------------------------------------------------+
| "insert"(i | Insert a child ScoreComponent at the given index. |
| ndex, | |
| item) | |
+------------+--------------------------------------------------------------------------------------------+
| "pop"([i]) | Pop and return the child ScoreComponent at the given index. |
+------------+--------------------------------------------------------------------------------------------+
| "print_lil | Convert and print LilyPond code, via the *abjad* library. |
| ypond"([wr | |
| ap_as_file | |
| , non_scor | |
| e_blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_mus | Convert and wrap as a MusicXML score, and print the resulting XML. |
| ic_xml"([p | |
| retty_prin | |
| t]) | |
+------------+--------------------------------------------------------------------------------------------+
| "remove"(i | Remove the given child ScoreComponent. |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "show"([no | Using the *abjad.show* command, generates and opens a PDF of the music represented by this |
| n_score_bl | component |
| ocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "show_xml" | Convert and wrap as a MusicXML score, and open it up in notation software. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Convert this score component to its corresponding abjad component |
| ([wrap_as_ | |
| file, non_ | |
| score_bloc | |
| ks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_lilypo | Convert to LilyPond code, via the *abjad* library. |
| nd"([wrap_ | |
| as_file, n | |
| on_score_b | |
| locks]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "contents" | List of NoteLike objects (notes and rests) contained in this tuplet |
+------------+--------------------------------------------------------------------------------------------+
classmethod from_length_and_divisor(length: float, divisor: int) -> Tuplet | None
Constructs and returns the appropriate tuplet from the length
and the divisor. Returns None if no tuplet needed.
Parameters:
* **length** -- length of the beat in quarters
* **divisor** -- divisor for the beat
Returns:
a Tuplet, or None
property contents: Sequence[NoteLike]
List of NoteLike objects (notes and rests) contained in this
tuplet
dilation_factor() -> float
Factor by which the amount of "room" in the tuplet is expanded.
E.g. in a tripet, this factor is 3/2, since you can fit 3/2 as
much stuff in there.
length() -> float
The actual length, in quarter notes, of the tuplet from the
outside.
length_within_tuplet() -> float
The length, in quarter notes, of the tuplet from the inside.
to_music_xml(source_id_dict=None) -> Tuplet
Convert this score component to its corresponding pymusicxml
component
append(item: ScoreComponent) -> None
Add a child ScoreComponent of the appropriate type
export_lilypond(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and wrap as a LilyPond (.ly) file, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
export_music_xml(file_path: str, pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
export_pdf(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Exports score as a PDF file and saves it to the given file_path
Parameters:
* **file_path** -- where to save the PDF
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
extend(items) -> None
Add several child ScoreComponents of the appropriate type
index(item) -> int
Get the index of the given child ScoreComponent
insert(index, item) -> None
Insert a child ScoreComponent at the given index.
pop(i=-1) -> ScoreComponent
Pop and return the child ScoreComponent at the given index.
print_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and print LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
print_music_xml(pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and print the resulting
XML.
Parameters:
**pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
remove(item) -> None
Remove the given child ScoreComponent.
show(non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Using the *abjad.show* command, generates and opens a PDF of the
music represented by this component
Parameters:
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
show_xml() -> None
Convert and wrap as a MusicXML score, and open it up in notation
software. (The software to use is defined in
engraving_settings.music_xml_open_command.)
to_abjad(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> abjad.Component
Convert this score component to its corresponding abjad
component
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
to_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> str
Convert to LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
Returns:
a string containing the LilyPond code
======================================================================
=== FILE: scamp/scamp.score.Voice.txt
======================================================================
scamp.score.Voice
*****************
class scamp.score.Voice(contents: Sequence[Tuplet | NoteLike], time_signature: TimeSignature)
Bases: "ScoreComponent", "ScoreContainer"
Representation of a single voice within a single measure of a
single staff of music.
Parameters:
* **contents** -- list of Tuplet or NoteLike objects in this
voice
* **time_signature** -- the time signature of the measure to
which this voice belongs
Variables:
**time_signature** -- the time signature of the measure to which
this voice belongs
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "empty_voi | Constructs an empty voice containing simply a bar rest. |
| ce"(time_s | |
| ignature) | |
+------------+--------------------------------------------------------------------------------------------+
| "from_perf | Constructs a Voice object from a list of PerformanceNotes |
| ormance_vo | |
| ice"(notes | |
| , ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "iterate_n | Iterate through the notes (and possibly rests) within this Voice |
| otes"([inc | |
| lude_rests | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
| "non_empty | Length of the part of this voice that has something in it. |
| _length"() | |
+------------+--------------------------------------------------------------------------------------------+
| "to_music_ | Convert this score component to its corresponding pymusicxml component |
| xml"([sour | |
| ce_id_dict | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "append"(i | Add a child ScoreComponent of the appropriate type |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_li | Convert and wrap as a LilyPond (.ly) file, and save to the given path. |
| lypond"(fi | |
| le_path[, | |
| non_score_ | |
| blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_mu | Convert and wrap as a MusicXML score, and save to the given path. |
| sic_xml"(f | |
| ile_path[, | |
| pretty_pri | |
| nt]) | |
+------------+--------------------------------------------------------------------------------------------+
| "export_pd | Exports score as a PDF file and saves it to the given file_path |
| f"(file_pa | |
| th[, non_s | |
| core_block | |
| s]) | |
+------------+--------------------------------------------------------------------------------------------+
| "extend"(i | Add several child ScoreComponents of the appropriate type |
| tems) | |
+------------+--------------------------------------------------------------------------------------------+
| "index"(it | Get the index of the given child ScoreComponent |
| em) | |
+------------+--------------------------------------------------------------------------------------------+
| "insert"(i | Insert a child ScoreComponent at the given index. |
| ndex, | |
| item) | |
+------------+--------------------------------------------------------------------------------------------+
| "pop"([i]) | Pop and return the child ScoreComponent at the given index. |
+------------+--------------------------------------------------------------------------------------------+
| "print_lil | Convert and print LilyPond code, via the *abjad* library. |
| ypond"([wr | |
| ap_as_file | |
| , non_scor | |
| e_blocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_mus | Convert and wrap as a MusicXML score, and print the resulting XML. |
| ic_xml"([p | |
| retty_prin | |
| t]) | |
+------------+--------------------------------------------------------------------------------------------+
| "remove"(i | Remove the given child ScoreComponent. |
| tem) | |
+------------+--------------------------------------------------------------------------------------------+
| "show"([no | Using the *abjad.show* command, generates and opens a PDF of the music represented by this |
| n_score_bl | component |
| ocks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "show_xml" | Convert and wrap as a MusicXML score, and open it up in notation software. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Convert this score component to its corresponding abjad component |
| ([wrap_as_ | |
| file, non_ | |
| score_bloc | |
| ks]) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_lilypo | Convert to LilyPond code, via the *abjad* library. |
| nd"([wrap_ | |
| as_file, n | |
| on_score_b | |
| locks]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "contents" | list of Tuplet or NoteLike objects in this voice |
+------------+--------------------------------------------------------------------------------------------+
property contents: Sequence[Tuplet | NoteLike]
list of Tuplet or NoteLike objects in this voice
iterate_notes(include_rests: bool = False) -> Iterator[NoteLike]
Iterate through the notes (and possibly rests) within this Voice
Parameters:
**include_rests** -- Whether or not to include rests
non_empty_length() -> float
Length of the part of this voice that has something in it. (i.e.
the length not counting trailing rests that aren't part of a
tuplet)
classmethod empty_voice(time_signature: TimeSignature) -> Voice
Constructs an empty voice containing simply a bar rest.
Parameters:
**time_signature** -- the time signature of the measure to
which this voice belongs
classmethod from_performance_voice(notes: Sequence[PerformanceNote], measure_quantization: QuantizedMeasure) -> Voice
Constructs a Voice object from a list of PerformanceNotes
(This is where a lot of the magic of converting performed notes
to written symbols occurs.)
Parameters:
* **notes** -- the list of PerformanceNotes played in this
measure
* **measure_quantization** -- the quantization used for this
measure for this voice
to_music_xml(source_id_dict=None) -> Sequence[BeamedGroup | _XMLNote]
Convert this score component to its corresponding pymusicxml
component
append(item: ScoreComponent) -> None
Add a child ScoreComponent of the appropriate type
export_lilypond(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and wrap as a LilyPond (.ly) file, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
export_music_xml(file_path: str, pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and save to the given
path.
Parameters:
* **file_path** -- file path to save to
* **pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
export_pdf(file_path: str, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Exports score as a PDF file and saves it to the given file_path
Parameters:
* **file_path** -- where to save the PDF
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
extend(items) -> None
Add several child ScoreComponents of the appropriate type
index(item) -> int
Get the index of the given child ScoreComponent
insert(index, item) -> None
Insert a child ScoreComponent at the given index.
pop(i=-1) -> ScoreComponent
Pop and return the child ScoreComponent at the given index.
print_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Convert and print LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
print_music_xml(pretty_print: bool = True) -> None
Convert and wrap as a MusicXML score, and print the resulting
XML.
Parameters:
**pretty_print** -- whether or not to take the extra space
and format the file with indentations, etc.
remove(item) -> None
Remove the given child ScoreComponent.
show(non_score_blocks: Sequence = None, **lilypond_file_args) -> None
Using the *abjad.show* command, generates and opens a PDF of the
music represented by this component
Parameters:
* **non_score_blocks** -- a list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad); typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
show_xml() -> None
Convert and wrap as a MusicXML score, and open it up in notation
software. (The software to use is defined in
engraving_settings.music_xml_open_command.)
to_abjad(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> abjad.Component
Convert this score component to its corresponding abjad
component
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
to_lilypond(wrap_as_file: bool = False, non_score_blocks: Sequence = None, **lilypond_file_args) -> str
Convert to LilyPond code, via the *abjad* library.
Parameters:
* **wrap_as_file** -- if True, wraps this as an
"abjad.LilypondFile"
* **non_score_blocks** -- (Only applicable if *wrap_as_file*
is set to True). A list of "abjad.Block" objects (or
strings containing the LilyPond code for such a block,
which are then parsed by abjad). Typical blocks might be a
header block, a layout block, or a paper block. If no
header block is specified, one will be created with the
score's title and composer. If a header is specified, title
and composer will be added if not present.
* **lilypond_file_args** -- any additional keyword arguments
will be passed along to the constructor of
"abjad.LilyPondFile" (assuming wrap_as_file is True). This
allows for setting staff size and various other
customizations.
Returns:
a string containing the LilyPond code
======================================================================
=== FILE: scamp/scamp.score.txt
======================================================================
scamp.score
***********
Module containing classes that deal with music notation. These classes
represent the music hierarchically; in order from largest to smallest:
"Score", "StaffGroup", "Staff", "Voice", "Measure", "Voice", "Tuplet",
and "NoteLike". One important role of the classes in this module is to
provide export functionality to both MusicXML and LilyPond.
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "Measure"( | Representation of a single measure within in a Staff |
| voices, ti | |
| me_signatu | |
| re[, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "NoteLike" | Represents a note, chord, or rest that can be notated without ties |
| (pitch, | |
| volume, wr | |
| itten_leng | |
| th, ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "Score"([p | Representation of a score in traditional western notation. |
| arts, | |
| title, | |
| composer, | |
| tempo_enve | |
| lope]) | |
+------------+--------------------------------------------------------------------------------------------+
| "ScoreComp | Abstract class from which all of the user-facing classes in this module inherit. |
| onent"() | |
+------------+--------------------------------------------------------------------------------------------+
| "ScoreCont | Abstract class representing a ScoreComponent that contains other components. |
| ainer"(con | |
| tents, | |
| ...[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Staff"(me | Representation of a single staff of a western-notated score |
| asures[, | |
| name]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StaffGrou | Representation of a StaffGroup (used for the multiple staves of a single instrument) |
| p"(staves[ | |
| , name, cl | |
| ef_choices | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Tuplet"(t | Representation of a Tuplet object within a single voice of music. |
| uplet_divi | |
| sions, nor | |
| mal_divisi | |
| ons, ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "Voice"(co | Representation of a single voice within a single measure of a single staff of music. |
| ntents, ti | |
| me_signatu | |
| re) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.score.Measure
* "Measure"
* "Measure.voices"
* "Measure.length"
* "Measure.non_empty_length()"
* "Measure.empty_measure()"
* "Measure.from_list_of_performance_voices()"
* "Measure.get_appropriate_clef()"
* "Measure.to_music_xml()"
* "Measure.append()"
* "Measure.export_lilypond()"
* "Measure.export_music_xml()"
* "Measure.export_pdf()"
* "Measure.extend()"
* "Measure.index()"
* "Measure.insert()"
* "Measure.pop()"
* "Measure.print_lilypond()"
* "Measure.print_music_xml()"
* "Measure.remove()"
* "Measure.show()"
* "Measure.show_xml()"
* "Measure.to_abjad()"
* "Measure.to_lilypond()"
* scamp.score.NoteLike
* "NoteLike"
* "NoteLike.is_rest()"
* "NoteLike.is_chord()"
* "NoteLike.does_glissando()"
* "NoteLike.average_pitch()"
* "NoteLike.merge_with()"
* "NoteLike.to_music_xml()"
* "NoteLike.source_id()"
* "NoteLike.export_lilypond()"
* "NoteLike.export_music_xml()"
* "NoteLike.export_pdf()"
* "NoteLike.print_lilypond()"
* "NoteLike.print_music_xml()"
* "NoteLike.show()"
* "NoteLike.show_xml()"
* "NoteLike.to_abjad()"
* "NoteLike.to_lilypond()"
* scamp.score.Score
* "Score"
* "Score.parts"
* "Score.staves"
* "Score.length()"
* "Score.from_performance()"
* "Score.from_quantized_performance()"
* "Score.to_music_xml()"
* "Score.to_abjad()"
* "Score.to_lilypond()"
* "Score.print_lilypond()"
* "Score.append()"
* "Score.export_lilypond()"
* "Score.export_music_xml()"
* "Score.export_pdf()"
* "Score.extend()"
* "Score.index()"
* "Score.insert()"
* "Score.pop()"
* "Score.print_music_xml()"
* "Score.remove()"
* "Score.show()"
* "Score.show_xml()"
* scamp.score.ScoreComponent
* "ScoreComponent"
* "ScoreComponent.to_music_xml()"
* "ScoreComponent.export_music_xml()"
* "ScoreComponent.print_music_xml()"
* "ScoreComponent.show_xml()"
* "ScoreComponent.to_abjad()"
* "ScoreComponent.export_lilypond()"
* "ScoreComponent.export_pdf()"
* "ScoreComponent.to_lilypond()"
* "ScoreComponent.print_lilypond()"
* "ScoreComponent.show()"
* scamp.score.ScoreContainer
* "ScoreContainer"
* "ScoreContainer.append()"
* "ScoreContainer.extend()"
* "ScoreContainer.index()"
* "ScoreContainer.insert()"
* "ScoreContainer.pop()"
* "ScoreContainer.remove()"
* scamp.score.Staff
* "Staff"
* "Staff.measures"
* "Staff.length()"
* "Staff.to_music_xml()"
* "Staff.append()"
* "Staff.export_lilypond()"
* "Staff.export_music_xml()"
* "Staff.export_pdf()"
* "Staff.extend()"
* "Staff.index()"
* "Staff.insert()"
* "Staff.pop()"
* "Staff.print_lilypond()"
* "Staff.print_music_xml()"
* "Staff.remove()"
* "Staff.show()"
* "Staff.show_xml()"
* "Staff.to_abjad()"
* "Staff.to_lilypond()"
* scamp.score.StaffGroup
* "StaffGroup"
* "StaffGroup.name"
* "StaffGroup.staves"
* "StaffGroup.from_quantized_performance_part()"
* "StaffGroup.to_music_xml()"
* "StaffGroup.append()"
* "StaffGroup.export_lilypond()"
* "StaffGroup.export_music_xml()"
* "StaffGroup.export_pdf()"
* "StaffGroup.extend()"
* "StaffGroup.index()"
* "StaffGroup.insert()"
* "StaffGroup.pop()"
* "StaffGroup.print_lilypond()"
* "StaffGroup.print_music_xml()"
* "StaffGroup.remove()"
* "StaffGroup.show()"
* "StaffGroup.show_xml()"
* "StaffGroup.to_abjad()"
* "StaffGroup.to_lilypond()"
* scamp.score.Tuplet
* "Tuplet"
* "Tuplet.from_length_and_divisor()"
* "Tuplet.contents"
* "Tuplet.dilation_factor()"
* "Tuplet.length()"
* "Tuplet.length_within_tuplet()"
* "Tuplet.to_music_xml()"
* "Tuplet.append()"
* "Tuplet.export_lilypond()"
* "Tuplet.export_music_xml()"
* "Tuplet.export_pdf()"
* "Tuplet.extend()"
* "Tuplet.index()"
* "Tuplet.insert()"
* "Tuplet.pop()"
* "Tuplet.print_lilypond()"
* "Tuplet.print_music_xml()"
* "Tuplet.remove()"
* "Tuplet.show()"
* "Tuplet.show_xml()"
* "Tuplet.to_abjad()"
* "Tuplet.to_lilypond()"
* scamp.score.Voice
* "Voice"
* "Voice.contents"
* "Voice.iterate_notes()"
* "Voice.non_empty_length()"
* "Voice.empty_voice()"
* "Voice.from_performance_voice()"
* "Voice.to_music_xml()"
* "Voice.append()"
* "Voice.export_lilypond()"
* "Voice.export_music_xml()"
* "Voice.export_pdf()"
* "Voice.extend()"
* "Voice.index()"
* "Voice.insert()"
* "Voice.pop()"
* "Voice.print_lilypond()"
* "Voice.print_music_xml()"
* "Voice.remove()"
* "Voice.show()"
* "Voice.show_xml()"
* "Voice.to_abjad()"
* "Voice.to_lilypond()"
======================================================================
=== FILE: scamp/scamp.session.Session.txt
======================================================================
scamp.session.Session
*********************
class scamp.session.Session(tempo: float = 60, default_soundfont: str = 'default', default_audio_driver: str = 'default', default_spelling_policy: SpellingPolicy | str | tuple = None, instruments: Sequence[ScampInstrument] = None, max_threads=200)
Bases: "Clock", "Ensemble", "Transcriber", "SavesToJSON"
A Session combines the functionality of a master Clock, an
Ensemble, and a Transcriber. Since it's a master Clock, it manages
global tempo; since it's an Ensemble, you use it to create and keep
track of instruments, and since it's a Transcriber, it allows you
to transcribe and generate notation from what the instruments are
playing. You can also use a Session to set up interactive callbacks
for MIDI, OSC, mouse events, and keyboard events.
Parameters:
* **tempo** -- the initial tempo of the master clock
* **default_soundfont** -- the default soundfont used by
instruments in this session. (Can be overridden at instrument
creation.)
* **default_audio_driver** -- the default driver used by
(soundfont) instruments to output audio. (Can be overridden at
instrument creation.)
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "get_avail | Returns a list of available ports and devices for midi input. |
| able_midi_ | |
| input_devi | |
| ces"() | |
+------------+--------------------------------------------------------------------------------------------+
| "print_ava | Prints a list of available ports and devices for midi input. |
| ilable_mid | |
| i_input_de | |
| vices"() | |
+------------+--------------------------------------------------------------------------------------------+
| "print_ava | Prints a list of available ports and devices for midi output. |
| ilable_mid | |
| i_output_d | |
| evices"() | |
+------------+--------------------------------------------------------------------------------------------+
| "register_ | Register a callback_function to respond to incoming keyboard events |
| keyboard_l | |
| istener"([ | |
| on_press, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "register_ | Register a callback_function to respond to incoming midi events from |
| midi_liste | port_number_or_device_name |
| ner"(...) | |
+------------+--------------------------------------------------------------------------------------------+
| "register_ | Register a callback_function to respond to incoming mouse events |
| mouse_list | |
| ener"([on_ | |
| move, | |
| on_press, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "register_ | Register a callback function for OSC messages on a given address/port with given pattern |
| osc_listen | |
| er"(port, | |
| ...[, ip_a | |
| ddress]) | |
+------------+--------------------------------------------------------------------------------------------+
| "remove_ke | Remove a previously added keyboard listener. |
| yboard_lis | |
| tener"() | |
+------------+--------------------------------------------------------------------------------------------+
| "remove_mi | Removes the midi listener with the given port_number_or_device_name |
| di_listene | |
| r"(port_nu | |
| mber_or_de | |
| vice_name) | |
+------------+--------------------------------------------------------------------------------------------+
| "remove_mo | Remove a previously added mouse listener |
| use_listen | |
| er"() | |
+------------+--------------------------------------------------------------------------------------------+
| "remove_os | Remove OSC listener on the given port and IP address |
| c_listener | |
| "(port[, i | |
| p_address] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "run_as_se | Hands this session off to a background thread that waits forever, so the calling thread |
| rver"() | stays free. |
+------------+--------------------------------------------------------------------------------------------+
| "start_tra | Starts transcribing everything played in this Session's (or by the given instruments) to a |
| nscribing" | Performance. |
| ([...]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "add_instr | Adds an instance of "ScampInstrument" to this Ensemble. |
| ument"(ins | |
| trument) | |
+------------+--------------------------------------------------------------------------------------------+
| "apply_bea | Drive this clock's beat_length from a function. |
| t_length_f | |
| unction"(f | |
| unction[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "apply_rat | Drive this clock's rate from a function. |
| e_function | |
| "(function | |
| [, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "apply_tem | Append the given "TempoEnvelope" onto this clock's internal tempo envelope, starting from |
| po_envelop | the current beat. |
| e"(envelop | |
| e[, | |
| truncate, | |
| loop]) | |
+------------+--------------------------------------------------------------------------------------------+
| "apply_tem | Drive this clock's tempo (BPM) from a function. |
| po_functio | |
| n"(functio | |
| n[, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "bring_up_ | Advance this clock's tempo_history to match where it currently is in scheduler time. |
| to_date"() | |
+------------+--------------------------------------------------------------------------------------------+
| "children" | Get all direct child clocks forked by this clock. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "clock_to_ | Gets the time in the scheduler for a given beat or time in this clock, working recursively |
| scheduler_ | up the chain of clocks. |
| time"(beat | |
| _or_time[, | |
| units]) | |
+------------+--------------------------------------------------------------------------------------------+
| "descendan | Get all children, grandchildren, etc. |
| ts"() | |
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "extract_a | Extract this clock's absolute tempo curve — its tempo as observed in master (scheduler) |
| bsolute_te | time, with parent rate-changes folded in. |
| mpo_envelo | |
| pe"([...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "fast_forw | Turn indefinite fast-forwarding on or off. |
| ard"([on_o | |
| r_off]) | |
+------------+--------------------------------------------------------------------------------------------+
| "fast_forw | Fast-forward, skipping ahead instantaneously by *b* beats. |
| ard_in_bea | |
| ts"(b) | |
+------------+--------------------------------------------------------------------------------------------+
| "fast_forw | Fast-forward, skipping ahead instantaneously by *t* seconds. |
| ard_in_tim | |
| e"(t) | |
+------------+--------------------------------------------------------------------------------------------+
| "fast_forw | Fast-forward, skipping instantaneously up to beat *b* on this clock. |
| ard_to_bea | |
| t"(b) | |
+------------+--------------------------------------------------------------------------------------------+
| "fast_forw | Fast-forward, skipping instantaneously up to time *t* (in seconds) on this clock, then |
| ard_to_tim | resume real-time playback. |
| e"(t) | |
+------------+--------------------------------------------------------------------------------------------+
| "fork"(for | Spawns a child clock running *forked_function* as a coordinated parallel timeline. |
| ked_functi | |
| on[, args, | |
| kwargs, | |
| name, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_avail | Returns an enumeration of available ports and devices for midi output. |
| able_midi_ | |
| output_dev | |
| ices"() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_instr | Returns the instrument of the given name. |
| ument_by_n | |
| ame"(name[ | |
| , which]) | |
+------------+--------------------------------------------------------------------------------------------+
| "hold_sche | Context manager that: 1) ensures that the scheduler is not executing scheduled actions — |
| duler"() | waiting if one is in flight, then preventing others from starting; 2) rouses the scheduler |
| | and updates its committed time to the current projected time. |
+------------+--------------------------------------------------------------------------------------------+
| "inheritan | Get all parent, grandparent, etc. |
| ce"([inclu | |
| de_self]) | |
+------------+--------------------------------------------------------------------------------------------+
| "is_fast_f | Whether the clock is currently fast-forwarding. |
| orwarding" | |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "is_master | Check if this is the master clock |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "is_transc | Checks if any transcriptions are in progress. |
| ribing"() | |
+------------+--------------------------------------------------------------------------------------------+
| "iterate_a | Iterate through all related clocks to this clock. |
| ll_relativ | |
| es"([inclu | |
| de_self]) | |
+------------+--------------------------------------------------------------------------------------------+
| "iterate_d | Iterate through all children, grandchildren, etc. |
| escendants | |
| "([include | |
| _self]) | |
+------------+--------------------------------------------------------------------------------------------+
| "iterate_i | Iterate through parent, grandparent, etc. |
| nheritance | |
| "([include | |
| _self]) | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "kill"() | End this clock (and the corresponding forked function if not master) and cascade to all |
| | descendant clocks. |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "new_midi_ | Creates and returns a new ScampInstrument for this Ensemble that uses a |
| part"([nam | MIDIStreamPlaybackImplementation. |
| e, midi_ou | |
| tput_devic | |
| e, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "new_osc_p | Creates and returns a new ScampInstrument for this Ensemble that uses a |
| art"([name | OSCPlaybackImplementation. |
| , port, ip | |
| _address, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "new_part" | Creates and returns a new ScampInstrument for this Ensemble that uses a |
| ([name, | SoundfontPlaybackImplementation. |
| preset, | |
| soundfont, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "new_silen | Creates and returns a new ScampInstrument for this Ensemble with no |
| t_part"([n | PlaybackImplementations. |
| ame, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "pop_instr | Pops the instrument at the given index, severing its ties to the ensemble. |
| ument"(ind | |
| ex) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_def | Prints a list of presets available with the default soundfont. |
| ault_sound | |
| font_prese | |
| ts"() | |
+------------+--------------------------------------------------------------------------------------------+
| "print_fam | Print a hierarchical representation of this clock's family tree. |
| ily_tree"( | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_sta | Print this clock's "status()" snapshot. |
| tus"([verb | |
| ose]) | |
+------------+--------------------------------------------------------------------------------------------+
| "projected | A wall-clock-interpolated estimate of "beat". |
| _beat"() | |
+------------+--------------------------------------------------------------------------------------------+
| "projected | A wall-clock-interpolated estimate of "time", advancing smoothly between events rather |
| _time"() | than holding still between them. |
+------------+--------------------------------------------------------------------------------------------+
| "register_ | Called when an instrument wants to register that it finished a note, records note in all |
| note"(inst | transcriptions |
| rument, | |
| note_info) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
| "schedule_ | The lightweight alternative to fork() for immediately returning functions. |
| action"(ac | |
| tion, | |
| when[, | |
| args, | |
| kwargs]) | |
+------------+--------------------------------------------------------------------------------------------+
| "scheduler | Gets beats or time in this clock for a given time in the scheduler. |
| _to_clock_ | |
| time"(sche | |
| duler_time | |
| [, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_beat_ | Smoothly change this clock's beat length (seconds per beat) to "beat_length_target", |
| length_tar | arriving at the moment given by "when". |
| get"(beat_ | |
| length_tar | |
| get, when) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_beat_ | Smoothly change this clock's beat length (seconds per beat) through a series of targets, |
| length_tar | building a multi-segment tempo curve in one call — the multi-segment form of |
| gets"(beat | "set_beat_length_target()". |
| _length_ta | |
| rgets, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_rate_ | Smoothly change this clock's rate (beats per second) to "rate_target", arriving at "when". |
| target"(ra | |
| te_target, | |
| when[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_rate_ | Smoothly change this clock's rate (beats per second; the reciprocal of beat length, so a |
| targets"(r | higher rate is a faster tempo) through a series of targets — the multi-segment form of |
| ate_target | "set_rate_target()". |
| s, whens[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_tempo | Smoothly change this clock's tempo to "tempo_target", arriving at "when". |
| _target"(t | |
| empo_targe | |
| t, when[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_tempo | Smoothly change this clock's tempo (beats per minute) through a series of targets — the |
| _targets"( | multi-segment form of "set_tempo_target()", and usually the most natural of the three |
| tempo_targ | equivalent plural setters. |
| ets, | |
| whens[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "status"([ | A snapshot of this clock's name and position, alongside the scheduler's elapsed wall time |
| verbose]) | and how far behind schedule it is currently running. |
+------------+--------------------------------------------------------------------------------------------+
| "stop_temp | Stop following any function or looping envelope previously applied to this clock's tempo. |
| o_loop_or_ | |
| function"( | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "stop_tran | Stops transcribing a Performance and returns it. |
| scribing"( | |
| [which_per | |
| formance, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "terminate | Kill this clock's children and their descendants in turn, returning once they have |
| _forked_ch | finished unwinding. |
| ildren"() | |
+------------+--------------------------------------------------------------------------------------------+
| "use_absol | Shorthand for "timing_policy = 0.0" (always catch up to absolute schedule). |
| ute_timing | |
| _policy"() | |
+------------+--------------------------------------------------------------------------------------------+
| "use_mixed | Shorthand for "timing_policy = absolute_relative_mix" (a blend between 0=absolute and |
| _timing_po | 1=relative). |
| licy"(abso | |
| lute_relat | |
| ive_mix) | |
+------------+--------------------------------------------------------------------------------------------+
| "use_relat | Shorthand for "timing_policy = 1.0" (always wait the full requested delay). |
| ive_timing | |
| _policy"() | |
+------------+--------------------------------------------------------------------------------------------+
| "wait"(dur | Block this clock for *duration* beats (or seconds, if units="time") from now, yielding to |
| ation[, | the scheduler. |
| units]) | |
+------------+--------------------------------------------------------------------------------------------+
| "wait_for_ | Block this clock's own thread until all of its child clocks have finished, yielding to the |
| children_t | scheduler so they can run, then return as soon as the last child ends. |
| o_finish"( | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "wait_for_ | Block this clock's own thread until *clock* has finished, yielding to the scheduler so it |
| clock_to_f | (and everything else) keeps running. |
| inish"(clo | |
| ck) | |
+------------+--------------------------------------------------------------------------------------------+
| "wait_fore | Block this clock's own thread indefinitely, yielding to the scheduler so child clocks keep |
| ver"() | running. |
+------------+--------------------------------------------------------------------------------------------+
| "wait_unti | Block this clock until the beat (or time, if units="time") indicated by *when* — a |
| l"(when[, | convenience for absolute targets given as a bare number (equivalent to |
| units]) | wait(Moment.at_beat(when)), or Moment.at_time for units="time"). |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "absolute_ | Beat length in true seconds, with all parent rates folded in. |
| beat_lengt | |
| h" | |
+------------+--------------------------------------------------------------------------------------------+
| "absolute_ | Rate of this clock in beats / (true) second, with all parent rates folded in. |
| rate" | |
+------------+--------------------------------------------------------------------------------------------+
| "absolute_ | Tempo (BPM) in true minutes, with all parent rates folded in. |
| tempo" | |
+------------+--------------------------------------------------------------------------------------------+
| "alive" | True if this clock is currently running (PENDING and DEAD both return False). |
+------------+--------------------------------------------------------------------------------------------+
| "beat" | How many beats have passed since this clock was created. |
+------------+--------------------------------------------------------------------------------------------+
| "beat_leng | The length of a beat in this clock in seconds. |
| th" | |
+------------+--------------------------------------------------------------------------------------------+
| "default_s | Default spelling policy used for transcriptions made with this Ensemble. |
| pelling_po | |
| licy" | |
+------------+--------------------------------------------------------------------------------------------+
| "instrumen | Returns a tuple of the instruments currently in this Ensemble. |
| ts" | |
+------------+--------------------------------------------------------------------------------------------+
| "master" | The master clock under which this clock operates (possibly itself) |
+------------+--------------------------------------------------------------------------------------------+
| "precise_t | Whether to use a busy wait in the final moments leading up to a scheduled event. |
| iming" | |
+------------+--------------------------------------------------------------------------------------------+
| "rate" | The rate of this clock in beats / second. |
+------------+--------------------------------------------------------------------------------------------+
| "spin_guar | Width (seconds) of the busy-wait guard band used when "precise_timing" is on. |
| d_duration | |
| " | |
+------------+--------------------------------------------------------------------------------------------+
| "tempo" | The rate of this clock in beats / minute Note that beat_length, tempo and rate are |
| | interconnected properties, and that by setting one of them the other two are automatically |
| | set in response according to the relationship: beat_length = 1/rate = 60/tempo. |
+------------+--------------------------------------------------------------------------------------------+
| "time" | How much time has passed since this clock was created. |
+------------+--------------------------------------------------------------------------------------------+
| "timing_po | How the family trades off relative vs. absolute timing, as a float from 0 to 1. |
| licy" | |
+------------+--------------------------------------------------------------------------------------------+
| "transcrip | Tuple of all current transcriptions. |
| tions_in_p | |
| rogress" | |
+------------+--------------------------------------------------------------------------------------------+
run_as_server() -> Session
Hands this session off to a background thread that waits
forever, so the calling thread stays free. This is the approach
to take when driving scamp from an interactive terminal (REPL)
session, where you want the prompt to stay responsive: simply
type "s = Session().run_as_server()".
Note the tradeoff: once handed off, the calling thread no longer
owns the session's clock (its "current_clock()" becomes "None"),
so subsequent work must be scheduled on the returned object
explicitly — e.g. "s.fork(...)" — rather than through the
context-inferring module-level helpers "fork()" and "wait()". In
a normal top-to-bottom script you don't need this at all: the
thread that creates the "Session" owns its clock, so just use
"wait"/"fork" and, if you need to keep the process alive at the
end, "s.wait_forever()".
Returns:
self
static get_available_midi_input_devices() -> Iterator[tuple[int, str]]
Returns a list of available ports and devices for midi input.
static print_available_midi_input_devices() -> None
Prints a list of available ports and devices for midi input.
static print_available_midi_output_devices() -> None
Prints a list of available ports and devices for midi output.
register_midi_listener(port_number_or_device_name: int | str, callback_function: Callable) -> None
Register a callback_function to respond to incoming midi events
from port_number_or_device_name
Parameters:
* **port_number_or_device_name** -- either the port number to
be used, or an device name for which the port number will
be determined. (Fuzzy string matching is used to pick the
device with closest name.)
* **callback_function** -- the callback function used when a
new midi event arrives. Should take either one argument
(the midi message) or two arguments (the midi message, and
the dt since the last message)
remove_midi_listener(port_number_or_device_name: int | str) -> None
Removes the midi listener with the given
port_number_or_device_name
Parameters:
**port_number_or_device_name** -- either the port number to
be used, or an device name for which the port number will be
determined. (Fuzzy string matching is used to pick the device
with closest name.)
register_osc_listener(port: int, osc_address_pattern: str, callback_function: Callable, ip_address: str = '127.0.0.1') -> None
Register a callback function for OSC messages on a given
address/port with given pattern
Parameters:
* **port** -- port on which to receive messages
* **osc_address_pattern** -- address pattern to respond to
(e.g. "/gesture/start")
* **callback_function** -- function to call upon receiving a
message. The first argument of the function will be the
address, and the remaining arguments will be those passed
along in the osc message.
* **ip_address** -- ip address on which to receive messages
remove_osc_listener(port: int, ip_address: str = '127.0.0.1') -> None
Remove OSC listener on the given port and IP address
Parameters:
* **port** -- port of the listener to remove
* **ip_address** -- ip_address of the listener to remove
register_keyboard_listener(on_press: Callable = None, on_release: Callable = None, suppress: bool = False, **kwargs) -> None
Register a callback_function to respond to incoming keyboard
events
Parameters:
* **on_press** -- function taking two arguments: key name
(string) and key number (int) called on key down
* **on_release** -- function taking two arguments: key name
(string) and key number (int) called on key up
* **suppress** -- if true, keyboard events are consumed and
not passed on to other processes
remove_keyboard_listener() -> None
Remove a previously added keyboard listener.
register_mouse_listener(on_move: Callable = None, on_press: Callable = None, on_release: Callable = None, on_scroll: Callable = None, suppress: bool = False, relative_coordinates: bool = False, **kwargs) -> None
Register a callback_function to respond to incoming mouse events
Parameters:
* **on_move** -- callback function taking two arguments (x,
y) called when the mouse is moved
* **on_press** -- callback function taking three arguments:
(x, y, button), where button is one of "left", "right", or
"middle"
* **on_release** -- callback function taking three arguments:
(x, y, button), where button is one of "left", "right", or
"middle"
* **on_scroll** -- callback function taking four arguments:
(x, y, dx, dy)
* **relative_coordinates** -- if True (requires tkinter
library), x and y values are normalized to screen width and
height and are floating point. Otherwise they are ints in
units of pixels.
* **suppress** -- if true, mouse events are consumed and not
passed on to other processes
remove_mouse_listener() -> None
Remove a previously added mouse listener
start_transcribing(instrument_or_instruments: ScampInstrument | Sequence[ScampInstrument] = None, clock: Clock = None, units: str = 'beats') -> Performance
Starts transcribing everything played in this Session's (or by
the given instruments) to a Performance. Defaults to using this
Session as the clock.
Parameters:
* **instrument_or_instruments** -- which instruments to
transcribe. Defaults to all session instruments
* **clock** -- which clock to record on, i.e. what are all
the timings notated relative to
* **units** -- one of ["beats", "time"]. Do we use the beats
of the clock or the time?
Returns:
the Performance we will be transcribing to
property absolute_beat_length: float
Beat length in true seconds, with all parent rates folded in.
(Read-only property; the pre-1.1 "clock.absolute_beat_length()"
spelling still works, with a DeprecationWarning.)
property absolute_rate: float
Rate of this clock in beats / (true) second, with all parent
rates folded in.
(Read-only property. Before clockblocks 1.1 this was a method;
the "clock.absolute_rate()" spelling still works, with a
DeprecationWarning.)
property absolute_tempo: float
Tempo (BPM) in true minutes, with all parent rates folded in.
(Read-only property; the pre-1.1 "clock.absolute_tempo()"
spelling still works, with a DeprecationWarning.)
add_instrument(instrument: ScampInstrument) -> ScampInstrument
Adds an instance of "ScampInstrument" to this Ensemble.
Generally, creating of and instrument and adding it to an
ensemble are done simultaneously via one of the "new_instrument"
methods.
Parameters:
**instrument** -- instrument to add to this ensemble
Returns:
self
property alive: bool
True if this clock is currently running (PENDING and DEAD both
return False).
apply_beat_length_function(function: Callable, domain_start: float = 0, domain_end: float = None, duration_units: str = 'beats', truncate: bool = True, loop: bool = False, extension_increment: float = 2.0, **kwargs) -> None
Drive this clock's beat_length from a function. See
"apply_function()" for the full parameter list (passed via
"**kwargs").
apply_rate_function(function: Callable, domain_start: float = 0, domain_end: float = None, duration_units: str = 'beats', truncate: bool = True, loop: bool = False, extension_increment: float = 2.0, **kwargs) -> None
Drive this clock's rate from a function.
apply_tempo_envelope(envelope: TempoEnvelope, truncate: bool = True, loop: bool = False) -> None
Append the given "TempoEnvelope" onto this clock's internal
tempo envelope, starting from the current beat. With *loop=True*
the envelope repeats indefinitely until
"stop_tempo_loop_or_function()". *truncate* first discards any
tempo curve already projected past the current beat so the
envelope begins cleanly from now.
apply_tempo_function(function: Callable, domain_start: float = 0, domain_end: float = None, duration_units: str = 'beats', truncate: bool = True, loop: bool = False, extension_increment: float = 2.0, **kwargs) -> None
Drive this clock's tempo (BPM) from a function.
property beat: float
How many beats have passed since this clock was created. Note
that this is quantized to the scheduler's event stream; for a
live estimate when outside the clock system use
"projected_time()".
(Read-only property. Before clockblocks 1.1 this was a method;
the "clock.beat()" spelling still works, with a
DeprecationWarning.)
property beat_length: float
The length of a beat in this clock in seconds. Note that
beat_length, tempo and rate are interconnected properties, and
that by setting one of them the other two are automatically set
in response according to the relationship: beat_length = 1/rate
= 60/tempo. Also, note that "seconds" refers to actual seconds
only in the master clock; otherwise it refers to beats in the
parent clock.
bring_up_to_date()
Advance this clock's tempo_history to match where it currently
is in scheduler time.
Called before mutating tempo from a foreign thread: if we don't,
the tempo setter's *truncate()* cuts at the last *committed*
beat (whatever the clock last woke at), causing the new tempo to
retroactively reshape the segment the clock is currently napping
through. From the owning thread this is a no-op since committed
== current.
children() -> Sequence[Clock]
Get all direct child clocks forked by this clock.
Returns:
tuple of all child clocks of this clock
clock_to_scheduler_time(beat_or_time, units='beats')
Gets the time in the scheduler for a given beat or time in this
clock, working recursively up the chain of clocks.
Parameters:
* **beat_or_time** -- the beat or time of interest in this
clock
* **units** -- one of ("beats", "time"), determining the
units for the first argument
Returns:
how much time should pass in the scheduler
property default_spelling_policy: SpellingPolicy
Default spelling policy used for transcriptions made with this
Ensemble.
descendants() -> Sequence[Clock]
Get all children, grandchildren, etc. of this clock
Returns:
tuple of all descendants
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
extract_absolute_tempo_envelope(start_beat: float = 0, end_beat: float | None = None, step_size: float = 0.1, tolerance: float = 0.005) -> TempoEnvelope
Extract this clock's absolute tempo curve — its tempo as
observed in master (scheduler) time, with parent rate-changes
folded in. Used when building a Score from this clock's
perspective.
Extracts over "[start_beat, end_beat]", where *end_beat*
defaults to this clock's current beat. When all ancestors are
pure, flat tempos, they simply scale this clock's tempo curve
directly. When the ancestors are changing, there is no exact
solution, so we sample every *step_size* beats. Sampling is
aligned to the tempo break points of every clock in the chain,
so an instantaneous tempo change stays sharp rather than
smearing into a short accelerando or ritardando.
fast_forward(on_or_off: bool = True) -> None
Turn indefinite fast-forwarding on or off. While on, all waiting
is instantaneous. (Only valid on the master clock.)
Parameters:
**on_or_off** -- True to start fast-forwarding, False to
stop.
fast_forward_in_beats(b: float) -> None
Fast-forward, skipping ahead instantaneously by *b* beats. (Only
valid on the master clock.)
Parameters:
**b** -- number of beats to fast-forward by
fast_forward_in_time(t: float) -> None
Fast-forward, skipping ahead instantaneously by *t* seconds.
(Only valid on the master clock.)
Parameters:
**t** -- number of seconds to fast-forward by
fast_forward_to_beat(b: float) -> None
Fast-forward, skipping instantaneously up to beat *b* on this
clock. (Only valid on the master clock.)
Parameters:
**b** -- beat to fast-forward to
fast_forward_to_time(t: float) -> None
Fast-forward, skipping instantaneously up to time *t* (in
seconds) on this clock, then resume real-time playback. (Only
valid on the master clock.)
Parameters:
**t** -- time to fast-forward to
fork(forked_function: Callable, args: Sequence = (), kwargs: dict = None, name: str = None, initial_rate: float = None, initial_tempo: float = None, initial_beat_length: float = None, when: ResolvableMoment | None = None, done_callback: Callable[[], None] = None)
Spawns a child clock running *forked_function* as a coordinated
parallel timeline.
The child runs on its own thread but stays synchronized under
this clock's master scheduler — "parallel" here means parallel
musical time (like a separate voice or layer), not simultaneous
CPU execution; the scheduler runs one clock's code at a time.
Parameters:
* **forked_function** -- the function to be run on the new
child clock
* **args** -- positional arguments to be passed to the forked
function. (Unlike legacy clockblocks, clockblocks does
*not* inject the child clock as an extra first argument
when the signature is one short — call "current_clock()"
from inside the forked function if you need a reference to
it.)
* **kwargs** -- keyword arguments to be passed to the forked
function
* **name** -- name to be given to the spawned child clock
* **initial_rate** -- starting rate of this clock (if set,
don't set initial tempo or beat length)
* **initial_tempo** -- starting tempo of this clock (if set,
don't set initial rate or beat length)
* **initial_beat_length** -- starting beat length of this
clock (if set, don't set initial tempo or rate)
* **when** -- when the forked function should begin, as a
"ResolvableMoment". None (default) starts it immediately.
Otherwise pass an explicit Moment — "at_beat()" (or
"at_time()") for an absolute point, or "after_beats()" (or
"after_time()") for an offset from now. Unlike wait and
wait_until, a bare number is rejected here, since it's not
clear whether it would be relative or absolute. Also
possible is a "MetricPhaseTarget" which starts it at the
next matching point in a cycle.
* **done_callback** -- a callback function to be invoked when
the clock has terminated
Returns:
the spawned child clock
static get_available_midi_output_devices() -> enumerate
Returns an enumeration of available ports and devices for midi
output.
get_instrument_by_name(name: str, which: int = 0)
Returns the instrument of the given name.
Parameters:
* **name** -- name of the instrument to return
* **which** -- If there are multiple with the same name, this
parameter specifies the one returned. (If none match the
number given by which, the first name match is returned)
hold_scheduler()
Context manager that: 1) ensures that the scheduler is not
executing scheduled actions — waiting if one is in flight, then
preventing others from starting; 2) rouses the scheduler and
updates its committed time to the current projected time. Code
under this context manager therefore acts like an immediately
scheduled action, holding exclusive access to an up-to-date
scheduler.
Note that, when used from within the clock system, this context
manager is a no-op, since the current thread already holds
exclusive access to an up-to-date scheduler. In fact, invoking
*clock.scheduler.held()* in that context would cause deadlock,
which is why this method exists as the main entry point.
inheritance(include_self: bool = True) -> Sequence[Clock]
Get all parent, grandparent, etc. of this clock up until the
master clock
Parameters:
**include_self** -- whether or not to include this clock in
the iterator or start with the parent
Returns:
tuple containing the clock's inheritance
property instruments
Returns a tuple of the instruments currently in this Ensemble.
is_fast_forwarding() -> bool
Whether the clock is currently fast-forwarding. Since fast-
forwarding is a scheduler-wide state, this is true for every
clock in the family whenever it's true for any of them.
is_master() -> bool
Check if this is the master clock
Returns:
True if this is the master clock, False otherwise
is_transcribing() -> bool
Checks if any transcriptions are in progress.
iterate_all_relatives(include_self: bool = False) -> Iterator[Clock]
Iterate through all related clocks to this clock.
Parameters:
**include_self** -- whether or not to include this clock in
the iterator
Returns:
iterator going through all clocks in the family tree,
starting with the master
iterate_descendants(include_self: bool = False) -> Iterator[Clock]
Iterate through all children, grandchildren, etc. of this clock
Parameters:
**include_self** -- whether or not to include this clock in
the iterator
Returns:
iterator going through all descendants
iterate_inheritance(include_self: bool = True) -> Iterator[Clock]
Iterate through parent, grandparent, etc. of this clock up until
the master clock
Parameters:
**include_self** -- whether or not to include this clock in
the iterator or start with the parent
Returns:
iterator going up the clock family tree up to the master
clock
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
kill() -> None
End this clock (and the corresponding forked function if not
master) and cascade to all descendant clocks.
Pending scheduled work for this clock and its descendants is
canceled and the clocks are marked dead. A clock currently
blocked in "wait()" raises "ClockKilledError"; any later
"wait()" or "fork()" made through a reference to a dead clock
raises "DeadClockError".
Killing the master also tears down the family's scheduler, and
releases its owning thread: that thread's "current_clock()"
becomes "None", so the module-level helpers ("wait()", "fork()",
"get_beat()", ...) raise "NoActiveClockError" there rather than
reporting a dead clock.
Returns once the killed clocks have finished unwinding to ensure
synchronicity. Emits a warning if this takes more than a few
seconds.
Safe to call from any thread, and killing an already-dead clock
is a no-op.
(See the "Clock termination / lifecycle paths" note near the top
of this module for how the five termination paths work
internally.)
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
property master: Clock
The master clock under which this clock operates (possibly
itself)
new_midi_part(name: str = None, midi_output_device: int | str = None, num_channels: int = 8, midi_output_name: str = None, max_pitch_bend: int = 'default', start_note_fixed: bool = True, default_spelling_policy: SpellingPolicy | str | tuple = None, clef_preference='from_name', start_channel: int = 0, volume_cc_num: int = 11, note_on_and_off_only: bool = False) -> ScampInstrument
Creates and returns a new ScampInstrument for this Ensemble that
uses a MIDIStreamPlaybackImplementation. This means that when
notes are played by this instrument, midi messages are sent out
to the given device.
Parameters:
* **name** -- name used for this instrument in score, etc.
for a preset of the appropriate name.
* **midi_output_device** -- name or number of the device used
to output midi. Call get_available_midi_output_devices to
check what's available.
* **num_channels** -- maximum of midi channels available to
this midi part. It's wise to use more when doing microtonal
playback, since pitch bends are applied per channel.
* **midi_output_name** -- name of this part
* **max_pitch_bend** -- max pitch bend to use for this
instrument
* **start_note_fixed** -- default "start_note_fixed" for
notes started with "start_note()" on this part.
* **default_spelling_policy** -- the
"default_spelling_policy" for the new part
* **clef_preference** -- the "clef_preference" for the new
part
* **start_channel** -- the first channel to use. For
instance, if start_channel is 4, and num_channels is 5, we
will use channels (4, 5, 6, 7, 8). NOTE: channel counting
in SCAMP starts from 0, so this may show up as channels 5-9
in your MIDI software.
* **volume_cc_num** -- The cc value used for volume changes.
Defaults to 11 (expression).
* **note_on_and_off_only** -- Deprecated; use
*start_note_fixed*.
Returns:
the newly created ScampInstrument
new_osc_part(name: str = None, port: int = None, ip_address: str = '127.0.0.1', message_prefix: str = None, osc_message_addresses: dict = 'default', default_spelling_policy: SpellingPolicy | str | tuple = None, clef_preference='from_name', start_note_fixed: bool = True) -> ScampInstrument
Creates and returns a new ScampInstrument for this Ensemble that
uses a OSCPlaybackImplementation. This means that when notes are
played by this instrument, osc messages are sent out to the
specified address
Parameters:
* **name** -- name used for this instrument in score, etc.
for a preset of the appropriate name.
* **port** -- port osc messages are sent to
* **ip_address** -- ip_address osc messages are sent to
* **message_prefix** -- prefix used for this instrument in
osc messages
* **osc_message_addresses** -- dictionary defining the
address used for each type of playback message. defaults to
using "start_note", "end_note", "change_pitch",
"change_volume", "change_parameter". The default can be
changed in playback settings.
* **default_spelling_policy** -- the
"default_spelling_policy" for the new part
* **clef_preference** -- the "clef_preference" for the new
part
* **start_note_fixed** -- default "start_note_fixed" for
notes started with "start_note()" on this part.
Returns:
the newly created ScampInstrument
new_part(name: str = None, preset='auto', soundfont: str = 'default', num_channels: int = 8, audio_driver: str = 'default', max_pitch_bend: int = 'default', start_note_fixed: bool = True, default_spelling_policy: SpellingPolicy | str | tuple = None, clef_preference='from_name', volume_cc_num: int = 11, note_on_and_off_only: bool = False) -> ScampInstrument
Creates and returns a new ScampInstrument for this Ensemble that
uses a SoundfontPlaybackImplementation. Unless otherwise
specified, the default soundfont for this Ensemble/Session will
be used, and we will search for the preset that best matches the
name given.
Parameters:
* **name** -- name used for this instrument in score, etc.
* **preset** -- if an int, assumes bank #0; can also be a
tuple of form (bank, preset). If "auto", searches for a
preset of the appropriate name.
* **soundfont** -- the name of the soundfont to use for
fluidsynth playback
* **num_channels** -- maximum of midi channels available to
this midi part. It's wise to use more when doing microtonal
playback, since pitch bends are applied per channel.
* **audio_driver** -- which audio driver to use for this
instrument (defaults to ensemble default)
* **max_pitch_bend** -- max pitch bend to use for this
instrument
* **start_note_fixed** -- default "start_note_fixed" for
notes started with "start_note()" on this part.
* **default_spelling_policy** -- the
"default_spelling_policy" for the new part
* **clef_preference** -- the "clef_preference" for the new
part
* **volume_cc_num** -- The cc value used for volume changes.
Defaults to 11 (expression).
* **note_on_and_off_only** -- Deprecated; use
*start_note_fixed*.
Returns:
the newly created ScampInstrument
new_silent_part(name: str = None, default_spelling_policy: SpellingPolicy | str | tuple = None, clef_preference='from_name', start_note_fixed: bool = True) -> ScampInstrument
Creates and returns a new ScampInstrument for this Ensemble with
no PlaybackImplementations.
Parameters:
* **name** -- name of the new part
* **default_spelling_policy** -- the
"default_spelling_policy" for the new part
* **clef_preference** -- the "clef_preference" for the new
part
* **start_note_fixed** -- the "start_note_fixed" default for
the new part. Only relevant if adding a MIDI playback
implementation.
Returns:
the newly created ScampInstrument
pop_instrument(index)
Pops the instrument at the given index, severing its ties to the
ensemble.
Parameters:
**index** -- which instrument
property precise_timing: bool
Whether to use a busy wait in the final moments leading up to a
scheduled event. The busy wait fully occupies a CPU core and
lasts at most "spin_guard_duration" seconds per event. (Forwards
to the scheduler, settable only on the master clock)
print_default_soundfont_presets() -> None
Prints a list of presets available with the default soundfont.
print_family_tree() -> None
Print a hierarchical representation of this clock's family tree.
print_status(verbose: bool = False) -> None
Print this clock's "status()" snapshot.
projected_beat() -> float
A wall-clock-interpolated estimate of "beat". See
"projected_time()".
Returns:
the estimated elapsed beats.
projected_time() -> float
A wall-clock-interpolated estimate of "time", advancing smoothly
between events rather than holding still between them. For
readers outside the clock system; see the section comment above.
(A method rather than a property, because it is a live sample:
every call returns a different value.)
This is an estimate, and it can step backward — see
"projected_time()".
Returns:
the estimated elapsed time, in the same units as "time".
property rate: float
The rate of this clock in beats / second. Note that beat_length,
tempo and rate are interconnected properties, and that by
setting one of them the other two are automatically set in
response according to the relationship: beat_length = 1/rate =
60/tempo. Also, note that "seconds" refers to actual seconds
only in the master clock; otherwise it refers to beats in the
parent clock.
register_note(instrument: ScampInstrument, note_info: dict) -> None
Called when an instrument wants to register that it finished a
note, records note in all transcriptions
Parameters:
* **instrument** -- the ScampInstrument that played the note
* **note_info** -- the note info dictionary on that note,
containing time stamps, parameter changes, etc.
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
schedule_action(action: Callable, when: ResolvableMoment, args: Sequence = (), kwargs: dict = None) -> None
The lightweight alternative to fork() for immediately returning
functions. Schedules *action* to run once at *when*, as a leaf
event on the scheduler thread — without spawning a child clock.
For functions that don't wait, this is much more performant:
there is no thread creation, no scheduler/clock handoff; just a
callable fired at the right musical time.
For work that needs to wait, fork() a child clock instead. The
function scheduled here will not have an active clock to wait
on, and will hold up the entire scheduler if it sleeps.
Parameters:
* **action** -- the callable to run (exceptions are caught
and logged by the scheduler)
* **when** -- when to run it, as a "ResolvableMoment" — same
convention as fork(): an explicit Moment
(Moment.at_beat/at_time for an absolute point,
Moment.after_beats/ after_time for an offset from now) or a
MetricPhaseTarget. Unlike wait and wait_until, a bare
number is rejected here, since it's not clear whether it
would be relative or absolute.
* **args** -- positional arguments to pass to action
* **kwargs** -- keyword arguments to pass to action
scheduler_to_clock_time(scheduler_time, desired_units='beats')
Gets beats or time in this clock for a given time in the
scheduler.
Parameters:
* **scheduler_time** -- the time of interest in the scheduler
* **desired_units** -- one of ("beats", "time"), whether
we're looking for beats or time in this clock
Returns:
how much time should pass in the scheduler
set_beat_length_target(beat_length_target: float, when: ResolvableMoment, curve_shape: float = None, truncate: bool = True, align_to: ResolvableMoment = None) -> None
Smoothly change this clock's beat length (seconds per beat) to
"beat_length_target", arriving at the moment given by "when".
This is the underlying representation behind
"set_tempo_target()" and "set_rate_target()"; a longer beat
length means a slower tempo.
Parameters:
* **beat_length_target** -- the beat length to arrive at, in
seconds per beat.
* **when** -- when the target should be reached, as a
"Moment" (e.g. "Moment.after_beats(4)",
"Moment.at_time(10)") or a "MetricPhaseTarget" (the next
point matching a particular phase within the beat cycle).
"after_*" moments count from the clock's *current*
position. A plain number is rejected; wrap it in a Moment
to clarify beat/time and relative/absolute.
* **curve_shape** -- the bend of the transition. "0" (the
default) is a straight line; "> 0" keeps the old tempo
longer and changes late; "< 0" changes early then eases in.
When "align_to" solves for the curvature (see below) this
acts only as a starting hint, and with a fixed "align_to",
it is ignored entirely (and a warning is issued if set).
* **truncate** -- if "True" (the default), any tempo curve
already scheduled past the current beat is discarded first,
so the change starts from where the clock is right now. If
"False", this target is appended after whatever is already
scheduled.
* **align_to** -- optional. If *when* is an arrival beat,
this specifies the desired arrival time. If *when* is an
arrival time, this specifies the desired arrival beat. A
MetricPhaseTarget can be given instead of a singular
time/beat, to express when we should arrive within a
time/beat cycle. Note that the coordination of beat and
time is done via mutating the curve shape, so an explicit
curve shape is only a hint (ignored completely if align_to
is a fixed point rather than a metric phase target).
Raises:
**ValueError** -- if "when"/"align_to" share an axis, or if
no curvature can reach the requested "align_to" (in which
case the tempo curve is left unchanged).
set_beat_length_targets(beat_length_targets: Sequence[float], whens: Sequence[ResolvableMoment], curve_shapes: Sequence[float] = None, truncate: bool = True, align_to: ResolvableMoment | Sequence[ResolvableMoment | None] = None) -> None
Smoothly change this clock's beat length (seconds per beat)
through a series of targets, building a multi-segment tempo
curve in one call — the multi-segment form of
"set_beat_length_target()". This is non-looping; to apply a
looping tempo shape, build a "TempoEnvelope" and use
"apply_tempo_envelope()".
Parameters:
* **beat_length_targets** -- the beat lengths (seconds per
beat) to arrive at, one per segment.
* **whens** -- when each target is reached (same length as
"beat_length_targets"), each a "Moment" or
"MetricPhaseTarget". Note that every *when* is resolved
against the clock's *current* position, so an "after_*"
moment counts from now, not from the previous segment's.
Beats- and time-axis moments may be freely mixed across the
list, so long as the whens come out in strictly increasing
clock-time.
* **curve_shapes** -- optional per-segment bends (same length
as "beat_length_targets"), each as in
"set_beat_length_target()". "None" for the whole argument
(the default), or a per-element "None", means linear ("0")
for that segment.
* **truncate** -- if "True" (the default), any tempo curve
already scheduled past the current beat is discarded first,
so the run starts from where the clock is now; if "False"
the run is appended after whatever is already scheduled.
* **align_to** --
optional curvature-solved alignment, extending
"set_beat_length_target()"'s "align_to" to runs of
segments. Either:
* a single "Moment"/"MetricPhaseTarget" — align the *whole*
call as one run, landing its end on the target; or
* a per-segment list/tuple (same length as
"beat_length_targets") of "None"/targets — each
non-"None" entry closes a *run* (all segments since the
previous alignment, or the start) and bends them
collectively so the run lands on that target.
A group-aligned run of more than one segment must have its
"whens" on a single axis (all beats or all time), with the
alignment target on the opposite (free) axis.
Raises:
**ValueError** -- if "whens"/"curve_shapes"/"align_to"
lengths are inconsistent with "beat_length_targets"; if the
"whens" do not come out strictly increasing in clock-time
(the error names the offending index); if a multi-segment
aligned run mixes beat- and time-axis "whens"; or if an
alignment target is unreachable by curvature adjustment. On
any failure the tempo curve is left unchanged.
set_rate_target(rate_target: float, when: ResolvableMoment, curve_shape: float = None, truncate: bool = True, align_to: ResolvableMoment = None) -> None
Smoothly change this clock's rate (beats per second) to
"rate_target", arriving at "when". Rate is the reciprocal of
beat length: a higher rate is a faster tempo.
Parameters:
* **rate_target** -- the rate to arrive at, in beats per
second.
* **when** -- when the target is reached. See
"set_beat_length_target()".
* **curve_shape** -- the bend of the transition. See
"set_beat_length_target()".
* **truncate** -- whether to discard already-scheduled tempo
changes first. See "set_beat_length_target()".
* **align_to** -- optional; solve the curvature to land the
free axis on a phase or coordinate. See
"set_beat_length_target()".
Raises:
**ValueError** -- see "set_beat_length_target()".
set_rate_targets(rate_targets: Sequence[float], whens: Sequence[ResolvableMoment], curve_shapes: Sequence[float] = None, truncate: bool = True, align_to: ResolvableMoment | Sequence[ResolvableMoment | None] = None) -> None
Smoothly change this clock's rate (beats per second; the
reciprocal of beat length, so a higher rate is a faster tempo)
through a series of targets — the multi-segment form of
"set_rate_target()".
Parameters:
* **rate_targets** -- the rates (beats per second) to arrive
at, one per segment.
* **whens** -- when each target is reached. See
"set_beat_length_targets()".
* **curve_shapes** -- optional per-segment bends. See
"set_beat_length_targets()".
* **truncate** -- whether to discard already-scheduled tempo
changes first. See "set_beat_length_targets()".
* **align_to** -- optional curvature-solved alignment of
segment runs. See "set_beat_length_targets()".
Raises:
**ValueError** -- see "set_beat_length_targets()".
set_tempo_target(tempo_target: float, when: ResolvableMoment, curve_shape: float = None, truncate: bool = True, align_to: ResolvableMoment = None) -> None
Smoothly change this clock's tempo to "tempo_target", arriving
at "when". Tempo is measured in beats per minute; this is
usually the most natural of the three equivalent ways to set a
target (see also "set_rate_target()" and
"set_beat_length_target()").
Parameters:
* **tempo_target** -- the tempo to arrive at, in beats per
minute (quarter-notes per minute by convention).
* **when** -- when the target is reached. See
"set_beat_length_target()".
* **curve_shape** -- the bend of the transition. See
"set_beat_length_target()".
* **truncate** -- whether to discard already-scheduled tempo
changes first. See "set_beat_length_target()".
* **align_to** -- optional; solve the curvature to land the
free axis on a phase or coordinate. See
"set_beat_length_target()".
Raises:
**ValueError** -- see "set_beat_length_target()".
set_tempo_targets(tempo_targets: Sequence[float], whens: Sequence[ResolvableMoment], curve_shapes: Sequence[float] = None, truncate: bool = True, align_to: ResolvableMoment | Sequence[ResolvableMoment | None] = None) -> None
Smoothly change this clock's tempo (beats per minute) through a
series of targets — the multi-segment form of
"set_tempo_target()", and usually the most natural of the three
equivalent plural setters.
Parameters:
* **tempo_targets** -- the tempos (beats per minute) to
arrive at, one per segment.
* **whens** -- when each target is reached. See
"set_beat_length_targets()".
* **curve_shapes** -- optional per-segment bends. See
"set_beat_length_targets()".
* **truncate** -- whether to discard already-scheduled tempo
changes first. See "set_beat_length_targets()".
* **align_to** -- optional curvature-solved alignment of
segment runs. See "set_beat_length_targets()".
Raises:
**ValueError** -- see "set_beat_length_targets()".
property spin_guard_duration: float
Width (seconds) of the busy-wait guard band used when
"precise_timing" is on. (Forwards to the scheduler, settable
only on the master clock)
status(verbose: bool = False) -> str
A snapshot of this clock's name and position, alongside the
scheduler's elapsed wall time and how far behind schedule it is
currently running.
stop_tempo_loop_or_function() -> None
Stop following any function or looping envelope previously
applied to this clock's tempo.
stop_transcribing(which_performance=None, tempo_envelope_tolerance=0.001) -> Performance
Stops transcribing a Performance and returns it. Defaults to the
oldest started performance, unless otherwise specified.
Parameters:
* **which_performance** -- which performance to stop
transcribing; defaults to oldest started
* **tempo_envelope_tolerance** -- error tolerance when
extracting the absolute tempo envelope for the Performance
Returns:
the created Performance
property tempo: float
The rate of this clock in beats / minute Note that beat_length,
tempo and rate are interconnected properties, and that by
setting one of them the other two are automatically set in
response according to the relationship: beat_length = 1/rate =
60/tempo. Also, note that "seconds" refers to actual seconds
only in the master clock; otherwise it refers to beats in the
parent clock.
terminate_forked_children() -> None
Kill this clock's children and their descendants in turn,
returning once they have finished unwinding. At the natural end
of a forked clock that has (or might have) still-active
children, either this or "wait_for_children_to_finish()" should
be called, making explicit what to do with those forked
children. (The default is termination with a warning, in case
it's not what the user wants.)
property time: float
How much time has passed since this clock was created. Either in
seconds, if this is the master clock, or in beats in the parent
clock, if this clock was the result of a call to fork. Note that
this is quantized to the scheduler's event stream; for a live
estimate when outside the clock system use "projected_time()".
(Read-only property. Before clockblocks 1.1 this was a method;
the "clock.time()" spelling still works, with a
DeprecationWarning.)
property timing_policy: float
How the family trades off relative vs. absolute timing, as a
float from 0 to 1.
At 1.0 (relative) each wait is kept as faithful as possible to
its requested duration, timed from when the previous event fired
(callback runtime does not count against the wait). This can
still let the clock fall behind real time: if a wait overruns
(e.g. through a callback that runs longer than its own wait or
the OS waking late) that lateness is never made up. At 0.0
(absolute) the clock instead stays faithful to the time elapsed
since it began — a wait that ran long is followed by shorter
waits to catch up, at the cost of some relative-timing accuracy.
A value in between clamps the catch-up: the clock attempts to
stay on the absolute schedule but can only compress a wait to
*wait_dur * timing_policy* (or stretch it to *wait_dur /
timing_policy* if trying to compensate for being ahead).
(Forwards to the scheduler, settable only on the master clock)
property transcriptions_in_progress: tuple[Performance]
Tuple of all current transcriptions.
use_absolute_timing_policy() -> None
Shorthand for "timing_policy = 0.0" (always catch up to absolute
schedule).
use_mixed_timing_policy(absolute_relative_mix: float) -> None
Shorthand for "timing_policy = absolute_relative_mix" (a blend
between 0=absolute and 1=relative).
use_relative_timing_policy() -> None
Shorthand for "timing_policy = 1.0" (always wait the full
requested delay).
wait(duration: float | ResolvableMoment, units: str = 'beats') -> None
Block this clock for *duration* beats (or seconds, if
units="time") from now, yielding to the scheduler. *duration*
may also be any ResolvableMoment (a Moment or
MetricPhaseTarget), in which case it is resolved directly and
*units* is ignored — e.g. wait(Moment.at_beat(8)) or
wait(MetricPhaseTarget(0, 4)). wait_until() is just a
convenience for absolute targets given as a bare number; passing
an absolute Moment to wait() does the same thing.
wait_for_children_to_finish() -> None
Block this clock's own thread until all of its child clocks have
finished, yielding to the scheduler so they can run, then return
as soon as the last child ends.
If this clock is itself killed while waiting, raises
"ClockKilledError" rather than returning — so a normal return
always means the children genuinely finished.
wait_for_clock_to_finish(clock: Clock) -> None
Block this clock's own thread until *clock* has finished,
yielding to the scheduler so it (and everything else) keeps
running. The counterpart to "wait_for_children_to_finish()" for
a specific clock rather than one's own children — *clock* may be
any other clock in the same family (a sibling, a descendant, an
unrelated fork), so long as it shares this clock's scheduler.
Returns as soon as *clock* finishes, whether it ended on its own
or was killed. If *clock* has already finished, returns
immediately. If this clock is itself killed while waiting,
raises "ClockKilledError" rather than returning.
Parameters:
**clock** -- the clock to wait on. Must belong to the same
family (raises ValueError otherwise), and must not be this
clock itself (which would wait forever).
wait_forever() -> None
Block this clock's own thread indefinitely, yielding to the
scheduler so child clocks keep running. Typically called once a
clock has forked its work and has nothing left to do itself
(e.g. the master clock keeping the main thread alive).
This only ever unblocks via "kill()", at which point it raises
"ClockKilledError". For a forked clock, this is caught by the
fork wrapper and it cleanly unwinds. For a master clock it would
need to be caught. A built-in way to do this is by using the
clock as a context manager, which does exception handling and
teardown for you. ("run_as_server()" also absorbs the exception
automatically within the spawned thread).
That said, typically this is used at end of script and killed
via ctrl-c/process exit, so no explicit catching of this
exception is necessary.
wait_until(when: float | ResolvableMoment, units: str = 'beats') -> None
Block this clock until the beat (or time, if units="time")
indicated by *when* — a convenience for absolute targets given
as a bare number (equivalent to wait(Moment.at_beat(when)), or
Moment.at_time for units="time"). *when* may also be any
ResolvableMoment, in which case the units are ignored and
behavior is identical to wait(). If *when* is in the past,
returns essentially immediately.
description: str | None
======================================================================
=== FILE: scamp/scamp.session.txt
======================================================================
scamp.session
*************
Module containing the "Session" class, which is the central hub
through which nearly all of SCAMP's functionality flows.
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "Session"( | A Session combines the functionality of a master Clock, an Ensemble, and a Transcriber. |
| [tempo, de | |
| fault_soun | |
| dfont, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.session.Session
* "Session"
* "Session.run_as_server()"
* "Session.get_available_midi_input_devices()"
* "Session.print_available_midi_input_devices()"
* "Session.print_available_midi_output_devices()"
* "Session.register_midi_listener()"
* "Session.remove_midi_listener()"
* "Session.register_osc_listener()"
* "Session.remove_osc_listener()"
* "Session.register_keyboard_listener()"
* "Session.remove_keyboard_listener()"
* "Session.register_mouse_listener()"
* "Session.remove_mouse_listener()"
* "Session.start_transcribing()"
* "Session.absolute_beat_length"
* "Session.absolute_rate"
* "Session.absolute_tempo"
* "Session.add_instrument()"
* "Session.alive"
* "Session.apply_beat_length_function()"
* "Session.apply_rate_function()"
* "Session.apply_tempo_envelope()"
* "Session.apply_tempo_function()"
* "Session.beat"
* "Session.beat_length"
* "Session.bring_up_to_date()"
* "Session.children()"
* "Session.clock_to_scheduler_time()"
* "Session.default_spelling_policy"
* "Session.descendants()"
* "Session.duplicate()"
* "Session.extract_absolute_tempo_envelope()"
* "Session.fast_forward()"
* "Session.fast_forward_in_beats()"
* "Session.fast_forward_in_time()"
* "Session.fast_forward_to_beat()"
* "Session.fast_forward_to_time()"
* "Session.fork()"
* "Session.get_available_midi_output_devices()"
* "Session.get_instrument_by_name()"
* "Session.hold_scheduler()"
* "Session.inheritance()"
* "Session.instruments"
* "Session.is_fast_forwarding()"
* "Session.is_master()"
* "Session.is_transcribing()"
* "Session.iterate_all_relatives()"
* "Session.iterate_descendants()"
* "Session.iterate_inheritance()"
* "Session.json_dumps()"
* "Session.json_loads()"
* "Session.kill()"
* "Session.load_from_json()"
* "Session.master"
* "Session.new_midi_part()"
* "Session.new_osc_part()"
* "Session.new_part()"
* "Session.new_silent_part()"
* "Session.pop_instrument()"
* "Session.precise_timing"
* "Session.print_default_soundfont_presets()"
* "Session.print_family_tree()"
* "Session.print_status()"
* "Session.projected_beat()"
* "Session.projected_time()"
* "Session.rate"
* "Session.register_note()"
* "Session.save_to_json()"
* "Session.schedule_action()"
* "Session.scheduler_to_clock_time()"
* "Session.set_beat_length_target()"
* "Session.set_beat_length_targets()"
* "Session.set_rate_target()"
* "Session.set_rate_targets()"
* "Session.set_tempo_target()"
* "Session.set_tempo_targets()"
* "Session.spin_guard_duration"
* "Session.status()"
* "Session.stop_tempo_loop_or_function()"
* "Session.stop_transcribing()"
* "Session.tempo"
* "Session.terminate_forked_children()"
* "Session.time"
* "Session.timing_policy"
* "Session.transcriptions_in_progress"
* "Session.use_absolute_timing_policy()"
* "Session.use_mixed_timing_policy()"
* "Session.use_relative_timing_policy()"
* "Session.wait()"
* "Session.wait_for_children_to_finish()"
* "Session.wait_for_clock_to_finish()"
* "Session.wait_forever()"
* "Session.wait_until()"
* "Session.description"
======================================================================
=== FILE: scamp/scamp.settings.EngravingSettings.txt
======================================================================
scamp.settings.EngravingSettings
********************************
class scamp.settings.EngravingSettings(allow_duple_tuplets_in_compound_time: bool = False, max_voices_per_staff: int = 4, pitch_order_voices_within_measure: bool = True, max_dots_allowed: int = 3, beat_hierarchy_spacing: float = 2.4, num_divisions_penalty: float = 0.6, rest_beat_hierarchy_spacing: float = 20, rest_num_divisions_penalty: float = 0.2, articulation_split_protocols: dict = <factory>, notation_split_protocols: dict = <factory>, clefs_by_instrument: dict = <factory>, clef_pitch_centers: dict = <factory>, clef_selection_policy: str = 'measure-wise', default_titles: list | str | None = <factory>, default_composers: list | str | None = <factory>, default_spelling_policy: SpellingPolicy = <factory>, ignore_empty_parts: bool = True, glissandi: GlissandiSettings = <factory>, tempo: TempoSettings = <factory>, pad_incomplete_parts: bool = True, music_xml_open_command: str | None = <factory>, show_microtonal_annotations: bool = False, microtonal_annotation_digits: int = 2, export_note_velocities_to_xml: bool = False, lilypond_dir: str | None = <factory>, lilypond_search_paths: dict = <factory>)
Bases: "_ScampSettings"
Namespace containing the settings relevant to the engraving of
scores.
Parameters:
**settings_dict** -- dictionary from which to set all settings
attributes
Variables:
* **allow_duple_tuplets_in_compound_time** -- There are two ways
to express a division of a beat in compound time in two: with
a duple tuplet or with dotted notes. For instance, half of a
beat in 3/8 can be represented as a dotted-eighth or an eighth
inside of a 2:3 tuplet. If this is set to True, we allow the
latter option.
* **max_voices_per_staff** -- integer (from 1 to 4) specifying
how many voices we allow in a single staff before creating
extra staves to accommodate them. (Formerly named
"max_voices_per_part", which still works but is deprecated.)
* **pitch_order_voices_within_measure** -- if True, voices
within a particular staff and measure are reordered according
to pitch (higher pitch = upper, stem-up voice) to reduce
crossed stems. A voice is only reordered at a barline no note
ties across, so ties are never broken. Set False to keep each
named voice in a fixed rendered voice number for its whole
duration.
* **max_dots_allowed** -- integer specifying how many dots we
allow a note to have before it's just too many dots.
* **beat_hierarchy_spacing** -- Should be >= 1. Larger numbers
treat the various nested levels of beat subdivision as further
apart, leading to a greater tendency to show the beat
structure rather than combine tie notes into fewer pieces.
* **num_divisions_penalty** -- Ranges from 0 to 1, where 0
treats having multiple tied notes to represent a single note
event as just as good as having fewer notes, while numbers
closer to 1 increasingly favor using fewer notes in a tied
group.
* **rest_beat_hierarchy_spacing** -- Same as
beat_hierarchy_spacing, but for rests. (We generally want
rests to be more likely to split.)
* **rest_num_divisions_penalty** -- Same as
num_divisions_penalty, but for rests. (We generally want rests
to be less inclined to recombine.)
* **articulation_split_protocols** -- Dictionary mapping
articulation names to either "first", "last", "both" or "all".
When a note has been given a particular articulation during
playback, but needs to be engraved as a group of tied notes,
the question arises: which of those tied pieces should get the
articulation? For instance, an accent probably wants to be on
the first note, since it's an attack, and a staccato dot
probably should be on the last note, since it's about release.
The value "both" will place the articulation on both the first
and last note, and "all" will place the articulation on every
note of the tied group.
* **clefs_by_instrument** -- Dictionary mapping instrument names
to a list of clefs used by those instruments. Instead of
simply the clef name, a tuple of (clef name,
redefined_pitch_center) can be given. This overrides the pitch
center given in clef_pitch_centers for that clef on that
instrument, since clef choice can be idiosyncratic to the
given instrument. The "DEFAULT" entry is used for instruments
not explicitly specified.
* **clef_pitch_centers** -- Pitch center used when deciding on
clef choice. Default is to use the pitch of the center line.
The clef chosen will be the one whose pitch center is closest
to the average pitch.
* **clef_selection_policy** -- Either "measure-wise", in which
case clef can be changed measure by measure if needed, or
"part-wise", in which case a single clef choice is used for
the entire part..
* **default_titles** -- Title or list of titles from which to
choose for a score that has been created without specifying a
title.
* **default_composers** -- Name or list of name from which to
choose for a score that has been created without specifying a
composer.
* **default_spelling_policy** -- the SpellingPolicy to use by
default in determining accidentals.
* **ignore_empty_parts** -- if True, don't bother to include
parts in a score if there's nothing in them.
* **glissandi** -- instance of "GlissandiSettings" specifying
how glissandi should be engraved.
* **tempo** -- instance of "TempoSettings" specifying how tempo
changes should be engraved.
* **pad_incomplete_parts** -- If true, add measures to parts
that don't have enough music in them so that they are go the
full length of the score.
* **music_xml_open_command** -- Terminal command to run when
opening up MusicXML scores. It is easiest to set this by
calling set_music_xml_application. The value "auto" tries to
find an appropriate application automatically.
* **show_microtonal_annotations** -- if True, annotates
microtonal pitches with the exact floating-point MIDI pitch
value that they are intended to represent. (This is useful,
since normally the best a notation program can do is quarter
tones.
* **microtonal_annotation_digits** -- number of digits after the
decimal place to show when showing microtonal annotations.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "get_defau | Grabs one of the default composer names. |
| lt_compose | |
| r"() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_defau | Grabs one of the default score titles. |
| lt_title"( | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_music | Sets the application to use when opening generated MusicXML scores |
| _xml_appli | |
| cation"([. | |
| ..]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "factory_d | Returns a factory default version of this settings object. |
| efault"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load"() | Loads and instance of this settings object from its corresponding JSON file. |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "make_pers | Rewrites the JSON file from which settings are loaded, meaning that this reset will |
| istent"() | persist to the running of scripts in the future. |
+------------+--------------------------------------------------------------------------------------------+
| "open_json | Open the JSON file for these settings. |
| _file"(*co | |
| mmand_and_ | |
| flags) | |
+------------+--------------------------------------------------------------------------------------------+
| "restore_f | Restores settings back to their "factory defaults" (the defaults when SCAMP was |
| actory_def | installed). |
| aults"([pe | |
| rsist]) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "allow_dup | |
| le_tuplets | |
| _in_compou | |
| nd_time" | |
+------------+--------------------------------------------------------------------------------------------+
| "beat_hier | |
| archy_spac | |
| ing" | |
+------------+--------------------------------------------------------------------------------------------+
| "clef_sele | |
| ction_poli | |
| cy" | |
+------------+--------------------------------------------------------------------------------------------+
| "export_no | |
| te_velocit | |
| ies_to_xml | |
| " | |
+------------+--------------------------------------------------------------------------------------------+
| "ignore_em | |
| pty_parts" | |
+------------+--------------------------------------------------------------------------------------------+
| "max_dots_ | |
| allowed" | |
+------------+--------------------------------------------------------------------------------------------+
| "max_voice | Deprecated alias for "max_voices_per_staff". |
| s_per_part | |
| " | |
+------------+--------------------------------------------------------------------------------------------+
| "max_voice | |
| s_per_staf | |
| f" | |
+------------+--------------------------------------------------------------------------------------------+
| "microtona | |
| l_annotati | |
| on_digits" | |
+------------+--------------------------------------------------------------------------------------------+
| "num_divis | |
| ions_penal | |
| ty" | |
+------------+--------------------------------------------------------------------------------------------+
| "pad_incom | |
| plete_part | |
| s" | |
+------------+--------------------------------------------------------------------------------------------+
| "pitch_ord | |
| er_voices_ | |
| within_mea | |
| sure" | |
+------------+--------------------------------------------------------------------------------------------+
| "rest_beat | |
| _hierarchy | |
| _spacing" | |
+------------+--------------------------------------------------------------------------------------------+
| "rest_num_ | |
| divisions_ | |
| penalty" | |
+------------+--------------------------------------------------------------------------------------------+
| "show_micr | |
| otonal_ann | |
| otations" | |
+------------+--------------------------------------------------------------------------------------------+
| "articulat | |
| ion_split_ | |
| protocols" | |
+------------+--------------------------------------------------------------------------------------------+
| "notation_ | |
| split_prot | |
| ocols" | |
+------------+--------------------------------------------------------------------------------------------+
| "clefs_by_ | |
| instrument | |
| " | |
+------------+--------------------------------------------------------------------------------------------+
| "clef_pitc | |
| h_centers" | |
+------------+--------------------------------------------------------------------------------------------+
| "default_t | |
| itles" | |
+------------+--------------------------------------------------------------------------------------------+
| "default_c | |
| omposers" | |
+------------+--------------------------------------------------------------------------------------------+
| "default_s | |
| pelling_po | |
| licy" | |
+------------+--------------------------------------------------------------------------------------------+
| "glissandi | |
| " | |
+------------+--------------------------------------------------------------------------------------------+
| "tempo" | |
+------------+--------------------------------------------------------------------------------------------+
| "music_xml | |
| _open_comm | |
| and" | |
+------------+--------------------------------------------------------------------------------------------+
| "lilypond_ | |
| dir" | |
+------------+--------------------------------------------------------------------------------------------+
| "lilypond_ | |
| search_pat | |
| hs" | |
+------------+--------------------------------------------------------------------------------------------+
allow_duple_tuplets_in_compound_time: bool = False
max_voices_per_staff: int = 4
pitch_order_voices_within_measure: bool = True
max_dots_allowed: int = 3
beat_hierarchy_spacing: float = 2.4
num_divisions_penalty: float = 0.6
rest_beat_hierarchy_spacing: float = 20
rest_num_divisions_penalty: float = 0.2
articulation_split_protocols: dict
notation_split_protocols: dict
clefs_by_instrument: dict
clef_pitch_centers: dict
clef_selection_policy: str = 'measure-wise'
default_titles: list | str | None
default_composers: list | str | None
default_spelling_policy: SpellingPolicy
ignore_empty_parts: bool = True
glissandi: GlissandiSettings
tempo: TempoSettings
pad_incomplete_parts: bool = True
music_xml_open_command: str | None
show_microtonal_annotations: bool = False
microtonal_annotation_digits: int = 2
export_note_velocities_to_xml: bool = False
lilypond_dir: str | None
lilypond_search_paths: dict
property max_voices_per_part
Deprecated alias for "max_voices_per_staff".
set_music_xml_application(application_name: str = None, persist: bool = False) -> None
Sets the application to use when opening generated MusicXML
scores
Parameters:
* **application_name** -- name of the application to use. If
None, defaults to a generic file open command.
* **persist** -- if True, also write the change to the
engraving settings JSON so it survives across processes.
get_default_title() -> str | None
Grabs one of the default score titles.
get_default_composer() -> str | None
Grabs one of the default composer names.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
classmethod factory_default()
Returns a factory default version of this settings object.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load()
Loads and instance of this settings object from its
corresponding JSON file. If no such file exists, or it is
corrupted in some way, then this creates a fresh JSON file
there. This doesn't work with settings that are nested within
other settings (like GlissandiSettings), since they do not have
corresponding JSON files,
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
make_persistent() -> None
Rewrites the JSON file from which settings are loaded, meaning
that this reset will persist to the running of scripts in the
future.
open_json_file(*command_and_flags)
Open the JSON file for these settings.
Parameters:
**command_and_flags** -- the command-line tool with which to
open the file, and any associated flags. Defaults to a
platform-specific generic open command.
restore_factory_defaults(persist=False) -> None
Restores settings back to their "factory defaults" (the defaults
when SCAMP was installed). Unless the *persist* argument is set,
this is temporary to the running of the current script.
Parameters:
**persist** -- if True, rewrites the JSON file from which
defaults are loaded, meaning that this reset will persist to
the running of scripts in the future.
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.settings.GlissandiSettings.txt
======================================================================
scamp.settings.GlissandiSettings
********************************
class scamp.settings.GlissandiSettings(control_point_policy: str = 'split', consider_non_extrema_control_points: bool = True, include_end_grace_note: bool = True, inner_grace_relevance_threshold: float = 1.5, max_inner_graces_music_xml: int = 1, slur_glisses: bool = True)
Bases: "_ScampSettings"
Namespace containing the settings relevant to the engraving of
glissandi.
Parameters:
**settings_dict** -- dictionary from which to set all settings
attributes
Variables:
* **control_point_policy** --
Can be either "grace", "split", or "none":
* if "grace", the rhythm is expressed as simply as possible
and they are engraved as headless grace notes
* if "split", the note is split rhythmically at the control
points
* if "none", control points are ignored
* **consider_non_extrema_control_points** -- if true, we
consider all gliss control points in the engraving process. If
false, we only consider local extrema (i.e. points where the
gliss changes direction).
* **include_end_grace_note** -- if true, the final pitch reached
is expressed as a gliss up to a headless grace note.
* **inner_grace_relevance_threshold** -- this threshold helps
determine which gliss control points are worth expressing in
notation. The further a control point is from its neighbors,
and the further it deviates from the linearly interpolated
pitch at that point, the higher its relevance score. The
relevance score must be above this threshold to show up.
* **max_inner_graces_music_xml** -- integer (probably 1) capping
the number of inner grace notes between notes of a glissando
that we put in when outputting music xml. (Most programs can't
even handle 1 appropriately, but there's nothing inherently
unclear about including more in the XML.)
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "factory_d | Returns a factory default version of this settings object. |
| efault"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load"() | Loads and instance of this settings object from its corresponding JSON file. |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "make_pers | Rewrites the JSON file from which settings are loaded, meaning that this reset will |
| istent"() | persist to the running of scripts in the future. |
+------------+--------------------------------------------------------------------------------------------+
| "open_json | Open the JSON file for these settings. |
| _file"(*co | |
| mmand_and_ | |
| flags) | |
+------------+--------------------------------------------------------------------------------------------+
| "restore_f | Restores settings back to their "factory defaults" (the defaults when SCAMP was |
| actory_def | installed). |
| aults"([pe | |
| rsist]) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "consider_ | |
| non_extrem | |
| a_control_ | |
| points" | |
+------------+--------------------------------------------------------------------------------------------+
| "control_p | |
| oint_polic | |
| y" | |
+------------+--------------------------------------------------------------------------------------------+
| "include_e | |
| nd_grace_n | |
| ote" | |
+------------+--------------------------------------------------------------------------------------------+
| "inner_gra | |
| ce_relevan | |
| ce_thresho | |
| ld" | |
+------------+--------------------------------------------------------------------------------------------+
| "max_inner | |
| _graces_mu | |
| sic_xml" | |
+------------+--------------------------------------------------------------------------------------------+
| "slur_glis | |
| ses" | |
+------------+--------------------------------------------------------------------------------------------+
control_point_policy: str = 'split'
consider_non_extrema_control_points: bool = True
include_end_grace_note: bool = True
inner_grace_relevance_threshold: float = 1.5
max_inner_graces_music_xml: int = 1
slur_glisses: bool = True
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
classmethod factory_default()
Returns a factory default version of this settings object.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load()
Loads and instance of this settings object from its
corresponding JSON file. If no such file exists, or it is
corrupted in some way, then this creates a fresh JSON file
there. This doesn't work with settings that are nested within
other settings (like GlissandiSettings), since they do not have
corresponding JSON files,
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
make_persistent() -> None
Rewrites the JSON file from which settings are loaded, meaning
that this reset will persist to the running of scripts in the
future.
open_json_file(*command_and_flags)
Open the JSON file for these settings.
Parameters:
**command_and_flags** -- the command-line tool with which to
open the file, and any associated flags. Defaults to a
platform-specific generic open command.
restore_factory_defaults(persist=False) -> None
Restores settings back to their "factory defaults" (the defaults
when SCAMP was installed). Unless the *persist* argument is set,
this is temporary to the running of the current script.
Parameters:
**persist** -- if True, rewrites the JSON file from which
defaults are loaded, meaning that this reset will persist to
the running of scripts in the future.
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.settings.PlaybackSettings.txt
======================================================================
scamp.settings.PlaybackSettings
*******************************
class scamp.settings.PlaybackSettings(named_soundfonts: dict = <factory>, soundfont_search_paths: list = <factory>, default_soundfont: str = 'general_midi', default_audio_driver: str | None = <factory>, default_max_soundfont_pitch_bend: int = 48, default_max_streaming_midi_pitch_bend: int = 2, soundfont_volume_to_velocity_curve: Envelope = <factory>, streaming_midi_volume_to_velocity_curve: Envelope = <factory>, osc_message_addresses: dict = <factory>, adjustments: dict = <factory>, try_system_fluidsynth_first: bool = <factory>, use_bundled_pyfluidsynth: bool = True, resize_parameter_envelopes: str = 'lists', animation_tick_interval: float = 0.02, recording_file_path: str | None = None, recording_time_range: list = <factory>)
Bases: "_ScampSettings"
Namespace containing the settings relevant to playback
implementation and adjustments.
Parameters:
**settings_dict** -- dictionary from which to set all settings
attributes
Variables:
* **named_soundfonts** -- Dictionary mapping names of
frequently-used soundfonts to their file paths
* **default_soundfont** -- Soundfont (by name or path) to
default to in playback
* **default_audio_driver** -- Name of the audio driver use for
soundfont playback by default. If "auto", we test to see what
audio driver will work, and replace this value with that
driver.
* **default_max_soundfont_pitch_bend** -- When playing back with
soundfonts, instruments will be immediately set to use this
value for the maximum pitch bend. (Makes sense to set this to
a large value for maximum flexibility)
* **default_max_streaming_midi_pitch_bend** -- When playing back
with a midi stream to an external synthesizer/program,
instruments will be immediately set to use this value for the
maximum pitch bend. (Makes sense probably to leave this at the
MIDI default of 2 semitones, in case the receiving device
doesn't listen to messages that reset the pitch bend range.)
* **soundfont_volume_to_velocity_curve** -- an "Envelope"
defining how volume values get mapped to MIDI velocities in
soundfont-based playback. The default maps the range 0-1 to
the range 0-127, but with some non-linear shaping towards
higher velocity values. This is because, for some reason,
soundfont playback is almost inaudible low velocities.
* **streaming_midi_volume_to_velocity_curve** -- same as
"soundfont_volume_to_velocity_curve", but for streaming MIDI
playback. This defaults to a linear mapping from 0-1 to 0-127.
* **osc_message_addresses** -- Dictionary mapping the different
kinds of playback messages to the OSC messages prefixes we
will use for them. For instance, if you want start note
messages to use "note_on", set the
osc_message_addresses["start_note"] = "note_on", and all OSC
messages starting a note will come out as [instrument
name]/note_on/
* **adjustments** -- a dictionary defining how playback should
be altered in response to different
articulations/notations/etc.
* **try_system_fluidsynth_first** -- if True, always tries the
system copy of the libfluidsynth shared library first before
falling back to the one embedded in the scamp package.
Defaults to True on Linux (where a package-managed fluidsynth
is usually better integrated with the host audio stack) and
False on Mac/Windows.
* **use_bundled_pyfluidsynth** -- if True (the default
everywhere), use scamp's bundled copy of the pyfluidsynth
Python wrapper. The bundled wrapper can dlopen either the
system or the bundled libfluidsynth (controlled by
"try_system_fluidsynth_first"). Set to False to use a
separately-installed pyfluidsynth pip package instead.
* **resize_parameter_envelopes** -- one of "never", "lists", and
"always". This determines whether or not parameter envelopes
are resized to the length of the note. The default value of
"lists" does this resizing only when the envelope was created
indirectly by passing a list to the parameter.
* **animation_tick_interval** -- how often, in seconds, active
parameter animations (glissandi, volume swells, other animated
playback parameters) are sampled and applied to playback. A
single tick per clock family drives all concurrent animations,
so this is the one knob trading smoothness against overhead.
Note that it does not affect notation, which is reconstructed
from the exact envelopes regardless.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "get_playb | The playback adjustment currently applied to notes carrying the given property, or None if |
| ack_adjust | there is none. |
| ment"(note | |
| _property) | |
+------------+--------------------------------------------------------------------------------------------+
| "list_name | Prints out a list of all of the named soundfonts and the paths of the soundfont files to |
| d_soundfon | which they point. |
| ts"() | |
+------------+--------------------------------------------------------------------------------------------+
| "register_ | Adds a named soundfont, so that it can be easily referred to in constructing a Session |
| named_soun | |
| dfont"(nam | |
| e, soundfo | |
| nt_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_playb | Set the playback adjustment applied to every note carrying a given property, e.g. making |
| ack_adjust | all notes marked "staccato" play back shorter. |
| ment"(note | |
| _property, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "unregiste | Same as above, but removes a named soundfont |
| r_named_so | |
| undfont"(n | |
| ame) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "factory_d | Returns a factory default version of this settings object. |
| efault"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load"() | Loads and instance of this settings object from its corresponding JSON file. |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "make_pers | Rewrites the JSON file from which settings are loaded, meaning that this reset will |
| istent"() | persist to the running of scripts in the future. |
+------------+--------------------------------------------------------------------------------------------+
| "open_json | Open the JSON file for these settings. |
| _file"(*co | |
| mmand_and_ | |
| flags) | |
+------------+--------------------------------------------------------------------------------------------+
| "restore_f | Restores settings back to their "factory defaults" (the defaults when SCAMP was |
| actory_def | installed). |
| aults"([pe | |
| rsist]) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "animation | |
| _tick_inte | |
| rval" | |
+------------+--------------------------------------------------------------------------------------------+
| "default_m | |
| ax_soundfo | |
| nt_pitch_b | |
| end" | |
+------------+--------------------------------------------------------------------------------------------+
| "default_m | |
| ax_streami | |
| ng_midi_pi | |
| tch_bend" | |
+------------+--------------------------------------------------------------------------------------------+
| "default_s | |
| oundfont" | |
+------------+--------------------------------------------------------------------------------------------+
| "recording | |
| _file_path | |
| " | |
+------------+--------------------------------------------------------------------------------------------+
| "resize_pa | |
| rameter_en | |
| velopes" | |
+------------+--------------------------------------------------------------------------------------------+
| "use_bundl | |
| ed_pyfluid | |
| synth" | |
+------------+--------------------------------------------------------------------------------------------+
| "named_sou | |
| ndfonts" | |
+------------+--------------------------------------------------------------------------------------------+
| "soundfont | |
| _search_pa | |
| ths" | |
+------------+--------------------------------------------------------------------------------------------+
| "default_a | |
| udio_drive | |
| r" | |
+------------+--------------------------------------------------------------------------------------------+
| "soundfont | |
| _volume_to | |
| _velocity_ | |
| curve" | |
+------------+--------------------------------------------------------------------------------------------+
| "streaming | |
| _midi_volu | |
| me_to_velo | |
| city_curve | |
| " | |
+------------+--------------------------------------------------------------------------------------------+
| "osc_messa | |
| ge_address | |
| es" | |
+------------+--------------------------------------------------------------------------------------------+
| "adjustmen | |
| ts" | |
+------------+--------------------------------------------------------------------------------------------+
| "try_syste | |
| m_fluidsyn | |
| th_first" | |
+------------+--------------------------------------------------------------------------------------------+
| "recording | |
| _time_rang | |
| e" | |
+------------+--------------------------------------------------------------------------------------------+
named_soundfonts: dict
soundfont_search_paths: list
default_soundfont: str = 'general_midi'
default_audio_driver: str | None
default_max_soundfont_pitch_bend: int = 48
default_max_streaming_midi_pitch_bend: int = 2
soundfont_volume_to_velocity_curve: Envelope
streaming_midi_volume_to_velocity_curve: Envelope
osc_message_addresses: dict
adjustments: dict
try_system_fluidsynth_first: bool
use_bundled_pyfluidsynth: bool = True
resize_parameter_envelopes: str = 'lists'
animation_tick_interval: float = 0.02
recording_file_path: str | None = None
recording_time_range: list
register_named_soundfont(name: str, soundfont_path: str) -> None
Adds a named soundfont, so that it can be easily referred to in
constructing a Session
Parameters:
* **name** -- the soundfont name
* **soundfont_path** -- the absolute path to the soundfont,
staring with a slash, or a relative path that gets resolved
relative to the soundfonts directory
unregister_named_soundfont(name: str) -> None
Same as above, but removes a named soundfont
Parameters:
**name** -- the default soundfont name to remove
list_named_soundfonts() -> None
Prints out a list of all of the named soundfonts and the paths
of the soundfont files to which they point.
set_playback_adjustment(note_property: str, adjustment: str | NotePlaybackAdjustment)
Set the playback adjustment applied to every note carrying a
given property, e.g. making all notes marked "staccato" play
back shorter.
Parameters:
* **note_property** -- the note property to attach the
adjustment to, e.g. "articulation: staccato". (A bare value
like "staccato" is also understood, its category being
inferred.)
* **adjustment** -- the adjustment to apply, either a
"NotePlaybackAdjustment" or a string to be parsed into one,
e.g. "length * 0.5"
get_playback_adjustment(note_property: str)
The playback adjustment currently applied to notes carrying the
given property, or None if there is none.
Parameters:
**note_property** -- the note property in question, e.g.
"articulation: staccato"
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
classmethod factory_default()
Returns a factory default version of this settings object.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load()
Loads and instance of this settings object from its
corresponding JSON file. If no such file exists, or it is
corrupted in some way, then this creates a fresh JSON file
there. This doesn't work with settings that are nested within
other settings (like GlissandiSettings), since they do not have
corresponding JSON files,
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
make_persistent() -> None
Rewrites the JSON file from which settings are loaded, meaning
that this reset will persist to the running of scripts in the
future.
open_json_file(*command_and_flags)
Open the JSON file for these settings.
Parameters:
**command_and_flags** -- the command-line tool with which to
open the file, and any associated flags. Defaults to a
platform-specific generic open command.
restore_factory_defaults(persist=False) -> None
Restores settings back to their "factory defaults" (the defaults
when SCAMP was installed). Unless the *persist* argument is set,
this is temporary to the running of the current script.
Parameters:
**persist** -- if True, rewrites the JSON file from which
defaults are loaded, meaning that this reset will persist to
the running of scripts in the future.
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.settings.QuantizationSettings.txt
======================================================================
scamp.settings.QuantizationSettings
***********************************
class scamp.settings.QuantizationSettings(onset_weighting: float = 1.0, termination_weighting: float = 0.5, inner_split_weighting: float = 0.75, max_divisor: int = 8, max_divisor_indigestibility: float | None = None, simplicity_preference: float = 2.0, default_time_signature: str = '4/4')
Bases: "_ScampSettings"
Namespace containing the settings relevant to the quantization of
Performances in preparation for Score creation.
Parameters:
**settings_dict** -- dictionary from which to set all settings
attributes
Variables:
* **onset_weighting** -- float representing how much note start
times are weighted compared with note end times and tie split
points in determining how beats are divided. (All that matters
is the relative size of the values.)
* **termination_weighting** -- float representing how much note
end times are weighted compared with note start times and tie
split points in determining how beats are divided. (All that
matters is the relative size of the values.)
* **inner_split_weighting** -- float representing how much tie
split points are weighted compared with note end times and
note start times in determining how beats are divided. (All
that matters is the relative size of the values.)
* **max_divisor** -- int representing the default maximum
divisor allowed for a beat
* **max_divisor_indigestibility** -- float representing the
default cap on the indigestibility of beat divisors. (See
"BeatQuantizationScheme")
* **simplicity_preference** -- float representing the default
degree of preference for simple beat divisors. (See
"BeatQuantizationScheme")
* **default_time_signature** -- string (e.g. "4/4") representing
the default time signature to use when one is not specified.
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "factory_d | Returns a factory default version of this settings object. |
| efault"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load"() | Loads and instance of this settings object from its corresponding JSON file. |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "make_pers | Rewrites the JSON file from which settings are loaded, meaning that this reset will |
| istent"() | persist to the running of scripts in the future. |
+------------+--------------------------------------------------------------------------------------------+
| "open_json | Open the JSON file for these settings. |
| _file"(*co | |
| mmand_and_ | |
| flags) | |
+------------+--------------------------------------------------------------------------------------------+
| "restore_f | Restores settings back to their "factory defaults" (the defaults when SCAMP was |
| actory_def | installed). |
| aults"([pe | |
| rsist]) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "default_t | |
| ime_signat | |
| ure" | |
+------------+--------------------------------------------------------------------------------------------+
| "inner_spl | |
| it_weighti | |
| ng" | |
+------------+--------------------------------------------------------------------------------------------+
| "max_divis | |
| or" | |
+------------+--------------------------------------------------------------------------------------------+
| "max_divis | |
| or_indiges | |
| tibility" | |
+------------+--------------------------------------------------------------------------------------------+
| "onset_wei | |
| ghting" | |
+------------+--------------------------------------------------------------------------------------------+
| "simplicit | |
| y_preferen | |
| ce" | |
+------------+--------------------------------------------------------------------------------------------+
| "terminati | |
| on_weighti | |
| ng" | |
+------------+--------------------------------------------------------------------------------------------+
onset_weighting: float = 1.0
termination_weighting: float = 0.5
inner_split_weighting: float = 0.75
max_divisor: int = 8
max_divisor_indigestibility: float | None = None
simplicity_preference: float = 2.0
default_time_signature: str = '4/4'
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
classmethod factory_default()
Returns a factory default version of this settings object.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load()
Loads and instance of this settings object from its
corresponding JSON file. If no such file exists, or it is
corrupted in some way, then this creates a fresh JSON file
there. This doesn't work with settings that are nested within
other settings (like GlissandiSettings), since they do not have
corresponding JSON files,
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
make_persistent() -> None
Rewrites the JSON file from which settings are loaded, meaning
that this reset will persist to the running of scripts in the
future.
open_json_file(*command_and_flags)
Open the JSON file for these settings.
Parameters:
**command_and_flags** -- the command-line tool with which to
open the file, and any associated flags. Defaults to a
platform-specific generic open command.
restore_factory_defaults(persist=False) -> None
Restores settings back to their "factory defaults" (the defaults
when SCAMP was installed). Unless the *persist* argument is set,
this is temporary to the running of the current script.
Parameters:
**persist** -- if True, rewrites the JSON file from which
defaults are loaded, meaning that this reset will persist to
the running of scripts in the future.
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.settings.TempoSettings.txt
======================================================================
scamp.settings.TempoSettings
****************************
class scamp.settings.TempoSettings(guide_mark_resolution: float = 0.125, guide_mark_sensitivity: float = 0.08, include_guide_marks: bool = False, parenthesize_guide_marks: bool = True)
Bases: "_ScampSettings"
Namespace containing the settings relevant to the engraving of
tempo changes.
Parameters:
**settings_dict** -- dictionary from which to set all settings
attributes
Variables:
* **guide_mark_resolution** -- grid that the guide marks are
snapped to, in beats. Actual appearance of a guide mark
depends on *guide_mark_sensitivity*.
* **guide_mark_sensitivity** -- guide_mark_sensitivity
represents how much a tempo has to change proportionally to
put a guide mark. For instance, if it's 0.1 and the last
notated tempo was 60, we'll put a guide mark when the tempo
reaches 60 +/- 0.1 * 60 = 54 or 66.
* **include_guide_marks** -- Whether or not to include tempo
guide marks, i.e. marks showing the tempo at points in between
explicit tempo targets.
* **parenthesize_guide_marks** -- Whether or not to place tempo
guide marks in parentheses.
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "factory_d | Returns a factory default version of this settings object. |
| efault"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load"() | Loads and instance of this settings object from its corresponding JSON file. |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "make_pers | Rewrites the JSON file from which settings are loaded, meaning that this reset will |
| istent"() | persist to the running of scripts in the future. |
+------------+--------------------------------------------------------------------------------------------+
| "open_json | Open the JSON file for these settings. |
| _file"(*co | |
| mmand_and_ | |
| flags) | |
+------------+--------------------------------------------------------------------------------------------+
| "restore_f | Restores settings back to their "factory defaults" (the defaults when SCAMP was |
| actory_def | installed). |
| aults"([pe | |
| rsist]) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "guide_mar | |
| k_resoluti | |
| on" | |
+------------+--------------------------------------------------------------------------------------------+
| "guide_mar | |
| k_sensitiv | |
| ity" | |
+------------+--------------------------------------------------------------------------------------------+
| "include_g | |
| uide_marks | |
| " | |
+------------+--------------------------------------------------------------------------------------------+
| "parenthes | |
| ize_guide_ | |
| marks" | |
+------------+--------------------------------------------------------------------------------------------+
guide_mark_resolution: float = 0.125
guide_mark_sensitivity: float = 0.08
include_guide_marks: bool = False
parenthesize_guide_marks: bool = True
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
classmethod factory_default()
Returns a factory default version of this settings object.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load()
Loads and instance of this settings object from its
corresponding JSON file. If no such file exists, or it is
corrupted in some way, then this creates a fresh JSON file
there. This doesn't work with settings that are nested within
other settings (like GlissandiSettings), since they do not have
corresponding JSON files,
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
make_persistent() -> None
Rewrites the JSON file from which settings are loaded, meaning
that this reset will persist to the running of scripts in the
future.
open_json_file(*command_and_flags)
Open the JSON file for these settings.
Parameters:
**command_and_flags** -- the command-line tool with which to
open the file, and any associated flags. Defaults to a
platform-specific generic open command.
restore_factory_defaults(persist=False) -> None
Restores settings back to their "factory defaults" (the defaults
when SCAMP was installed). Unless the *persist* argument is set,
this is temporary to the running of the current script.
Parameters:
**persist** -- if True, rewrites the JSON file from which
defaults are loaded, meaning that this reset will persist to
the running of scripts in the future.
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.settings.restore_all_factory_defaults.txt
======================================================================
scamp.settings.restore_all_factory_defaults
*******************************************
scamp.settings.restore_all_factory_defaults(persist: bool = False) -> None
Restores all settings back to their "factory defaults" (the
defaults when SCAMP was installed). Unless the *persist* argument
is set, this is temporary to the running of the current script.
Parameters:
**persist** -- if True, rewrites the JSON files from which
defaults are loaded, meaning that this reset will persist to the
running of scripts in the future.
======================================================================
=== FILE: scamp/scamp.settings.txt
======================================================================
scamp.settings
**************
Module containing the main settings classes: "PlaybackSettings",
"QuantizationSettings", and "EngravingSettings", as well as
"TempoSettings" and "GlissandiSettings", which are part of
"EngravingSettings". A module-level instance for each
("playback_settings", "quantization_settings", and
"engraving_settings") is loaded from JSON configuration files within
within the settings directory of the scamp package. These instances
are part of the global scamp namespace, and contain scamp's default
configuration.
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "Engraving | Namespace containing the settings relevant to the engraving of scores. |
| Settings"( | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "Glissandi | Namespace containing the settings relevant to the engraving of glissandi. |
| Settings"( | |
| [control_p | |
| oint_polic | |
| y, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "PlaybackS | Namespace containing the settings relevant to playback implementation and adjustments. |
| ettings"(n | |
| amed_sound | |
| fonts, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "Quantizat | Namespace containing the settings relevant to the quantization of Performances in |
| ionSetting | preparation for Score creation. |
| s"([onset_ | |
| weighting, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "TempoSett | Namespace containing the settings relevant to the engraving of tempo changes. |
| ings"([gui | |
| de_mark_re | |
| solution, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.settings.EngravingSettings
* "EngravingSettings"
* "EngravingSettings.allow_duple_tuplets_in_compound_time"
* "EngravingSettings.max_voices_per_staff"
* "EngravingSettings.pitch_order_voices_within_measure"
* "EngravingSettings.max_dots_allowed"
* "EngravingSettings.beat_hierarchy_spacing"
* "EngravingSettings.num_divisions_penalty"
* "EngravingSettings.rest_beat_hierarchy_spacing"
* "EngravingSettings.rest_num_divisions_penalty"
* "EngravingSettings.articulation_split_protocols"
* "EngravingSettings.notation_split_protocols"
* "EngravingSettings.clefs_by_instrument"
* "EngravingSettings.clef_pitch_centers"
* "EngravingSettings.clef_selection_policy"
* "EngravingSettings.default_titles"
* "EngravingSettings.default_composers"
* "EngravingSettings.default_spelling_policy"
* "EngravingSettings.ignore_empty_parts"
* "EngravingSettings.glissandi"
* "EngravingSettings.tempo"
* "EngravingSettings.pad_incomplete_parts"
* "EngravingSettings.music_xml_open_command"
* "EngravingSettings.show_microtonal_annotations"
* "EngravingSettings.microtonal_annotation_digits"
* "EngravingSettings.export_note_velocities_to_xml"
* "EngravingSettings.lilypond_dir"
* "EngravingSettings.lilypond_search_paths"
* "EngravingSettings.max_voices_per_part"
* "EngravingSettings.set_music_xml_application()"
* "EngravingSettings.get_default_title()"
* "EngravingSettings.get_default_composer()"
* "EngravingSettings.duplicate()"
* "EngravingSettings.factory_default()"
* "EngravingSettings.json_dumps()"
* "EngravingSettings.json_loads()"
* "EngravingSettings.load()"
* "EngravingSettings.load_from_json()"
* "EngravingSettings.make_persistent()"
* "EngravingSettings.open_json_file()"
* "EngravingSettings.restore_factory_defaults()"
* "EngravingSettings.save_to_json()"
* scamp.settings.GlissandiSettings
* "GlissandiSettings"
* "GlissandiSettings.control_point_policy"
* "GlissandiSettings.consider_non_extrema_control_points"
* "GlissandiSettings.include_end_grace_note"
* "GlissandiSettings.inner_grace_relevance_threshold"
* "GlissandiSettings.max_inner_graces_music_xml"
* "GlissandiSettings.slur_glisses"
* "GlissandiSettings.duplicate()"
* "GlissandiSettings.factory_default()"
* "GlissandiSettings.json_dumps()"
* "GlissandiSettings.json_loads()"
* "GlissandiSettings.load()"
* "GlissandiSettings.load_from_json()"
* "GlissandiSettings.make_persistent()"
* "GlissandiSettings.open_json_file()"
* "GlissandiSettings.restore_factory_defaults()"
* "GlissandiSettings.save_to_json()"
* scamp.settings.PlaybackSettings
* "PlaybackSettings"
* "PlaybackSettings.named_soundfonts"
* "PlaybackSettings.soundfont_search_paths"
* "PlaybackSettings.default_soundfont"
* "PlaybackSettings.default_audio_driver"
* "PlaybackSettings.default_max_soundfont_pitch_bend"
* "PlaybackSettings.default_max_streaming_midi_pitch_bend"
* "PlaybackSettings.soundfont_volume_to_velocity_curve"
* "PlaybackSettings.streaming_midi_volume_to_velocity_curve"
* "PlaybackSettings.osc_message_addresses"
* "PlaybackSettings.adjustments"
* "PlaybackSettings.try_system_fluidsynth_first"
* "PlaybackSettings.use_bundled_pyfluidsynth"
* "PlaybackSettings.resize_parameter_envelopes"
* "PlaybackSettings.animation_tick_interval"
* "PlaybackSettings.recording_file_path"
* "PlaybackSettings.recording_time_range"
* "PlaybackSettings.register_named_soundfont()"
* "PlaybackSettings.unregister_named_soundfont()"
* "PlaybackSettings.list_named_soundfonts()"
* "PlaybackSettings.set_playback_adjustment()"
* "PlaybackSettings.get_playback_adjustment()"
* "PlaybackSettings.duplicate()"
* "PlaybackSettings.factory_default()"
* "PlaybackSettings.json_dumps()"
* "PlaybackSettings.json_loads()"
* "PlaybackSettings.load()"
* "PlaybackSettings.load_from_json()"
* "PlaybackSettings.make_persistent()"
* "PlaybackSettings.open_json_file()"
* "PlaybackSettings.restore_factory_defaults()"
* "PlaybackSettings.save_to_json()"
* scamp.settings.QuantizationSettings
* "QuantizationSettings"
* "QuantizationSettings.onset_weighting"
* "QuantizationSettings.termination_weighting"
* "QuantizationSettings.inner_split_weighting"
* "QuantizationSettings.max_divisor"
* "QuantizationSettings.max_divisor_indigestibility"
* "QuantizationSettings.simplicity_preference"
* "QuantizationSettings.default_time_signature"
* "QuantizationSettings.duplicate()"
* "QuantizationSettings.factory_default()"
* "QuantizationSettings.json_dumps()"
* "QuantizationSettings.json_loads()"
* "QuantizationSettings.load()"
* "QuantizationSettings.load_from_json()"
* "QuantizationSettings.make_persistent()"
* "QuantizationSettings.open_json_file()"
* "QuantizationSettings.restore_factory_defaults()"
* "QuantizationSettings.save_to_json()"
* scamp.settings.TempoSettings
* "TempoSettings"
* "TempoSettings.guide_mark_resolution"
* "TempoSettings.guide_mark_sensitivity"
* "TempoSettings.include_guide_marks"
* "TempoSettings.parenthesize_guide_marks"
* "TempoSettings.duplicate()"
* "TempoSettings.factory_default()"
* "TempoSettings.json_dumps()"
* "TempoSettings.json_loads()"
* "TempoSettings.load()"
* "TempoSettings.load_from_json()"
* "TempoSettings.make_persistent()"
* "TempoSettings.open_json_file()"
* "TempoSettings.restore_factory_defaults()"
* "TempoSettings.save_to_json()"
-[ Functions ]-
+------------+--------------------------------------------------------------------------------------------+
| "restore_a | Restores all settings back to their "factory defaults" (the defaults when SCAMP was |
| ll_factory | installed). |
| _defaults" | |
| ([persist] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.settings.restore_all_factory_defaults
* "restore_all_factory_defaults()"
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "playback_ | Instance of "PlaybackSettings" containing the actual playback defaults to be consulted |
| settings" | |
+------------+--------------------------------------------------------------------------------------------+
| "quantizat | Instance of "QuantizationSettings" containing the actual quantization defaults to be |
| ion_settin | consulted |
| gs" | |
+------------+--------------------------------------------------------------------------------------------+
| "engraving | Instance of "EngravingSettings" containing the actual engraving defaults to be consulted |
| _settings" | |
+------------+--------------------------------------------------------------------------------------------+
======================================================================
=== FILE: scamp/scamp.spanners.ChangePedal.txt
======================================================================
scamp.spanners.ChangePedal
**************************
class scamp.spanners.ChangePedal(label: Any = 0, **formatting)
Bases: "Spanner"
Change piano pedal spanner.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Formatting can consist of
{"placement": "above"/"below", "line": True/False, "sign":
True/False}.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'mid'
FORMATTING_SLOTS = {'line', 'placement', 'sign'}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.Spanner.txt
======================================================================
scamp.spanners.Spanner
**********************
class scamp.spanners.Spanner(label: Any = 0, **formatting)
Bases: "ABC", "SavesToJSON", "NoteProperty"
Base class for all spanner notations, i.e. notations that cover
more than one note.
Parameters:
* **label** -- Each spanner can have a label that distinguishes
it from other spanners of the same type. For example, consider
the sequence of: start slur, start slur, stop slur, stop slur.
Is this a small slur inside of a large one, or two
interlocking slurs. The label clarifies. In practice, this is
only really functional in musicXML export, where it is
converted to a number.
* **formatting** -- Each spanner has various types of
individually specific formatting, such as a trill accidental
or bracket text. This is passed along in a dictionary, and
largely follows formatting from the MusicXML standard.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = NotImplemented
FORMATTING_SLOTS = NotImplemented
abstractmethod to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
abstractmethod to_abjad()
Converts this to an abjad indicator.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StartBracket.txt
======================================================================
scamp.spanners.StartBracket
***************************
class scamp.spanners.StartBracket(label: Any = 0, **formatting)
Bases: "Spanner"
Start bracket spanner (e.g. a text bracket with a hook).
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Formatting can consist of
{"placement": "above"/"below", "text": [string], "line_end":
"up"/"down"/"both"/"arrow"/"none", "line_type":
"solid"/"dashed"/"dotted"/"wavy"}
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'start'
FORMATTING_SLOTS = {'line_end', 'line_type', 'placement', 'text'}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StartDashes.txt
======================================================================
scamp.spanners.StartDashes
**************************
class scamp.spanners.StartDashes(label: Any = 0, **formatting)
Bases: "Spanner"
Start dashes spanner.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Formatting can consist of
{"placement": "above"/"below", "text": [string],
"dash_length": [number of pixels], "space_length": [number of
pixels]}
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement. |
| _direction | |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'start'
FORMATTING_SLOTS = {'dash_length', 'placement', 'space_length', 'text'}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StartHairpin.txt
======================================================================
scamp.spanners.StartHairpin
***************************
class scamp.spanners.StartHairpin(label: Any = 0, **formatting)
Bases: "Spanner"
Start hairpin spanner.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Formatting can consist of
{"placement": "above"/"below", "hairpin_type":
"crescendo"/"diminuendo", "niente": True/False}
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'start'
FORMATTING_SLOTS = {'hairpin_type', 'niente', 'placement'}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StartPedal.txt
======================================================================
scamp.spanners.StartPedal
*************************
class scamp.spanners.StartPedal(label: Any = 0, **formatting)
Bases: "Spanner"
Start piano pedal spanner.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Formatting can consist of
{"placement": "above"/"below", "line": True/False, "sign":
True/False}. Line and sign control whether or not the pedal is
done with "Ped./*" markings, brackets, or a mixture of both.
Note that this only works for MusicXML output. For lilypond
output, you will need manually add a formatting block that
declares which style is being used globally.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'start'
FORMATTING_SLOTS = {'line', 'placement', 'sign'}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StartPhrasingSlur.txt
======================================================================
scamp.spanners.StartPhrasingSlur
********************************
class scamp.spanners.StartPhrasingSlur(label: Any = 0, **formatting)
Bases: "Spanner"
Phrasing slurs are an additional type of slur available in LilyPond
useful for creating long, overarching slurs that can have smaller,
regular slurs inside of them. In MusicXML export, no distinction is
made here: instead phrasing slurs are just rendered as slurs,
albeit slurs that are kept from interfering with other slurs via a
unique label. Basically, just use regular slurs for articulation
and phrasing slurs for longer phrasing and don't worry about those
details, and it'll work out fine.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Doesn't take any special
formatting.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'start'
FORMATTING_SLOTS = {}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StartSlur.txt
======================================================================
scamp.spanners.StartSlur
************************
class scamp.spanners.StartSlur(label: Any = 0, **formatting)
Bases: "Spanner"
Start slur spanner type.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Doesn't take any special
formatting.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'start'
FORMATTING_SLOTS = {}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StartTrill.txt
======================================================================
scamp.spanners.StartTrill
*************************
class scamp.spanners.StartTrill(label: Any = 0, **formatting)
Bases: "Spanner"
Start trill spanner.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Formatting can consist of
{"placement": "above"/"below", "accidental": "flat-
flat"/"flat"/"natural"/"sharp"/"double-sharp" }
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'start'
FORMATTING_SLOTS = {'accidental', 'placement'}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StopBracket.txt
======================================================================
scamp.spanners.StopBracket
**************************
class scamp.spanners.StopBracket(label: Any = 0, **formatting)
Bases: "Spanner"
Stop bracket spanner.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Formatting can consist of
{"placement": "above"/"below", "text": [string], "line_end":
"up"/"down"/"both"/"arrow"/"none", "line_type":
"solid"/"dashed"/"dotted"/"wavy"}
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'stop'
FORMATTING_SLOTS = {'line_end', 'placement', 'text'}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StopDashes.txt
======================================================================
scamp.spanners.StopDashes
*************************
class scamp.spanners.StopDashes(label: Any = 0, **formatting)
Bases: "Spanner"
Stop dashes spanner.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Formatting can consist of
{"placement": "above"/"below", "text": [string]}
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'stop'
FORMATTING_SLOTS = {'placement', 'text'}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StopHairpin.txt
======================================================================
scamp.spanners.StopHairpin
**************************
class scamp.spanners.StopHairpin(label: Any = 0, **formatting)
Bases: "Spanner"
Stop hairpin spanner.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Formatting can consist of
{"placement": "above"/"below", "hairpin_type":
"crescendo"/"diminuendo", "niente": True/False}
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'stop'
FORMATTING_SLOTS = {'hairpin_type', 'niente', 'placement'}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StopPedal.txt
======================================================================
scamp.spanners.StopPedal
************************
class scamp.spanners.StopPedal(label: Any = 0, **formatting)
Bases: "Spanner"
Stop piano pedal spanner.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Formatting can consist of
{"placement": "above"/"below", "line": True/False, "sign":
True/False}.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'stop'
FORMATTING_SLOTS = {'line', 'placement', 'sign'}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StopPhrasingSlur.txt
======================================================================
scamp.spanners.StopPhrasingSlur
*******************************
class scamp.spanners.StopPhrasingSlur(label: Any = 0, **formatting)
Bases: "Spanner"
Stop spanner for a phrasing slur. See "StartPhrasingSlur".
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Doesn't take any special
formatting.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'stop'
FORMATTING_SLOTS = {}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StopSlur.txt
======================================================================
scamp.spanners.StopSlur
***********************
class scamp.spanners.StopSlur(label: Any = 0, **formatting)
Bases: "Spanner"
Stop slur spanner type.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Doesn't take any special
formatting.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'stop'
FORMATTING_SLOTS = {}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.StopTrill.txt
======================================================================
scamp.spanners.StopTrill
************************
class scamp.spanners.StopTrill(label: Any = 0, **formatting)
Bases: "Spanner"
Stop trill spanner.
Parameters:
* **label** -- See "Spanner".
* **formatting** -- See "Spanner". Formatting can consist of
{"placement": "above"/"below"}
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad indicator. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml spanner type (or None if it has no note-attached MusicXML |
| cxml"() | form). |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_abjad | The abjad direction (up/down) corresponding to this spanner's placement, or None if no |
| _direction | placement was specified, leaving the choice to LilyPond. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "FORMATTIN | |
| G_SLOTS" | |
+------------+--------------------------------------------------------------------------------------------+
| "START_MID | |
| _OR_STOP" | |
+------------+--------------------------------------------------------------------------------------------+
START_MID_OR_STOP = 'stop'
FORMATTING_SLOTS = {'placement'}
to_pymusicxml()
Converts this to a pymusicxml spanner type (or None if it has no
note-attached MusicXML form).
to_abjad()
Converts this to an abjad indicator.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
get_abjad_direction()
The abjad direction (up/down) corresponding to this spanner's
placement, or None if no placement was specified, leaving the
choice to LilyPond.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spanners.txt
======================================================================
scamp.spanners
**************
Module containing start and stop spanner objects in SCAMP, such as
"StartHairpin", "StopHairpin", "StartSlur" and "StopSlur". These are
notations that belong to a range of notes rather that a single note.
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "ChangePed | Change piano pedal spanner. |
| al"([label | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Spanner"( | Base class for all spanner notations, i.e. notations that cover more than one note. |
| [label]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartBrac | Start bracket spanner (e.g. a text bracket with a hook). |
| ket"([labe | |
| l]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartDash | Start dashes spanner. |
| es"([label | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartHair | Start hairpin spanner. |
| pin"([labe | |
| l]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartPeda | Start piano pedal spanner. |
| l"([label] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartPhra | Phrasing slurs are an additional type of slur available in LilyPond useful for creating |
| singSlur"( | long, overarching slurs that can have smaller, regular slurs inside of them. |
| [label]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartSlur | Start slur spanner type. |
| "([label]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartTril | Start trill spanner. |
| l"([label] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopBrack | Stop bracket spanner. |
| et"([label | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopDashe | Stop dashes spanner. |
| s"([label] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopHairp | Stop hairpin spanner. |
| in"([label | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopPedal | Stop piano pedal spanner. |
| "([label]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopPhras | Stop spanner for a phrasing slur. |
| ingSlur"([ | |
| label]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopSlur" | Stop slur spanner type. |
| ([label]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopTrill | Stop trill spanner. |
| "([label]) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.spanners.ChangePedal
* "ChangePedal"
* "ChangePedal.START_MID_OR_STOP"
* "ChangePedal.FORMATTING_SLOTS"
* "ChangePedal.to_pymusicxml()"
* "ChangePedal.to_abjad()"
* "ChangePedal.duplicate()"
* "ChangePedal.get_abjad_direction()"
* "ChangePedal.json_dumps()"
* "ChangePedal.json_loads()"
* "ChangePedal.load_from_json()"
* "ChangePedal.save_to_json()"
* scamp.spanners.Spanner
* "Spanner"
* "Spanner.START_MID_OR_STOP"
* "Spanner.FORMATTING_SLOTS"
* "Spanner.to_pymusicxml()"
* "Spanner.to_abjad()"
* "Spanner.get_abjad_direction()"
* "Spanner.duplicate()"
* "Spanner.json_dumps()"
* "Spanner.json_loads()"
* "Spanner.load_from_json()"
* "Spanner.save_to_json()"
* scamp.spanners.StartBracket
* "StartBracket"
* "StartBracket.START_MID_OR_STOP"
* "StartBracket.FORMATTING_SLOTS"
* "StartBracket.to_pymusicxml()"
* "StartBracket.to_abjad()"
* "StartBracket.duplicate()"
* "StartBracket.get_abjad_direction()"
* "StartBracket.json_dumps()"
* "StartBracket.json_loads()"
* "StartBracket.load_from_json()"
* "StartBracket.save_to_json()"
* scamp.spanners.StartDashes
* "StartDashes"
* "StartDashes.START_MID_OR_STOP"
* "StartDashes.FORMATTING_SLOTS"
* "StartDashes.to_pymusicxml()"
* "StartDashes.to_abjad()"
* "StartDashes.get_abjad_direction()"
* "StartDashes.duplicate()"
* "StartDashes.json_dumps()"
* "StartDashes.json_loads()"
* "StartDashes.load_from_json()"
* "StartDashes.save_to_json()"
* scamp.spanners.StartHairpin
* "StartHairpin"
* "StartHairpin.START_MID_OR_STOP"
* "StartHairpin.FORMATTING_SLOTS"
* "StartHairpin.to_pymusicxml()"
* "StartHairpin.to_abjad()"
* "StartHairpin.duplicate()"
* "StartHairpin.get_abjad_direction()"
* "StartHairpin.json_dumps()"
* "StartHairpin.json_loads()"
* "StartHairpin.load_from_json()"
* "StartHairpin.save_to_json()"
* scamp.spanners.StartPedal
* "StartPedal"
* "StartPedal.START_MID_OR_STOP"
* "StartPedal.FORMATTING_SLOTS"
* "StartPedal.to_pymusicxml()"
* "StartPedal.to_abjad()"
* "StartPedal.duplicate()"
* "StartPedal.get_abjad_direction()"
* "StartPedal.json_dumps()"
* "StartPedal.json_loads()"
* "StartPedal.load_from_json()"
* "StartPedal.save_to_json()"
* scamp.spanners.StartPhrasingSlur
* "StartPhrasingSlur"
* "StartPhrasingSlur.START_MID_OR_STOP"
* "StartPhrasingSlur.FORMATTING_SLOTS"
* "StartPhrasingSlur.to_pymusicxml()"
* "StartPhrasingSlur.to_abjad()"
* "StartPhrasingSlur.duplicate()"
* "StartPhrasingSlur.get_abjad_direction()"
* "StartPhrasingSlur.json_dumps()"
* "StartPhrasingSlur.json_loads()"
* "StartPhrasingSlur.load_from_json()"
* "StartPhrasingSlur.save_to_json()"
* scamp.spanners.StartSlur
* "StartSlur"
* "StartSlur.START_MID_OR_STOP"
* "StartSlur.FORMATTING_SLOTS"
* "StartSlur.to_pymusicxml()"
* "StartSlur.to_abjad()"
* "StartSlur.duplicate()"
* "StartSlur.get_abjad_direction()"
* "StartSlur.json_dumps()"
* "StartSlur.json_loads()"
* "StartSlur.load_from_json()"
* "StartSlur.save_to_json()"
* scamp.spanners.StartTrill
* "StartTrill"
* "StartTrill.START_MID_OR_STOP"
* "StartTrill.FORMATTING_SLOTS"
* "StartTrill.to_pymusicxml()"
* "StartTrill.to_abjad()"
* "StartTrill.duplicate()"
* "StartTrill.get_abjad_direction()"
* "StartTrill.json_dumps()"
* "StartTrill.json_loads()"
* "StartTrill.load_from_json()"
* "StartTrill.save_to_json()"
* scamp.spanners.StopBracket
* "StopBracket"
* "StopBracket.START_MID_OR_STOP"
* "StopBracket.FORMATTING_SLOTS"
* "StopBracket.to_pymusicxml()"
* "StopBracket.to_abjad()"
* "StopBracket.duplicate()"
* "StopBracket.get_abjad_direction()"
* "StopBracket.json_dumps()"
* "StopBracket.json_loads()"
* "StopBracket.load_from_json()"
* "StopBracket.save_to_json()"
* scamp.spanners.StopDashes
* "StopDashes"
* "StopDashes.START_MID_OR_STOP"
* "StopDashes.FORMATTING_SLOTS"
* "StopDashes.to_pymusicxml()"
* "StopDashes.to_abjad()"
* "StopDashes.duplicate()"
* "StopDashes.get_abjad_direction()"
* "StopDashes.json_dumps()"
* "StopDashes.json_loads()"
* "StopDashes.load_from_json()"
* "StopDashes.save_to_json()"
* scamp.spanners.StopHairpin
* "StopHairpin"
* "StopHairpin.START_MID_OR_STOP"
* "StopHairpin.FORMATTING_SLOTS"
* "StopHairpin.to_pymusicxml()"
* "StopHairpin.to_abjad()"
* "StopHairpin.duplicate()"
* "StopHairpin.get_abjad_direction()"
* "StopHairpin.json_dumps()"
* "StopHairpin.json_loads()"
* "StopHairpin.load_from_json()"
* "StopHairpin.save_to_json()"
* scamp.spanners.StopPedal
* "StopPedal"
* "StopPedal.START_MID_OR_STOP"
* "StopPedal.FORMATTING_SLOTS"
* "StopPedal.to_pymusicxml()"
* "StopPedal.to_abjad()"
* "StopPedal.duplicate()"
* "StopPedal.get_abjad_direction()"
* "StopPedal.json_dumps()"
* "StopPedal.json_loads()"
* "StopPedal.load_from_json()"
* "StopPedal.save_to_json()"
* scamp.spanners.StopPhrasingSlur
* "StopPhrasingSlur"
* "StopPhrasingSlur.START_MID_OR_STOP"
* "StopPhrasingSlur.FORMATTING_SLOTS"
* "StopPhrasingSlur.to_pymusicxml()"
* "StopPhrasingSlur.to_abjad()"
* "StopPhrasingSlur.duplicate()"
* "StopPhrasingSlur.get_abjad_direction()"
* "StopPhrasingSlur.json_dumps()"
* "StopPhrasingSlur.json_loads()"
* "StopPhrasingSlur.load_from_json()"
* "StopPhrasingSlur.save_to_json()"
* scamp.spanners.StopSlur
* "StopSlur"
* "StopSlur.START_MID_OR_STOP"
* "StopSlur.FORMATTING_SLOTS"
* "StopSlur.to_pymusicxml()"
* "StopSlur.to_abjad()"
* "StopSlur.duplicate()"
* "StopSlur.get_abjad_direction()"
* "StopSlur.json_dumps()"
* "StopSlur.json_loads()"
* "StopSlur.load_from_json()"
* "StopSlur.save_to_json()"
* scamp.spanners.StopTrill
* "StopTrill"
* "StopTrill.START_MID_OR_STOP"
* "StopTrill.FORMATTING_SLOTS"
* "StopTrill.to_pymusicxml()"
* "StopTrill.to_abjad()"
* "StopTrill.duplicate()"
* "StopTrill.get_abjad_direction()"
* "StopTrill.json_dumps()"
* "StopTrill.json_loads()"
* "StopTrill.load_from_json()"
* "StopTrill.save_to_json()"
======================================================================
=== FILE: scamp/scamp.spelling.SpellingPolicy.txt
======================================================================
scamp.spelling.SpellingPolicy
*****************************
class scamp.spelling.SpellingPolicy(step_alteration_pairs: Sequence[tuple[int, int]] = ((0, 0), (0, 1), (1, 0), (2, -1), (2, 0), (3, 0), (3, 1), (4, 0), (5, -1), (5, 0), (6, -1), (6, 0)))
Bases: "SavesToJSON", "NoteProperty"
Object that translates pitches or pitch classes to the actual
spelling used in a score
Parameters:
**step_alteration_pairs** -- a list of 12 (step, alteration)
tuples showing how to spell each pitch class. The step
corresponds to the letter-name of the note, and the alteration
to its accidental. So (3, -1) represents an E-flat.
Variables:
**step_alteration_pairs** -- list of 12 (step, alteration)
tuples showing how to spell each pitch class.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "all_flats | Constructs a flats-only SpellingPolicy |
| "([includi | |
| ng_white_k | |
| eys]) | |
+------------+--------------------------------------------------------------------------------------------+
| "all_sharp | Constructs a sharps-only SpellingPolicy |
| s"([includ | |
| ing_white_ | |
| keys]) | |
+------------+--------------------------------------------------------------------------------------------+
| "from_circ | Constructs a spelling policy by transposing a template around the circles of fifths |
| le_of_fift | |
| hs_positio | |
| n"(...[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "from_stri | Constructs a SpellingPolicy from several possible input string formats |
| ng"(string | |
| _initializ | |
| er) | |
+------------+--------------------------------------------------------------------------------------------+
| "interpret | Interpret an object of unknown type as a SpellingPolicy |
| "(obj) | |
+------------+--------------------------------------------------------------------------------------------+
| "resolve_a | Convert a given MIDI pitch to an abjad NamedPitch according to this SpellingPolicy |
| bjad_pitch | |
| "(midi_num | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "resolve_m | Convert a given MIDI pitch to an abjad pymusicxml Pitch object according to this |
| usic_xml_p | SpellingPolicy |
| itch"(midi | |
| _num) | |
+------------+--------------------------------------------------------------------------------------------+
| "resolve_n | For a given pitch, determine its name, octave and alteration under this SpellingPolicy. |
| ame_octave | |
| _and_alter | |
| ation"(mid | |
| i_num) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
classmethod all_sharps(including_white_keys: bool = False) -> SpellingPolicy
Constructs a sharps-only SpellingPolicy
Parameters:
**including_white_keys** -- if True, even white keys like D
will be spelled as C-double-sharp
classmethod all_flats(including_white_keys: bool = False) -> SpellingPolicy
Constructs a flats-only SpellingPolicy
Parameters:
**including_white_keys** -- if True, even white keys like D
will be spelled as E-double-flat
classmethod from_circle_of_fifths_position(num_sharps_or_flats: int, avoid_double_accidentals: bool = False, template: Sequence[tuple[int, int]] = ((0, 0), (0, 1), (1, 0), (2, -1), (2, 0), (3, 0), (3, 1), (4, 0), (5, -1), (5, 0), (6, -1), (6, 0))) -> SpellingPolicy
Constructs a spelling policy by transposing a template around
the circles of fifths
Parameters:
* **num_sharps_or_flats** -- how many steps sharp or flat to
transpose around the circle of fifths. For instance, if set
to 4, our tonic is E, and if set to -3, our tonic is Eb
* **avoid_double_accidentals** -- if true, replaces double
sharps and flats with simpler spelling
* **template** -- by default, uses sharp-2, flat-3, sharp-4,
flat-6, and flat-7
classmethod from_string(string_initializer: str) -> SpellingPolicy
Constructs a SpellingPolicy from several possible input string
formats
Parameters:
**string_initializer** -- one of the following: - a key
center (case insensitive), such as "C#" or "f" or "Gb" - a
key center followed by a mode, such as "g minor" or "Bb
locrian". Most modes to not alter the way spelling is done,
but certain modes like phrygian and locrian do. - "flat"/"b"
or "sharp"/"#", indicating that any note, even a white key,
is to be expressed with the specified accidental. Most useful
for spelling known individual notes - "flats"/"sharps"
indicating that black keys will be spelled with the specified
accidental, but white keys will remain unaltered. (Turns out
"flats" is equivalent to "Bb" and "sharps" is equivalent to
"A".)
classmethod interpret(obj: SpellingPolicy | str | tuple) -> SpellingPolicy
Interpret an object of unknown type as a SpellingPolicy
Parameters:
**obj** -- an object to interpret as a SpellingPolicy;
accepts SpellingPolicy, string, or tuple of alterations
Returns:
a SpellingPolicy
resolve_name_octave_and_alteration(midi_num: int) -> tuple[str, int, int]
For a given pitch, determine its name, octave and alteration
under this SpellingPolicy.
Parameters:
**midi_num** -- a MIDI pitch value
Returns:
a tuple of (name, octave, alteration)
resolve_abjad_pitch(midi_num: int) -> abjad.NamedPitch
Convert a given MIDI pitch to an abjad NamedPitch according to
this SpellingPolicy
Parameters:
**midi_num** -- a MIDI pitch value
resolve_music_xml_pitch(midi_num: int) -> Pitch
Convert a given MIDI pitch to an abjad pymusicxml Pitch object
according to this SpellingPolicy
Parameters:
**midi_num** -- a MIDI pitch value
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.spelling.txt
======================================================================
scamp.spelling
**************
Module containing the "SpellingPolicy" class, which describes how
pitches should be spelled.
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "SpellingP | Object that translates pitches or pitch classes to the actual spelling used in a score |
| olicy"([st | |
| ep_alterat | |
| ion_pairs] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.spelling.SpellingPolicy
* "SpellingPolicy"
* "SpellingPolicy.all_sharps()"
* "SpellingPolicy.all_flats()"
* "SpellingPolicy.from_circle_of_fifths_position()"
* "SpellingPolicy.from_string()"
* "SpellingPolicy.interpret()"
* "SpellingPolicy.resolve_name_octave_and_alteration()"
* "SpellingPolicy.resolve_abjad_pitch()"
* "SpellingPolicy.resolve_music_xml_pitch()"
* "SpellingPolicy.duplicate()"
* "SpellingPolicy.json_dumps()"
* "SpellingPolicy.json_loads()"
* "SpellingPolicy.load_from_json()"
* "SpellingPolicy.save_to_json()"
======================================================================
=== FILE: scamp/scamp.test_run.play.txt
======================================================================
scamp.test_run.play
*******************
scamp.test_run.play(show_lilypond: bool = False, show_xml: bool = False) -> None
Simple method for determining if scamp was installed correctly.
Should play a sequence of pitches telescoping towards middle C.
Parameters:
* **show_lilypond** -- shows a PDF LilyPond rendering of demo
played (requires abjad package).
* **show_xml** -- opens up a MusicXML rendering of the music
played
======================================================================
=== FILE: scamp/scamp.test_run.txt
======================================================================
scamp.test_run
**************
Simple module with a "play()" function that can be used to verify that
SCAMP is installed successfully.
-[ Functions ]-
+------------+--------------------------------------------------------------------------------------------+
| "play"([sh | Simple method for determining if scamp was installed correctly. |
| ow_lilypon | |
| d, | |
| show_xml]) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.test_run.play
* "play()"
======================================================================
=== FILE: scamp/scamp.text.StaffText.txt
======================================================================
scamp.text.StaffText
********************
class scamp.text.StaffText(text: str, italic: bool = False, bold: bool = False, placement: str = 'above')
Bases: "SavesToJSON", "NoteProperty"
Represents text that will be attached to the staff at a given note.
Place this object in the fourth *properties* argument of
"play_note()", either alone, or under the "text" key.
Parameters:
* **text** -- the text to display
* **italic** -- whether or not to make text italic
* **bold** -- whether or not to make text bold
* **placement** -- placement relative to the staff; either
"above" of "below"
Variables:
* **text** -- the text to display
* **italic** -- whether or not to make text italic
* **bold** -- whether or not to make text bold
* **placement** -- placement relative to the staff; either
"above" of "below"
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "from_stri | Interprets a string as a staff text. |
| ng"(string | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "to_abjad" | Converts this to an abjad Markup object. |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "to_pymusi | Converts this to a pymusicxml TextAnnotation object. |
| cxml"() | |
+------------+--------------------------------------------------------------------------------------------+
-[ Inherited Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "duplicate | Returns a copy of this object by serializing to and from JSON. |
| "() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_dump | Dump this object as a JSON string. |
| s"() | |
+------------+--------------------------------------------------------------------------------------------+
| "json_load | Load this object from a JSON string. |
| s"(s) | |
+------------+--------------------------------------------------------------------------------------------+
| "load_from | Load this object from a JSON file with the given path. |
| _json"(fil | |
| e_path) | |
+------------+--------------------------------------------------------------------------------------------+
| "save_to_j | Save this object to a JSON file using the given path. |
| son"(file_ | |
| path) | |
+------------+--------------------------------------------------------------------------------------------+
classmethod from_string(string: str)
Interprets a string as a staff text. For now, it just looks for
1, 2, or 3 leading and trailing asterisks or underscores to make
the whole text italic, bold or bold-italic respectively. (This
only works on the whole text.)
Parameters:
**string** -- the text, possible with leading and trailing
asterisks/underscores
to_pymusicxml() -> TextAnnotation
Converts this to a pymusicxml TextAnnotation object.
to_abjad() -> abjad.Markup
Converts this to an abjad Markup object.
duplicate() -> T
Returns a copy of this object by serializing to and from JSON.
json_dumps() -> str
Dump this object as a JSON string. This uses a custom encoder
that recognizes and appropriately converts any attributes that
are object inheriting from SavesToJSON.
classmethod json_loads(s: str) -> T
Load this object from a JSON string. This uses a custom decoder
that looks for a "_type" key in any object/dictionary being
parsed and converts it to the class specified (assuming it a
subclass of SavesToJSON).
Parameters:
**s** -- a string representing this object in JSON format
classmethod load_from_json(file_path: str) -> T
Load this object from a JSON file with the given path. This uses
a custom decoder that looks for a "_type" key in any
object/dictionary being parsed and converts it to the class
specified (assuming it a subclass of SavesToJSON).
Parameters:
**file_path** -- path for loading the file
save_to_json(file_path: str) -> None
Save this object to a JSON file using the given path. This uses
a custom encoder that recognizes and appropriately converts any
attributes that are object inheriting from SavesToJSON.
Parameters:
**file_path** -- path for saving the file
======================================================================
=== FILE: scamp/scamp.text.txt
======================================================================
scamp.text
**********
Module containing utilities for representing text in SCAMP, currently
containing the "StaffText" class.
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "StaffText | Represents text that will be attached to the staff at a given note. |
| "(text[, | |
| italic, | |
| bold, plac | |
| ement]) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.text.StaffText
* "StaffText"
* "StaffText.from_string()"
* "StaffText.to_pymusicxml()"
* "StaffText.to_abjad()"
* "StaffText.duplicate()"
* "StaffText.json_dumps()"
* "StaffText.json_loads()"
* "StaffText.load_from_json()"
* "StaffText.save_to_json()"
======================================================================
=== FILE: scamp/scamp.transcriber.Transcriber.txt
======================================================================
scamp.transcriber.Transcriber
*****************************
class scamp.transcriber.Transcriber
Bases: "object"
Class responsible for transcribing notes played by instruments into
a "Performance". It is possible to run multiple transcriptions
simultaneously, for instance starting at different times, recording
different instruments, or recording relative to different clocks.
-[ Methods ]-
+------------+--------------------------------------------------------------------------------------------+
| "is_transc | Checks if any transcriptions are in progress. |
| ribing"() | |
+------------+--------------------------------------------------------------------------------------------+
| "register_ | Called when an instrument wants to register that it finished a note, records note in all |
| note"(inst | transcriptions |
| rument, | |
| note_info) | |
+------------+--------------------------------------------------------------------------------------------+
| "start_tra | Starts transcribing new performance on the given clock, consisting of the given instrument |
| nscribing" | |
| (...[, | |
| units]) | |
+------------+--------------------------------------------------------------------------------------------+
| "stop_tran | Stops transcribing a Performance and returns it. |
| scribing"( | |
| [which_per | |
| formance, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
-[ Attributes ]-
+------------+--------------------------------------------------------------------------------------------+
| "transcrip | Tuple of all current transcriptions. |
| tions_in_p | |
| rogress" | |
+------------+--------------------------------------------------------------------------------------------+
property transcriptions_in_progress: tuple[Performance]
Tuple of all current transcriptions.
is_transcribing() -> bool
Checks if any transcriptions are in progress.
start_transcribing(instrument_or_instruments: ScampInstrument | Sequence[ScampInstrument], clock: Clock, units: str = 'beats') -> Performance
Starts transcribing new performance on the given clock,
consisting of the given instrument
Parameters:
* **instrument_or_instruments** -- the instruments we notate
in this Performance
* **clock** -- which clock all timings are relative to
* **units** -- one of ["beats", "time"]. Do we use the beats
of the clock or the time?
Returns:
the Performance that this transcription writes to, which will
be updated as notes are played and acts as a handle when
calling stop_transcribing.
register_note(instrument: ScampInstrument, note_info: dict) -> None
Called when an instrument wants to register that it finished a
note, records note in all transcriptions
Parameters:
* **instrument** -- the ScampInstrument that played the note
* **note_info** -- the note info dictionary on that note,
containing time stamps, parameter changes, etc.
stop_transcribing(which_performance=None, tempo_envelope_tolerance=0.001) -> Performance
Stops transcribing a Performance and returns it. Defaults to the
oldest started performance, unless otherwise specified.
Parameters:
* **which_performance** -- which performance to stop
transcribing; defaults to oldest started
* **tempo_envelope_tolerance** -- error tolerance when
extracting the absolute tempo envelope for the Performance
Returns:
the created Performance
======================================================================
=== FILE: scamp/scamp.transcriber.txt
======================================================================
scamp.transcriber
*****************
Module containing the "Transcriber" class which records the playback
of a group of "ScampInstrument" objects to create a "Performance"
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "Transcrib | Class responsible for transcribing notes played by instruments into a "Performance". |
| er"() | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.transcriber.Transcriber
* "Transcriber"
* "Transcriber.transcriptions_in_progress"
* "Transcriber.is_transcribing()"
* "Transcriber.start_transcribing()"
* "Transcriber.register_note()"
* "Transcriber.stop_transcribing()"
======================================================================
=== FILE: scamp/scamp.utilities.NoteProperty.txt
======================================================================
scamp.utilities.NoteProperty
****************************
class scamp.utilities.NoteProperty
Bases: "object"
Parent class for class for classes like "SpellingPolicy",
"StaffText" and "NotePlaybackAdjustment", which can be passed to
the properties argument of "play_note()".
======================================================================
=== FILE: scamp/scamp.utilities.ceil_to_multiple.txt
======================================================================
scamp.utilities.ceil_to_multiple
********************************
scamp.utilities.ceil_to_multiple(x, factor)
Returns the multiple of factor that is closest above x. The first
argument can optionally be a list, tuple, or iterator, in which
case this is performed on each element.
======================================================================
=== FILE: scamp/scamp.utilities.ceil_x_to_pow_of_y.txt
======================================================================
scamp.utilities.ceil_x_to_pow_of_y
**********************************
scamp.utilities.ceil_x_to_pow_of_y(x, y)
Returns the integer power of y that is closest above x. The first
argument can optionally be a list, tuple, or iterator, in which
case this is performed on each element.
======================================================================
=== FILE: scamp/scamp.utilities.first_run_notice.txt
======================================================================
scamp.utilities.first_run_notice
********************************
scamp.utilities.first_run_notice(msg: str) -> None
Print a reassuring "this is normal on first run" message to stderr,
in green if stderr is a TTY. Used for the lilypond / audio-driver /
template-install discovery steps so the user sees them as expected
setup, not warnings.
======================================================================
=== FILE: scamp/scamp.utilities.floor_to_multiple.txt
======================================================================
scamp.utilities.floor_to_multiple
*********************************
scamp.utilities.floor_to_multiple(x, factor)
Returns the multiple of factor that is closest below x. The first
argument can optionally be a list, tuple, or iterator, in which
case this is performed on each element.
======================================================================
=== FILE: scamp/scamp.utilities.floor_x_to_pow_of_y.txt
======================================================================
scamp.utilities.floor_x_to_pow_of_y
***********************************
scamp.utilities.floor_x_to_pow_of_y(x, y)
Returns the integer power of y that is closest below x. The first
argument can optionally be a list, tuple, or iterator, in which
case this is performed on each element.
======================================================================
=== FILE: scamp/scamp.utilities.get_average_square_correlation.txt
======================================================================
scamp.utilities.get_average_square_correlation
**********************************************
scamp.utilities.get_average_square_correlation(test_string: str, template_string: str) -> float
A test of the similarity of two strings via a (squared) cross-
correlation of their characters. (Scaled down to compensate for the
influence of string lengths.)
Parameters:
* **test_string** -- string we are testing
* **template_string** -- template string we are testing against
======================================================================
=== FILE: scamp/scamp.utilities.get_standard_indispensability_array.txt
======================================================================
scamp.utilities.get_standard_indispensability_array
***************************************************
scamp.utilities.get_standard_indispensability_array(rhythmic_strata: Sequence, normalize: bool = False) -> list[int_or_float]
Returns a list of the indispensabilities of different pulses in a
meter defined by the rhythmic_strata. (See Barlow's "On
Musiquantics", http://clarlow.org/wp-content/uploads/2016/10/On-
MusiquanticsA4.pdf)
Parameters:
* **rhythmic_strata** -- a tuple representing the rhythmic
groupings from large scale to small scale. For instance, the
sixteenth-note pulses in a measure of 9/8 would be represented
by (3, 3, 2), since there are three beats of three eighth
notes, each of which has two sixteenth notes.
* **normalize** -- if True, scale all indispensabilities to the
range 0 to 1
Returns:
a list of integer indispensabilities, or float if normalize is
set to true
======================================================================
=== FILE: scamp/scamp.utilities.indigestibility.txt
======================================================================
scamp.utilities.indigestibility
*******************************
scamp.utilities.indigestibility(n: int) -> float
Returns the indigestibility of a number per the theories of
Clarence Barlow. (See "On Musiquantics", http://clarlow.org/wp-
content/uploads/2016/10/On-MusiquanticsA4.pdf)
======================================================================
=== FILE: scamp/scamp.utilities.is_after.txt
======================================================================
scamp.utilities.is_after
************************
scamp.utilities.is_after(a: float, b: float, tolerance: float = 1e-10) -> bool
True if beat "a" falls meaningfully after beat "b" (mirror of
"is_before()").
======================================================================
=== FILE: scamp/scamp.utilities.is_before.txt
======================================================================
scamp.utilities.is_before
*************************
scamp.utilities.is_before(a: float, b: float, tolerance: float = 1e-10) -> bool
True if beat *a* falls meaningfully before beat *b* — i.e. *a < b*
by more than *tolerance*, not merely by reconstruction noise.
======================================================================
=== FILE: scamp/scamp.utilities.is_multiple.txt
======================================================================
scamp.utilities.is_multiple
***************************
scamp.utilities.is_multiple(x, y) -> bool
Checks if x is a multiple of y.
======================================================================
=== FILE: scamp/scamp.utilities.is_prime.txt
======================================================================
scamp.utilities.is_prime
************************
scamp.utilities.is_prime(a: int) -> bool
Checks if a is a prime number.
======================================================================
=== FILE: scamp/scamp.utilities.is_x_pow_of_y.txt
======================================================================
scamp.utilities.is_x_pow_of_y
*****************************
scamp.utilities.is_x_pow_of_y(x, y) -> bool
Checks if x is an integer (including negative) power of y
======================================================================
=== FILE: scamp/scamp.utilities.iterate_all_subclasses.txt
======================================================================
scamp.utilities.iterate_all_subclasses
**************************************
scamp.utilities.iterate_all_subclasses(type_name: Type) -> Iterator[Type]
Iterates all generations of subclasses of a type
======================================================================
=== FILE: scamp/scamp.utilities.make_flat_list.txt
======================================================================
scamp.utilities.make_flat_list
******************************
scamp.utilities.make_flat_list(l: Sequence, indivisible: Type | tuple[Type] = None) -> list
Flattens a list, including ones containing multiple levels of
nesting. Certain types can be excluded from expansion.
Parameters:
* **l** -- a list or similar iterable
* **indivisible** -- a type or tuple of types that should not be
expanded out. E.g. a custom named tuple
Returns:
a flattened version of the list
======================================================================
=== FILE: scamp/scamp.utilities.memoize.txt
======================================================================
scamp.utilities.memoize
***********************
scamp.utilities.memoize(obj: Callable) -> Callable
Decorator used for memoization (see
https://en.wikipedia.org/wiki/Memoization)
Parameters:
**obj** -- the function to be wrapped in a memoizer
Returns:
the wrapped, memoized function
======================================================================
=== FILE: scamp/scamp.utilities.prime_factor.txt
======================================================================
scamp.utilities.prime_factor
****************************
scamp.utilities.prime_factor(n: int) -> list[int]
Returns a list of the prime factors of n.
======================================================================
=== FILE: scamp/scamp.utilities.resolve_package_path.txt
======================================================================
scamp.utilities.resolve_package_path
************************************
scamp.utilities.resolve_package_path(path: str) -> str
Resolve a path given relative to the scamp package into an absolute
one, accounting for the fact that, in a PyInstaller-frozen
application, package data sits next to the executable instead.
Parameters:
**path** -- a path relative to the scamp package directory
======================================================================
=== FILE: scamp/scamp.utilities.resolve_path.txt
======================================================================
scamp.utilities.resolve_path
****************************
scamp.utilities.resolve_path(path: str) -> str
Resolves the given path based on a variety of prefixes.
Parameters:
**path** -- A path, possibly prefixed by "/", "~/", or "%PKG/".
A prefix of "/" will be interpreted as an absolute path, a
prefix of "~/" will be interpreted as relative to the user's
home directory, a prefix of "%PKG/" will be interpreted as
relative to the package source directory, and an unprefixed path
will be interpreted as relative to the current working
directory.
Returns:
the resolved path
======================================================================
=== FILE: scamp/scamp.utilities.rotate.txt
======================================================================
scamp.utilities.rotate
**********************
scamp.utilities.rotate(l: list, n: int) -> list
Rotates a list such that it starts at the nth index and loops back
to end at the (n-1)st
Parameters:
* **l** -- the input list
* **n** -- the new start index
Returns:
the rotated list
======================================================================
=== FILE: scamp/scamp.utilities.round_to_multiple.txt
======================================================================
scamp.utilities.round_to_multiple
*********************************
scamp.utilities.round_to_multiple(x, factor)
Returns the multiple of factor that is closest to x (above or
below). The first argument can optionally be a list, tuple, or
iterator, in which case this is performed on each element.
======================================================================
=== FILE: scamp/scamp.utilities.round_x_to_pow_of_y.txt
======================================================================
scamp.utilities.round_x_to_pow_of_y
***********************************
scamp.utilities.round_x_to_pow_of_y(x, y)
Returns the integer power of y that is closest to x (above or
below). The first argument can optionally be a list, tuple, or
iterator, in which case this is performed on each element.
======================================================================
=== FILE: scamp/scamp.utilities.sum_nested_list.txt
======================================================================
scamp.utilities.sum_nested_list
*******************************
scamp.utilities.sum_nested_list(l: list)
Sums up all of the values within a nested list. For instance
"sum_nested_list([6, [4, 2], [[-7]]])" will return 5
Parameters:
**l** -- the input list
Returns:
sum of the l's nested values
======================================================================
=== FILE: scamp/scamp.utilities.txt
======================================================================
scamp.utilities
***************
Various and sundry utility functions used by SCAMP.
-[ Classes ]-
+------------+--------------------------------------------------------------------------------------------+
| "NotePrope | Parent class for class for classes like "SpellingPolicy", "StaffText" and |
| rty"() | "NotePlaybackAdjustment", which can be passed to the properties argument of "play_note()". |
+------------+--------------------------------------------------------------------------------------------+
* scamp.utilities.NoteProperty
* "NoteProperty"
-[ Functions ]-
+------------+--------------------------------------------------------------------------------------------+
| "ceil_to_m | Returns the multiple of factor that is closest above x. |
| ultiple"(x | |
| , factor) | |
+------------+--------------------------------------------------------------------------------------------+
| "ceil_x_to | Returns the integer power of y that is closest above x. |
| _pow_of_y" | |
| (x, y) | |
+------------+--------------------------------------------------------------------------------------------+
| "first_run | Print a reassuring "this is normal on first run" message to stderr, in green if stderr is |
| _notice"(m | a TTY. |
| sg) | |
+------------+--------------------------------------------------------------------------------------------+
| "floor_to_ | Returns the multiple of factor that is closest below x. |
| multiple"( | |
| x, factor) | |
+------------+--------------------------------------------------------------------------------------------+
| "floor_x_t | Returns the integer power of y that is closest below x. |
| o_pow_of_y | |
| "(x, y) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_avera | A test of the similarity of two strings via a (squared) cross- correlation of their |
| ge_square_ | characters. |
| correlatio | |
| n"(test_st | |
| ring, ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_stand | Returns a list of the indispensabilities of different pulses in a meter defined by the |
| ard_indisp | rhythmic_strata. |
| ensability | |
| _array"(.. | |
| .[, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "indigesti | Returns the indigestibility of a number per the theories of Clarence Barlow. |
| bility"(n) | |
+------------+--------------------------------------------------------------------------------------------+
| "is_after" | True if beat "a" falls meaningfully after beat "b" (mirror of "is_before()"). |
| (a, b[, to | |
| lerance]) | |
+------------+--------------------------------------------------------------------------------------------+
| "is_before | True if beat *a* falls meaningfully before beat *b* — i.e. *a < b* by more than |
| "(a, b[, t | *tolerance*, not merely by reconstruction noise. |
| olerance]) | |
+------------+--------------------------------------------------------------------------------------------+
| "is_multip | Checks if x is a multiple of y. |
| le"(x, y) | |
+------------+--------------------------------------------------------------------------------------------+
| "is_prime" | Checks if a is a prime number. |
| (a) | |
+------------+--------------------------------------------------------------------------------------------+
| "is_x_pow_ | Checks if x is an integer (including negative) power of y |
| of_y"(x, | |
| y) | |
+------------+--------------------------------------------------------------------------------------------+
| "iterate_a | Iterates all generations of subclasses of a type |
| ll_subclas | |
| ses"(type_ | |
| name) | |
+------------+--------------------------------------------------------------------------------------------+
| "make_flat | Flattens a list, including ones containing multiple levels of nesting. |
| _list"(l[, | |
| indivisibl | |
| e]) | |
+------------+--------------------------------------------------------------------------------------------+
| "memoize"( | Decorator used for memoization (see https://en.wikipedia.org/wiki/Memoization) |
| obj) | |
+------------+--------------------------------------------------------------------------------------------+
| "prime_fac | Returns a list of the prime factors of n. |
| tor"(n) | |
+------------+--------------------------------------------------------------------------------------------+
| "resolve_p | Resolve a path given relative to the scamp package into an absolute one, accounting for |
| ackage_pat | the fact that, in a PyInstaller-frozen application, package data sits next to the |
| h"(path) | executable instead. |
+------------+--------------------------------------------------------------------------------------------+
| "resolve_p | Resolves the given path based on a variety of prefixes. |
| ath"(path) | |
+------------+--------------------------------------------------------------------------------------------+
| "rotate"(l | Rotates a list such that it starts at the nth index and loops back to end at the (n-1)st |
| , n) | |
+------------+--------------------------------------------------------------------------------------------+
| "round_to_ | Returns the multiple of factor that is closest to x (above or below). |
| multiple"( | |
| x, factor) | |
+------------+--------------------------------------------------------------------------------------------+
| "round_x_t | Returns the integer power of y that is closest to x (above or below). |
| o_pow_of_y | |
| "(x, y) | |
+------------+--------------------------------------------------------------------------------------------+
| "sum_neste | Sums up all of the values within a nested list. |
| d_list"(l) | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.utilities.ceil_to_multiple
* "ceil_to_multiple()"
* scamp.utilities.ceil_x_to_pow_of_y
* "ceil_x_to_pow_of_y()"
* scamp.utilities.first_run_notice
* "first_run_notice()"
* scamp.utilities.floor_to_multiple
* "floor_to_multiple()"
* scamp.utilities.floor_x_to_pow_of_y
* "floor_x_to_pow_of_y()"
* scamp.utilities.get_average_square_correlation
* "get_average_square_correlation()"
* scamp.utilities.get_standard_indispensability_array
* "get_standard_indispensability_array()"
* scamp.utilities.indigestibility
* "indigestibility()"
* scamp.utilities.is_after
* "is_after()"
* scamp.utilities.is_before
* "is_before()"
* scamp.utilities.is_multiple
* "is_multiple()"
* scamp.utilities.is_prime
* "is_prime()"
* scamp.utilities.is_x_pow_of_y
* "is_x_pow_of_y()"
* scamp.utilities.iterate_all_subclasses
* "iterate_all_subclasses()"
* scamp.utilities.make_flat_list
* "make_flat_list()"
* scamp.utilities.memoize
* "memoize()"
* scamp.utilities.prime_factor
* "prime_factor()"
* scamp.utilities.resolve_package_path
* "resolve_package_path()"
* scamp.utilities.resolve_path
* "resolve_path()"
* scamp.utilities.rotate
* "rotate()"
* scamp.utilities.round_to_multiple
* "round_to_multiple()"
* scamp.utilities.round_x_to_pow_of_y
* "round_x_to_pow_of_y()"
* scamp.utilities.sum_nested_list
* "sum_nested_list()"
======================================================================
=== FILE: scamp.txt
======================================================================
scamp package
*************
SCAMP: A Suite for Computer-Assisted Music in Python. SCAMP is an
computer-assisted composition framework in Python designed to act as a
hub, flexibly connecting the composer-programmer to a wide variety of
resources for playback and notation.
-[ Modules: ]-
+------------+--------------------------------------------------------------------------------------------+
| "instrumen | Module containing user-facing playback classes: "Ensemble", "ScampInstrument", and |
| ts" | "NoteHandle"/ "ChordHandle" |
+------------+--------------------------------------------------------------------------------------------+
| "note_prop | Module containing the NoteProperties object, which is a dictionary that stores a variety |
| erties" | of playback and notation options that affect a given note. |
+------------+--------------------------------------------------------------------------------------------+
| "performan | Module containing the "PerformanceNote", "PerformancePart", and "Performance" classes, |
| ce" | which represent transcriptions of notes played by a group of "ScampInstrument" objects. |
+------------+--------------------------------------------------------------------------------------------+
| "playback_ | Module containing classes for defining adjustments to the playback of note parameters, as |
| adjustment | well as the "PlaybackAdjustmentsDictionary", which defines how particular notations should |
| s" | be played back. |
+------------+--------------------------------------------------------------------------------------------+
| "playback_ | Module containing the abstract base class "PlaybackImplementation", as well as several of |
| implementa | its concrete subclasses: "SoundfontPlaybackImplementation", "MidiPlaybackImplementations", |
| tions" | and "OSCPlaybackImplementation". |
+------------+--------------------------------------------------------------------------------------------+
| "quantizat | Module containing classes and functions related to the quantization of performances. |
| ion" | |
+------------+--------------------------------------------------------------------------------------------+
| "score" | Module containing classes that deal with music notation. |
+------------+--------------------------------------------------------------------------------------------+
| "session" | Module containing the "Session" class, which is the central hub through which nearly all |
| | of SCAMP's functionality flows. |
+------------+--------------------------------------------------------------------------------------------+
| "settings" | Module containing the main settings classes: "PlaybackSettings", "QuantizationSettings", |
| | and "EngravingSettings", as well as "TempoSettings" and "GlissandiSettings", which are |
| | part of "EngravingSettings". |
+------------+--------------------------------------------------------------------------------------------+
| "spanners" | Module containing start and stop spanner objects in SCAMP, such as "StartHairpin", |
| | "StopHairpin", "StartSlur" and "StopSlur". |
+------------+--------------------------------------------------------------------------------------------+
| "spelling" | Module containing the "SpellingPolicy" class, which describes how pitches should be |
| | spelled. |
+------------+--------------------------------------------------------------------------------------------+
| "test_run" | Simple module with a "play()" function that can be used to verify that SCAMP is installed |
| | successfully. |
+------------+--------------------------------------------------------------------------------------------+
| "text" | Module containing utilities for representing text in SCAMP, currently containing the |
| | "StaffText" class. |
+------------+--------------------------------------------------------------------------------------------+
| "transcrib | Module containing the "Transcriber" class which records the playback of a group of |
| er" | "ScampInstrument" objects to create a "Performance" |
+------------+--------------------------------------------------------------------------------------------+
| "utilities | Various and sundry utility functions used by SCAMP. |
| " | |
+------------+--------------------------------------------------------------------------------------------+
* scamp.instruments
* scamp.instruments.ChordHandle
* "ChordHandle"
* "ChordHandle.change_parameter()"
* "ChordHandle.change_pitch()"
* "ChordHandle.change_volume()"
* "ChordHandle.split()"
* "ChordHandle.end()"
* scamp.instruments.Ensemble
* "Ensemble"
* "Ensemble.instruments"
* "Ensemble.add_instrument()"
* "Ensemble.pop_instrument()"
* "Ensemble.new_silent_part()"
* "Ensemble.new_part()"
* "Ensemble.new_midi_part()"
* "Ensemble.new_osc_part()"
* "Ensemble.get_instrument_by_name()"
* "Ensemble.print_default_soundfont_presets()"
* "Ensemble.get_available_midi_output_devices()"
* "Ensemble.print_available_midi_output_devices()"
* "Ensemble.default_spelling_policy"
* "Ensemble.duplicate()"
* "Ensemble.json_dumps()"
* "Ensemble.json_loads()"
* "Ensemble.load_from_json()"
* "Ensemble.save_to_json()"
* scamp.instruments.NoteHandle
* "NoteHandle"
* "NoteHandle.change_parameter()"
* "NoteHandle.change_pitch()"
* "NoteHandle.change_volume()"
* "NoteHandle.split()"
* "NoteHandle.end()"
* scamp.instruments.ScampInstrument
* "ScampInstrument"
* "ScampInstrument.set_ensemble()"
* "ScampInstrument.play_note()"
* "ScampInstrument.play_chord()"
* "ScampInstrument.start_note()"
* "ScampInstrument.start_chord()"
* "ScampInstrument.change_note_parameter()"
* "ScampInstrument.change_note_pitch()"
* "ScampInstrument.change_note_volume()"
* "ScampInstrument.split_note()"
* "ScampInstrument.end_note()"
* "ScampInstrument.end_all_notes()"
* "ScampInstrument.num_notes_playing()"
* "ScampInstrument.add_soundfont_playback()"
* "ScampInstrument.remove_soundfont_playback()"
* "ScampInstrument.add_streaming_midi_playback()"
* "ScampInstrument.remove_streaming_midi_playback()"
* "ScampInstrument.add_osc_playback()"
* "ScampInstrument.remove_osc_playback()"
* "ScampInstrument.set_max_pitch_bend()"
* "ScampInstrument.send_midi_cc()"
* "ScampInstrument.pedal_down()"
* "ScampInstrument.pedal_up()"
* "ScampInstrument.pedal_change()"
* "ScampInstrument.clef_preference"
* "ScampInstrument.resolve_clef_preference()"
* "ScampInstrument.default_spelling_policy"
* "ScampInstrument.note_info_by_id"
* "ScampInstrument.duplicate()"
* "ScampInstrument.json_dumps()"
* "ScampInstrument.json_loads()"
* "ScampInstrument.load_from_json()"
* "ScampInstrument.save_to_json()"
* scamp.note_properties
* scamp.note_properties.NoteProperties
* "NoteProperties"
* "NoteProperties.PROPERTY_TYPES"
* "NoteProperties.PROPERTY_TYPES_AS_DICT"
* "NoteProperties.interpret()"
* "NoteProperties.incorporate()"
* "NoteProperties.chord_mergeable_with()"
* "NoteProperties.apply_playback_adjustments()"
* "NoteProperties.get_spelling_policy()"
* "NoteProperties.get_midi_cc_params()"
* "NoteProperties.get_midi_cc_start_values()"
* "NoteProperties.get_extra_parameter_start_values()"
* "NoteProperties.duplicate()"
* "NoteProperties.json_dumps()"
* "NoteProperties.json_loads()"
* "NoteProperties.load_from_json()"
* "NoteProperties.save_to_json()"
* scamp.performance
* scamp.performance.Performance
* "Performance"
* "Performance.new_part()"
* "Performance.add_part()"
* "Performance.get_part_by_index()"
* "Performance.get_parts_by_name()"
* "Performance.get_parts_by_instrument()"
* "Performance.end_beat"
* "Performance.length()"
* "Performance.get_note_iterator()"
* "Performance.remap_to_tempo()"
* "Performance.play()"
* "Performance.set_instruments_from_ensemble()"
* "Performance.quantize()"
* "Performance.quantized()"
* "Performance.is_quantized()"
* "Performance.num_measures()"
* "Performance.export_to_midi_file()"
* "Performance.apply_note_filter()"
* "Performance.apply_pitch_filter()"
* "Performance.apply_volume_filter()"
* "Performance.duplicate()"
* "Performance.json_dumps()"
* "Performance.json_loads()"
* "Performance.load_from_json()"
* "Performance.save_to_json()"
* "Performance.to_score()"
* "Performance.transpose()"
* scamp.performance.PerformanceNote
* "PerformanceNote"
* "PerformanceNote.length_sum()"
* "PerformanceNote.end_beat"
* "PerformanceNote.average_pitch()"
* "PerformanceNote.play()"
* "PerformanceNote.next_id()"
* "PerformanceNote.split_at_beat()"
* "PerformanceNote.split_at_length_divisions()"
* "PerformanceNote.attempt_chord_merger_with()"
* "PerformanceNote.duplicate()"
* "PerformanceNote.json_dumps()"
* "PerformanceNote.json_loads()"
* "PerformanceNote.load_from_json()"
* "PerformanceNote.save_to_json()"
* scamp.performance.PerformancePart
* "PerformancePart"
* "PerformancePart.add_note()"
* "PerformancePart.new_note()"
* "PerformancePart.set_instrument()"
* "PerformancePart.end_beat"
* "PerformancePart.get_note_iterator()"
* "PerformancePart.play()"
* "PerformancePart.set_instrument_from_ensemble()"
* "PerformancePart.write_to_midi_file_track()"
* "PerformancePart.quantize()"
* "PerformancePart.quantized()"
* "PerformancePart.is_quantized()"
* "PerformancePart.measure_lengths"
* "PerformancePart.num_measures()"
* "PerformancePart.to_staff_group()"
* "PerformancePart.name_count()"
* "PerformancePart.apply_note_filter()"
* "PerformancePart.apply_pitch_filter()"
* "PerformancePart.apply_volume_filter()"
* "PerformancePart.duplicate()"
* "PerformancePart.json_dumps()"
* "PerformancePart.json_loads()"
* "PerformancePart.load_from_json()"
* "PerformancePart.save_to_json()"
* "PerformancePart.transpose()"
* scamp.playback_adjustments
* scamp.playback_adjustments.NotePlaybackAdjustment
* "NotePlaybackAdjustment"
* "NotePlaybackAdjustment.from_string()"
* "NotePlaybackAdjustment.scale_params()"
* "NotePlaybackAdjustment.add_to_params()"
* "NotePlaybackAdjustment.set_params()"
* "NotePlaybackAdjustment.adjust_parameters()"
* "NotePlaybackAdjustment.duplicate()"
* "NotePlaybackAdjustment.json_dumps()"
* "NotePlaybackAdjustment.json_loads()"
* "NotePlaybackAdjustment.load_from_json()"
* "NotePlaybackAdjustment.save_to_json()"
* scamp.playback_adjustments.ParamPlaybackAdjustment
* "ParamPlaybackAdjustment"
* "ParamPlaybackAdjustment.from_string()"
* "ParamPlaybackAdjustment.set_to()"
* "ParamPlaybackAdjustment.scale()"
* "ParamPlaybackAdjustment.add()"
* "ParamPlaybackAdjustment.adjust_value()"
* "ParamPlaybackAdjustment.uses_envelope()"
* "ParamPlaybackAdjustment.duplicate()"
* "ParamPlaybackAdjustment.json_dumps()"
* "ParamPlaybackAdjustment.json_loads()"
* "ParamPlaybackAdjustment.load_from_json()"
* "ParamPlaybackAdjustment.save_to_json()"
* scamp.playback_implementations
* scamp.playback_implementations.MIDIStreamPlaybackImplementation
* "MIDIStreamPlaybackImplementation"
* "MIDIStreamPlaybackImplementation.note_on()"
* "MIDIStreamPlaybackImplementation.note_off()"
* "MIDIStreamPlaybackImplementation.pitch_bend()"
* "MIDIStreamPlaybackImplementation.set_max_pitch_bend()"
* "MIDIStreamPlaybackImplementation.cc()"
* "MIDIStreamPlaybackImplementation.change_note_parameter()"
* "MIDIStreamPlaybackImplementation.change_note_pitch()"
* "MIDIStreamPlaybackImplementation.change_note_volume()"
* "MIDIStreamPlaybackImplementation.duplicate()"
* "MIDIStreamPlaybackImplementation.end_note()"
* "MIDIStreamPlaybackImplementation.json_dumps()"
* "MIDIStreamPlaybackImplementation.json_loads()"
* "MIDIStreamPlaybackImplementation.load_from_json()"
* "MIDIStreamPlaybackImplementation.save_to_json()"
* "MIDIStreamPlaybackImplementation.start_note()"
* "MIDIStreamPlaybackImplementation.volume_cc()"
* scamp.playback_implementations.OSCPlaybackImplementation
* "OSCPlaybackImplementation"
* "OSCPlaybackImplementation.start_note()"
* "OSCPlaybackImplementation.end_note()"
* "OSCPlaybackImplementation.change_note_pitch()"
* "OSCPlaybackImplementation.change_note_volume()"
* "OSCPlaybackImplementation.change_note_parameter()"
* "OSCPlaybackImplementation.set_max_pitch_bend()"
* "OSCPlaybackImplementation.duplicate()"
* "OSCPlaybackImplementation.json_dumps()"
* "OSCPlaybackImplementation.json_loads()"
* "OSCPlaybackImplementation.load_from_json()"
* "OSCPlaybackImplementation.save_to_json()"
* scamp.playback_implementations.PlaybackImplementation
* "PlaybackImplementation"
* "PlaybackImplementation.start_note()"
* "PlaybackImplementation.end_note()"
* "PlaybackImplementation.change_note_pitch()"
* "PlaybackImplementation.change_note_volume()"
* "PlaybackImplementation.change_note_parameter()"
* "PlaybackImplementation.set_max_pitch_bend()"
* "PlaybackImplementation.duplicate()"
* "PlaybackImplementation.json_dumps()"
* "PlaybackImplementation.json_loads()"
* "PlaybackImplementation.load_from_json()"
* "PlaybackImplementation.save_to_json()"
* scamp.playback_implementations.SoundfontPlaybackImplementation
* "SoundfontPlaybackImplementation"
* "SoundfontPlaybackImplementation.soundfont_hosts"
* "SoundfontPlaybackImplementation.note_on()"
* "SoundfontPlaybackImplementation.note_off()"
* "SoundfontPlaybackImplementation.pitch_bend()"
* "SoundfontPlaybackImplementation.set_max_pitch_bend()"
* "SoundfontPlaybackImplementation.cc()"
* "SoundfontPlaybackImplementation.change_note_parameter()"
* "SoundfontPlaybackImplementation.change_note_pitch()"
* "SoundfontPlaybackImplementation.change_note_volume()"
* "SoundfontPlaybackImplementation.duplicate()"
* "SoundfontPlaybackImplementation.end_note()"
* "SoundfontPlaybackImplementation.json_dumps()"
* "SoundfontPlaybackImplementation.json_loads()"
* "SoundfontPlaybackImplementation.load_from_json()"
* "SoundfontPlaybackImplementation.save_to_json()"
* "SoundfontPlaybackImplementation.start_note()"
* "SoundfontPlaybackImplementation.volume_cc()"
* scamp.quantization
* scamp.quantization.BeatQuantizationScheme
* "BeatQuantizationScheme"
* "BeatQuantizationScheme.from_max_divisor()"
* "BeatQuantizationScheme.from_max_divisor_indigestibility()"
* scamp.quantization.MeasureQuantizationScheme
* "MeasureQuantizationScheme"
* "MeasureQuantizationScheme.from_time_signature()"
* "MeasureQuantizationScheme.get_beat_hierarchies()"
* scamp.quantization.QuantizationRecord
* "QuantizationRecord"
* "QuantizationRecord.measure_lengths"
* "QuantizationRecord.time_signatures"
* "QuantizationRecord.duplicate()"
* "QuantizationRecord.json_dumps()"
* "QuantizationRecord.json_loads()"
* "QuantizationRecord.load_from_json()"
* "QuantizationRecord.save_to_json()"
* scamp.quantization.QuantizationScheme
* "QuantizationScheme"
* "QuantizationScheme.from_attributes()"
* "QuantizationScheme.from_time_signature()"
* "QuantizationScheme.from_time_signature_list()"
* "QuantizationScheme.measure_scheme_iterator()"
* "QuantizationScheme.beat_scheme_iterator()"
* scamp.quantization.QuantizedBeat
* "QuantizedBeat"
* "QuantizedBeat.count()"
* "QuantizedBeat.divisor"
* "QuantizedBeat.index()"
* "QuantizedBeat.length"
* "QuantizedBeat.start_beat"
* "QuantizedBeat.start_beat_in_measure"
* scamp.quantization.QuantizedMeasure
* "QuantizedMeasure"
* "QuantizedMeasure.beat_depths"
* "QuantizedMeasure.beats"
* "QuantizedMeasure.count()"
* "QuantizedMeasure.index()"
* "QuantizedMeasure.measure_length"
* "QuantizedMeasure.start_beat"
* "QuantizedMeasure.time_signature"
* scamp.quantization.TimeSignature
* "TimeSignature"
* "TimeSignature.from_measure_length()"
* "TimeSignature.from_string()"
* "TimeSignature.as_string()"
* "TimeSignature.as_tuple()"
* "TimeSignature.measure_length()"
* "TimeSignature.to_abjad()"
* "TimeSignature.duplicate()"
* "TimeSignature.json_dumps()"
* "TimeSignature.json_loads()"
* "TimeSignature.load_from_json()"
* "TimeSignature.save_to_json()"
* scamp.quantization.quantize_performance_part
* "quantize_performance_part()"
* scamp.score
* scamp.score.Measure
* "Measure"
* "Measure.voices"
* "Measure.length"
* "Measure.non_empty_length()"
* "Measure.empty_measure()"
* "Measure.from_list_of_performance_voices()"
* "Measure.get_appropriate_clef()"
* "Measure.to_music_xml()"
* "Measure.append()"
* "Measure.export_lilypond()"
* "Measure.export_music_xml()"
* "Measure.export_pdf()"
* "Measure.extend()"
* "Measure.index()"
* "Measure.insert()"
* "Measure.pop()"
* "Measure.print_lilypond()"
* "Measure.print_music_xml()"
* "Measure.remove()"
* "Measure.show()"
* "Measure.show_xml()"
* "Measure.to_abjad()"
* "Measure.to_lilypond()"
* scamp.score.NoteLike
* "NoteLike"
* "NoteLike.is_rest()"
* "NoteLike.is_chord()"
* "NoteLike.does_glissando()"
* "NoteLike.average_pitch()"
* "NoteLike.merge_with()"
* "NoteLike.to_music_xml()"
* "NoteLike.source_id()"
* "NoteLike.export_lilypond()"
* "NoteLike.export_music_xml()"
* "NoteLike.export_pdf()"
* "NoteLike.print_lilypond()"
* "NoteLike.print_music_xml()"
* "NoteLike.show()"
* "NoteLike.show_xml()"
* "NoteLike.to_abjad()"
* "NoteLike.to_lilypond()"
* scamp.score.Score
* "Score"
* "Score.parts"
* "Score.staves"
* "Score.length()"
* "Score.from_performance()"
* "Score.from_quantized_performance()"
* "Score.to_music_xml()"
* "Score.to_abjad()"
* "Score.to_lilypond()"
* "Score.print_lilypond()"
* "Score.append()"
* "Score.export_lilypond()"
* "Score.export_music_xml()"
* "Score.export_pdf()"
* "Score.extend()"
* "Score.index()"
* "Score.insert()"
* "Score.pop()"
* "Score.print_music_xml()"
* "Score.remove()"
* "Score.show()"
* "Score.show_xml()"
* scamp.score.ScoreComponent
* "ScoreComponent"
* "ScoreComponent.to_music_xml()"
* "ScoreComponent.export_music_xml()"
* "ScoreComponent.print_music_xml()"
* "ScoreComponent.show_xml()"
* "ScoreComponent.to_abjad()"
* "ScoreComponent.export_lilypond()"
* "ScoreComponent.export_pdf()"
* "ScoreComponent.to_lilypond()"
* "ScoreComponent.print_lilypond()"
* "ScoreComponent.show()"
* scamp.score.ScoreContainer
* "ScoreContainer"
* "ScoreContainer.append()"
* "ScoreContainer.extend()"
* "ScoreContainer.index()"
* "ScoreContainer.insert()"
* "ScoreContainer.pop()"
* "ScoreContainer.remove()"
* scamp.score.Staff
* "Staff"
* "Staff.measures"
* "Staff.length()"
* "Staff.to_music_xml()"
* "Staff.append()"
* "Staff.export_lilypond()"
* "Staff.export_music_xml()"
* "Staff.export_pdf()"
* "Staff.extend()"
* "Staff.index()"
* "Staff.insert()"
* "Staff.pop()"
* "Staff.print_lilypond()"
* "Staff.print_music_xml()"
* "Staff.remove()"
* "Staff.show()"
* "Staff.show_xml()"
* "Staff.to_abjad()"
* "Staff.to_lilypond()"
* scamp.score.StaffGroup
* "StaffGroup"
* "StaffGroup.name"
* "StaffGroup.staves"
* "StaffGroup.from_quantized_performance_part()"
* "StaffGroup.to_music_xml()"
* "StaffGroup.append()"
* "StaffGroup.export_lilypond()"
* "StaffGroup.export_music_xml()"
* "StaffGroup.export_pdf()"
* "StaffGroup.extend()"
* "StaffGroup.index()"
* "StaffGroup.insert()"
* "StaffGroup.pop()"
* "StaffGroup.print_lilypond()"
* "StaffGroup.print_music_xml()"
* "StaffGroup.remove()"
* "StaffGroup.show()"
* "StaffGroup.show_xml()"
* "StaffGroup.to_abjad()"
* "StaffGroup.to_lilypond()"
* scamp.score.Tuplet
* "Tuplet"
* "Tuplet.from_length_and_divisor()"
* "Tuplet.contents"
* "Tuplet.dilation_factor()"
* "Tuplet.length()"
* "Tuplet.length_within_tuplet()"
* "Tuplet.to_music_xml()"
* "Tuplet.append()"
* "Tuplet.export_lilypond()"
* "Tuplet.export_music_xml()"
* "Tuplet.export_pdf()"
* "Tuplet.extend()"
* "Tuplet.index()"
* "Tuplet.insert()"
* "Tuplet.pop()"
* "Tuplet.print_lilypond()"
* "Tuplet.print_music_xml()"
* "Tuplet.remove()"
* "Tuplet.show()"
* "Tuplet.show_xml()"
* "Tuplet.to_abjad()"
* "Tuplet.to_lilypond()"
* scamp.score.Voice
* "Voice"
* "Voice.contents"
* "Voice.iterate_notes()"
* "Voice.non_empty_length()"
* "Voice.empty_voice()"
* "Voice.from_performance_voice()"
* "Voice.to_music_xml()"
* "Voice.append()"
* "Voice.export_lilypond()"
* "Voice.export_music_xml()"
* "Voice.export_pdf()"
* "Voice.extend()"
* "Voice.index()"
* "Voice.insert()"
* "Voice.pop()"
* "Voice.print_lilypond()"
* "Voice.print_music_xml()"
* "Voice.remove()"
* "Voice.show()"
* "Voice.show_xml()"
* "Voice.to_abjad()"
* "Voice.to_lilypond()"
* scamp.session
* scamp.session.Session
* "Session"
* "Session.run_as_server()"
* "Session.get_available_midi_input_devices()"
* "Session.print_available_midi_input_devices()"
* "Session.print_available_midi_output_devices()"
* "Session.register_midi_listener()"
* "Session.remove_midi_listener()"
* "Session.register_osc_listener()"
* "Session.remove_osc_listener()"
* "Session.register_keyboard_listener()"
* "Session.remove_keyboard_listener()"
* "Session.register_mouse_listener()"
* "Session.remove_mouse_listener()"
* "Session.start_transcribing()"
* "Session.absolute_beat_length"
* "Session.absolute_rate"
* "Session.absolute_tempo"
* "Session.add_instrument()"
* "Session.alive"
* "Session.apply_beat_length_function()"
* "Session.apply_rate_function()"
* "Session.apply_tempo_envelope()"
* "Session.apply_tempo_function()"
* "Session.beat"
* "Session.beat_length"
* "Session.bring_up_to_date()"
* "Session.children()"
* "Session.clock_to_scheduler_time()"
* "Session.default_spelling_policy"
* "Session.descendants()"
* "Session.duplicate()"
* "Session.extract_absolute_tempo_envelope()"
* "Session.fast_forward()"
* "Session.fast_forward_in_beats()"
* "Session.fast_forward_in_time()"
* "Session.fast_forward_to_beat()"
* "Session.fast_forward_to_time()"
* "Session.fork()"
* "Session.get_available_midi_output_devices()"
* "Session.get_instrument_by_name()"
* "Session.hold_scheduler()"
* "Session.inheritance()"
* "Session.instruments"
* "Session.is_fast_forwarding()"
* "Session.is_master()"
* "Session.is_transcribing()"
* "Session.iterate_all_relatives()"
* "Session.iterate_descendants()"
* "Session.iterate_inheritance()"
* "Session.json_dumps()"
* "Session.json_loads()"
* "Session.kill()"
* "Session.load_from_json()"
* "Session.master"
* "Session.new_midi_part()"
* "Session.new_osc_part()"
* "Session.new_part()"
* "Session.new_silent_part()"
* "Session.pop_instrument()"
* "Session.precise_timing"
* "Session.print_default_soundfont_presets()"
* "Session.print_family_tree()"
* "Session.print_status()"
* "Session.projected_beat()"
* "Session.projected_time()"
* "Session.rate"
* "Session.register_note()"
* "Session.save_to_json()"
* "Session.schedule_action()"
* "Session.scheduler_to_clock_time()"
* "Session.set_beat_length_target()"
* "Session.set_beat_length_targets()"
* "Session.set_rate_target()"
* "Session.set_rate_targets()"
* "Session.set_tempo_target()"
* "Session.set_tempo_targets()"
* "Session.spin_guard_duration"
* "Session.status()"
* "Session.stop_tempo_loop_or_function()"
* "Session.stop_transcribing()"
* "Session.tempo"
* "Session.terminate_forked_children()"
* "Session.time"
* "Session.timing_policy"
* "Session.transcriptions_in_progress"
* "Session.use_absolute_timing_policy()"
* "Session.use_mixed_timing_policy()"
* "Session.use_relative_timing_policy()"
* "Session.wait()"
* "Session.wait_for_children_to_finish()"
* "Session.wait_for_clock_to_finish()"
* "Session.wait_forever()"
* "Session.wait_until()"
* "Session.description"
* scamp.settings
* scamp.settings.EngravingSettings
* "EngravingSettings"
* "EngravingSettings.allow_duple_tuplets_in_compound_time"
* "EngravingSettings.max_voices_per_staff"
* "EngravingSettings.pitch_order_voices_within_measure"
* "EngravingSettings.max_dots_allowed"
* "EngravingSettings.beat_hierarchy_spacing"
* "EngravingSettings.num_divisions_penalty"
* "EngravingSettings.rest_beat_hierarchy_spacing"
* "EngravingSettings.rest_num_divisions_penalty"
* "EngravingSettings.articulation_split_protocols"
* "EngravingSettings.notation_split_protocols"
* "EngravingSettings.clefs_by_instrument"
* "EngravingSettings.clef_pitch_centers"
* "EngravingSettings.clef_selection_policy"
* "EngravingSettings.default_titles"
* "EngravingSettings.default_composers"
* "EngravingSettings.default_spelling_policy"
* "EngravingSettings.ignore_empty_parts"
* "EngravingSettings.glissandi"
* "EngravingSettings.tempo"
* "EngravingSettings.pad_incomplete_parts"
* "EngravingSettings.music_xml_open_command"
* "EngravingSettings.show_microtonal_annotations"
* "EngravingSettings.microtonal_annotation_digits"
* "EngravingSettings.export_note_velocities_to_xml"
* "EngravingSettings.lilypond_dir"
* "EngravingSettings.lilypond_search_paths"
* "EngravingSettings.max_voices_per_part"
* "EngravingSettings.set_music_xml_application()"
* "EngravingSettings.get_default_title()"
* "EngravingSettings.get_default_composer()"
* "EngravingSettings.duplicate()"
* "EngravingSettings.factory_default()"
* "EngravingSettings.json_dumps()"
* "EngravingSettings.json_loads()"
* "EngravingSettings.load()"
* "EngravingSettings.load_from_json()"
* "EngravingSettings.make_persistent()"
* "EngravingSettings.open_json_file()"
* "EngravingSettings.restore_factory_defaults()"
* "EngravingSettings.save_to_json()"
* scamp.settings.GlissandiSettings
* "GlissandiSettings"
* "GlissandiSettings.control_point_policy"
* "GlissandiSettings.consider_non_extrema_control_points"
* "GlissandiSettings.include_end_grace_note"
* "GlissandiSettings.inner_grace_relevance_threshold"
* "GlissandiSettings.max_inner_graces_music_xml"
* "GlissandiSettings.slur_glisses"
* "GlissandiSettings.duplicate()"
* "GlissandiSettings.factory_default()"
* "GlissandiSettings.json_dumps()"
* "GlissandiSettings.json_loads()"
* "GlissandiSettings.load()"
* "GlissandiSettings.load_from_json()"
* "GlissandiSettings.make_persistent()"
* "GlissandiSettings.open_json_file()"
* "GlissandiSettings.restore_factory_defaults()"
* "GlissandiSettings.save_to_json()"
* scamp.settings.PlaybackSettings
* "PlaybackSettings"
* "PlaybackSettings.named_soundfonts"
* "PlaybackSettings.soundfont_search_paths"
* "PlaybackSettings.default_soundfont"
* "PlaybackSettings.default_audio_driver"
* "PlaybackSettings.default_max_soundfont_pitch_bend"
* "PlaybackSettings.default_max_streaming_midi_pitch_bend"
* "PlaybackSettings.soundfont_volume_to_velocity_curve"
* "PlaybackSettings.streaming_midi_volume_to_velocity_curve"
* "PlaybackSettings.osc_message_addresses"
* "PlaybackSettings.adjustments"
* "PlaybackSettings.try_system_fluidsynth_first"
* "PlaybackSettings.use_bundled_pyfluidsynth"
* "PlaybackSettings.resize_parameter_envelopes"
* "PlaybackSettings.animation_tick_interval"
* "PlaybackSettings.recording_file_path"
* "PlaybackSettings.recording_time_range"
* "PlaybackSettings.register_named_soundfont()"
* "PlaybackSettings.unregister_named_soundfont()"
* "PlaybackSettings.list_named_soundfonts()"
* "PlaybackSettings.set_playback_adjustment()"
* "PlaybackSettings.get_playback_adjustment()"
* "PlaybackSettings.duplicate()"
* "PlaybackSettings.factory_default()"
* "PlaybackSettings.json_dumps()"
* "PlaybackSettings.json_loads()"
* "PlaybackSettings.load()"
* "PlaybackSettings.load_from_json()"
* "PlaybackSettings.make_persistent()"
* "PlaybackSettings.open_json_file()"
* "PlaybackSettings.restore_factory_defaults()"
* "PlaybackSettings.save_to_json()"
* scamp.settings.QuantizationSettings
* "QuantizationSettings"
* "QuantizationSettings.onset_weighting"
* "QuantizationSettings.termination_weighting"
* "QuantizationSettings.inner_split_weighting"
* "QuantizationSettings.max_divisor"
* "QuantizationSettings.max_divisor_indigestibility"
* "QuantizationSettings.simplicity_preference"
* "QuantizationSettings.default_time_signature"
* "QuantizationSettings.duplicate()"
* "QuantizationSettings.factory_default()"
* "QuantizationSettings.json_dumps()"
* "QuantizationSettings.json_loads()"
* "QuantizationSettings.load()"
* "QuantizationSettings.load_from_json()"
* "QuantizationSettings.make_persistent()"
* "QuantizationSettings.open_json_file()"
* "QuantizationSettings.restore_factory_defaults()"
* "QuantizationSettings.save_to_json()"
* scamp.settings.TempoSettings
* "TempoSettings"
* "TempoSettings.guide_mark_resolution"
* "TempoSettings.guide_mark_sensitivity"
* "TempoSettings.include_guide_marks"
* "TempoSettings.parenthesize_guide_marks"
* "TempoSettings.duplicate()"
* "TempoSettings.factory_default()"
* "TempoSettings.json_dumps()"
* "TempoSettings.json_loads()"
* "TempoSettings.load()"
* "TempoSettings.load_from_json()"
* "TempoSettings.make_persistent()"
* "TempoSettings.open_json_file()"
* "TempoSettings.restore_factory_defaults()"
* "TempoSettings.save_to_json()"
* scamp.settings.restore_all_factory_defaults
* "restore_all_factory_defaults()"
* scamp.spanners
* scamp.spanners.ChangePedal
* "ChangePedal"
* "ChangePedal.START_MID_OR_STOP"
* "ChangePedal.FORMATTING_SLOTS"
* "ChangePedal.to_pymusicxml()"
* "ChangePedal.to_abjad()"
* "ChangePedal.duplicate()"
* "ChangePedal.get_abjad_direction()"
* "ChangePedal.json_dumps()"
* "ChangePedal.json_loads()"
* "ChangePedal.load_from_json()"
* "ChangePedal.save_to_json()"
* scamp.spanners.Spanner
* "Spanner"
* "Spanner.START_MID_OR_STOP"
* "Spanner.FORMATTING_SLOTS"
* "Spanner.to_pymusicxml()"
* "Spanner.to_abjad()"
* "Spanner.get_abjad_direction()"
* "Spanner.duplicate()"
* "Spanner.json_dumps()"
* "Spanner.json_loads()"
* "Spanner.load_from_json()"
* "Spanner.save_to_json()"
* scamp.spanners.StartBracket
* "StartBracket"
* "StartBracket.START_MID_OR_STOP"
* "StartBracket.FORMATTING_SLOTS"
* "StartBracket.to_pymusicxml()"
* "StartBracket.to_abjad()"
* "StartBracket.duplicate()"
* "StartBracket.get_abjad_direction()"
* "StartBracket.json_dumps()"
* "StartBracket.json_loads()"
* "StartBracket.load_from_json()"
* "StartBracket.save_to_json()"
* scamp.spanners.StartDashes
* "StartDashes"
* "StartDashes.START_MID_OR_STOP"
* "StartDashes.FORMATTING_SLOTS"
* "StartDashes.to_pymusicxml()"
* "StartDashes.to_abjad()"
* "StartDashes.get_abjad_direction()"
* "StartDashes.duplicate()"
* "StartDashes.json_dumps()"
* "StartDashes.json_loads()"
* "StartDashes.load_from_json()"
* "StartDashes.save_to_json()"
* scamp.spanners.StartHairpin
* "StartHairpin"
* "StartHairpin.START_MID_OR_STOP"
* "StartHairpin.FORMATTING_SLOTS"
* "StartHairpin.to_pymusicxml()"
* "StartHairpin.to_abjad()"
* "StartHairpin.duplicate()"
* "StartHairpin.get_abjad_direction()"
* "StartHairpin.json_dumps()"
* "StartHairpin.json_loads()"
* "StartHairpin.load_from_json()"
* "StartHairpin.save_to_json()"
* scamp.spanners.StartPedal
* "StartPedal"
* "StartPedal.START_MID_OR_STOP"
* "StartPedal.FORMATTING_SLOTS"
* "StartPedal.to_pymusicxml()"
* "StartPedal.to_abjad()"
* "StartPedal.duplicate()"
* "StartPedal.get_abjad_direction()"
* "StartPedal.json_dumps()"
* "StartPedal.json_loads()"
* "StartPedal.load_from_json()"
* "StartPedal.save_to_json()"
* scamp.spanners.StartPhrasingSlur
* "StartPhrasingSlur"
* "StartPhrasingSlur.START_MID_OR_STOP"
* "StartPhrasingSlur.FORMATTING_SLOTS"
* "StartPhrasingSlur.to_pymusicxml()"
* "StartPhrasingSlur.to_abjad()"
* "StartPhrasingSlur.duplicate()"
* "StartPhrasingSlur.get_abjad_direction()"
* "StartPhrasingSlur.json_dumps()"
* "StartPhrasingSlur.json_loads()"
* "StartPhrasingSlur.load_from_json()"
* "StartPhrasingSlur.save_to_json()"
* scamp.spanners.StartSlur
* "StartSlur"
* "StartSlur.START_MID_OR_STOP"
* "StartSlur.FORMATTING_SLOTS"
* "StartSlur.to_pymusicxml()"
* "StartSlur.to_abjad()"
* "StartSlur.duplicate()"
* "StartSlur.get_abjad_direction()"
* "StartSlur.json_dumps()"
* "StartSlur.json_loads()"
* "StartSlur.load_from_json()"
* "StartSlur.save_to_json()"
* scamp.spanners.StartTrill
* "StartTrill"
* "StartTrill.START_MID_OR_STOP"
* "StartTrill.FORMATTING_SLOTS"
* "StartTrill.to_pymusicxml()"
* "StartTrill.to_abjad()"
* "StartTrill.duplicate()"
* "StartTrill.get_abjad_direction()"
* "StartTrill.json_dumps()"
* "StartTrill.json_loads()"
* "StartTrill.load_from_json()"
* "StartTrill.save_to_json()"
* scamp.spanners.StopBracket
* "StopBracket"
* "StopBracket.START_MID_OR_STOP"
* "StopBracket.FORMATTING_SLOTS"
* "StopBracket.to_pymusicxml()"
* "StopBracket.to_abjad()"
* "StopBracket.duplicate()"
* "StopBracket.get_abjad_direction()"
* "StopBracket.json_dumps()"
* "StopBracket.json_loads()"
* "StopBracket.load_from_json()"
* "StopBracket.save_to_json()"
* scamp.spanners.StopDashes
* "StopDashes"
* "StopDashes.START_MID_OR_STOP"
* "StopDashes.FORMATTING_SLOTS"
* "StopDashes.to_pymusicxml()"
* "StopDashes.to_abjad()"
* "StopDashes.duplicate()"
* "StopDashes.get_abjad_direction()"
* "StopDashes.json_dumps()"
* "StopDashes.json_loads()"
* "StopDashes.load_from_json()"
* "StopDashes.save_to_json()"
* scamp.spanners.StopHairpin
* "StopHairpin"
* "StopHairpin.START_MID_OR_STOP"
* "StopHairpin.FORMATTING_SLOTS"
* "StopHairpin.to_pymusicxml()"
* "StopHairpin.to_abjad()"
* "StopHairpin.duplicate()"
* "StopHairpin.get_abjad_direction()"
* "StopHairpin.json_dumps()"
* "StopHairpin.json_loads()"
* "StopHairpin.load_from_json()"
* "StopHairpin.save_to_json()"
* scamp.spanners.StopPedal
* "StopPedal"
* "StopPedal.START_MID_OR_STOP"
* "StopPedal.FORMATTING_SLOTS"
* "StopPedal.to_pymusicxml()"
* "StopPedal.to_abjad()"
* "StopPedal.duplicate()"
* "StopPedal.get_abjad_direction()"
* "StopPedal.json_dumps()"
* "StopPedal.json_loads()"
* "StopPedal.load_from_json()"
* "StopPedal.save_to_json()"
* scamp.spanners.StopPhrasingSlur
* "StopPhrasingSlur"
* "StopPhrasingSlur.START_MID_OR_STOP"
* "StopPhrasingSlur.FORMATTING_SLOTS"
* "StopPhrasingSlur.to_pymusicxml()"
* "StopPhrasingSlur.to_abjad()"
* "StopPhrasingSlur.duplicate()"
* "StopPhrasingSlur.get_abjad_direction()"
* "StopPhrasingSlur.json_dumps()"
* "StopPhrasingSlur.json_loads()"
* "StopPhrasingSlur.load_from_json()"
* "StopPhrasingSlur.save_to_json()"
* scamp.spanners.StopSlur
* "StopSlur"
* "StopSlur.START_MID_OR_STOP"
* "StopSlur.FORMATTING_SLOTS"
* "StopSlur.to_pymusicxml()"
* "StopSlur.to_abjad()"
* "StopSlur.duplicate()"
* "StopSlur.get_abjad_direction()"
* "StopSlur.json_dumps()"
* "StopSlur.json_loads()"
* "StopSlur.load_from_json()"
* "StopSlur.save_to_json()"
* scamp.spanners.StopTrill
* "StopTrill"
* "StopTrill.START_MID_OR_STOP"
* "StopTrill.FORMATTING_SLOTS"
* "StopTrill.to_pymusicxml()"
* "StopTrill.to_abjad()"
* "StopTrill.duplicate()"
* "StopTrill.get_abjad_direction()"
* "StopTrill.json_dumps()"
* "StopTrill.json_loads()"
* "StopTrill.load_from_json()"
* "StopTrill.save_to_json()"
* scamp.spelling
* scamp.spelling.SpellingPolicy
* "SpellingPolicy"
* "SpellingPolicy.all_sharps()"
* "SpellingPolicy.all_flats()"
* "SpellingPolicy.from_circle_of_fifths_position()"
* "SpellingPolicy.from_string()"
* "SpellingPolicy.interpret()"
* "SpellingPolicy.resolve_name_octave_and_alteration()"
* "SpellingPolicy.resolve_abjad_pitch()"
* "SpellingPolicy.resolve_music_xml_pitch()"
* "SpellingPolicy.duplicate()"
* "SpellingPolicy.json_dumps()"
* "SpellingPolicy.json_loads()"
* "SpellingPolicy.load_from_json()"
* "SpellingPolicy.save_to_json()"
* scamp.test_run
* scamp.test_run.play
* "play()"
* scamp.text
* scamp.text.StaffText
* "StaffText"
* "StaffText.from_string()"
* "StaffText.to_pymusicxml()"
* "StaffText.to_abjad()"
* "StaffText.duplicate()"
* "StaffText.json_dumps()"
* "StaffText.json_loads()"
* "StaffText.load_from_json()"
* "StaffText.save_to_json()"
* scamp.transcriber
* scamp.transcriber.Transcriber
* "Transcriber"
* "Transcriber.transcriptions_in_progress"
* "Transcriber.is_transcribing()"
* "Transcriber.start_transcribing()"
* "Transcriber.register_note()"
* "Transcriber.stop_transcribing()"
* scamp.utilities
* scamp.utilities.NoteProperty
* "NoteProperty"
* scamp.utilities.ceil_to_multiple
* "ceil_to_multiple()"
* scamp.utilities.ceil_x_to_pow_of_y
* "ceil_x_to_pow_of_y()"
* scamp.utilities.first_run_notice
* "first_run_notice()"
* scamp.utilities.floor_to_multiple
* "floor_to_multiple()"
* scamp.utilities.floor_x_to_pow_of_y
* "floor_x_to_pow_of_y()"
* scamp.utilities.get_average_square_correlation
* "get_average_square_correlation()"
* scamp.utilities.get_standard_indispensability_array
* "get_standard_indispensability_array()"
* scamp.utilities.indigestibility
* "indigestibility()"
* scamp.utilities.is_after
* "is_after()"
* scamp.utilities.is_before
* "is_before()"
* scamp.utilities.is_multiple
* "is_multiple()"
* scamp.utilities.is_prime
* "is_prime()"
* scamp.utilities.is_x_pow_of_y
* "is_x_pow_of_y()"
* scamp.utilities.iterate_all_subclasses
* "iterate_all_subclasses()"
* scamp.utilities.make_flat_list
* "make_flat_list()"
* scamp.utilities.memoize
* "memoize()"
* scamp.utilities.prime_factor
* "prime_factor()"
* scamp.utilities.resolve_package_path
* "resolve_package_path()"
* scamp.utilities.resolve_path
* "resolve_path()"
* scamp.utilities.rotate
* "rotate()"
* scamp.utilities.round_to_multiple
* "round_to_multiple()"
* scamp.utilities.round_x_to_pow_of_y
* "round_x_to_pow_of_y()"
* scamp.utilities.sum_nested_list
* "sum_nested_list()"
-[ Public-Facing API (result of *import **): ]-
+------------+--------------------------------------------------------------------------------------------+
| "dependenc | Return a list of (name, state, detail) tuples describing the status of each optional |
| y_status"( | dependency. |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_dep | Print which optional features are available in this scamp install. |
| endency_st | |
| atus"() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_avail | Probes the available devices for midi input or output |
| able_midi_ | |
| input_devi | |
| ces"() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_avail | Probes the available devices for midi input or output |
| able_midi_ | |
| output_dev | |
| ices"() | |
+------------+--------------------------------------------------------------------------------------------+
| "get_port_ | Get the port number of a given device based on its a fuzzy string match of its name. |
| number_of_ | |
| midi_devic | |
| e"(device_ | |
| name, ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "print_ava | Prints a list of available ports and devices for midi input or output |
| ilable_mid | |
| i_input_de | |
| vices"() | |
+------------+--------------------------------------------------------------------------------------------+
| "print_ava | Prints a list of available ports and devices for midi input or output |
| ilable_mid | |
| i_output_d | |
| evices"() | |
+------------+--------------------------------------------------------------------------------------------+
| "print_sou | Prints a list of all the presets available in the given soundfont; useful for finding the |
| ndfont_pre | name of the instrument you want to load. |
| sets"([whi | |
| ch_soundfo | |
| nt]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Clock"([n | Recursively nestable clock. |
| ame, | |
| parent, in | |
| itial_rate | |
| , ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "ClockFami | Fine-tuning options for a clock family, passed to a master "Clock" on construction. |
| lyOptions" | |
| ([timing_p | |
| olicy, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "DurationU | Units with which we measure duration or Moment positioning. |
| nits"(*val | |
| ues) | |
+------------+--------------------------------------------------------------------------------------------+
| "TempoUnit | The three different, and mutually determined, ways of expressing tempo. |
| s"(*values | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "ClockKill | Raised inside a forked clock's own thread when its wait is woken by kill(), so the fork |
| edError" | wrapper can unwind the user function cleanly. |
+------------+--------------------------------------------------------------------------------------------+
| "Clockbloc | Base class for clockblocks errors. |
| ksError" | |
+------------+--------------------------------------------------------------------------------------------+
| "DeadClock | Raised when something tries to wait or fork on a clock that's no longer ALIVE (either |
| Error" | killed already, or — for fork — still PENDING in its start_delay). |
+------------+--------------------------------------------------------------------------------------------+
| "NoActiveC | Raised when a context-inferring clock operation (the module-level wait/fork/etc.) is |
| lockError" | attempted from a thread that has no clock active on it. |
+------------+--------------------------------------------------------------------------------------------+
| "NotMaster | Raised by operations that are only valid on the master (top-level) clock — e.g. |
| ClockError | run_as_server() — when called on a child clock. |
| " | |
+------------+--------------------------------------------------------------------------------------------+
| "Scheduler | Raised when wait() is called from a thread that is holding the scheduler via |
| HeldError" | hold_scheduler() — most commonly inside a MIDI / OSC / HID callback, which runs under such |
| | a hold. |
+------------+--------------------------------------------------------------------------------------------+
| "WrongThre | Raised when wait() is called from a thread that doesn't own the clock. |
| adError" | |
+------------+--------------------------------------------------------------------------------------------+
| "MetricPha | Class representing a particular point in a (beat or measure) cycle. |
| seTarget"( | |
| phase_or_p | |
| hases[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Moment"(v | Represents a point on a clock's timeline. |
| alue[, | |
| units, | |
| relative]) | |
+------------+--------------------------------------------------------------------------------------------+
| "TempoEnve | A subclass of "Envelope" that is specifically designed for representing changing tempo |
| lope"([lev | curves. |
| els, | |
| durations, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "apply_bea | Drive the current clock's beat length (in seconds per beat) by following a function of |
| t_length_f | beats/time. |
| unction"(f | |
| unction[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "apply_rat | Drive the current clock's rate (in beats per second) by following a function of |
| e_function | beats/time. |
| "(function | |
| [, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "apply_tem | Append a ready-made "TempoEnvelope" onto the current clock's tempo curve. |
| po_envelop | |
| e"(envelop | |
| e[, | |
| truncate, | |
| loop]) | |
+------------+--------------------------------------------------------------------------------------------+
| "apply_tem | Drive the current clock's tempo (in beats per minute) by following a function of |
| po_functio | beats/time. |
| n"(functio | |
| n[, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "current_c | Get the "Clock" active on the current thread, or None if none is active. |
| lock"() | |
+------------+--------------------------------------------------------------------------------------------+
| "fork"(for | Run "forked_function" on a new child clock of the currently active clock, so it proceeds |
| ked_functi | in parallel while staying coordinated under the same musical time. |
| on[, args, | |
| kwargs, | |
| name, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "get_beat" | Return how many beats have passed on the currently active clock (see "beat"). |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "get_beat_ | Return the current beat length (in seconds per beat) of the currently active clock (see |
| length"() | "beat_length"). |
+------------+--------------------------------------------------------------------------------------------+
| "get_rate" | Return the current rate (in beats per second) of the currently active clock (see "rate"). |
| () | |
+------------+--------------------------------------------------------------------------------------------+
| "get_tempo | Return the current tempo (in beats per minute) of the currently active clock (see |
| "() | "tempo"). |
+------------+--------------------------------------------------------------------------------------------+
| "get_time" | Return how much time has passed on the currently active clock (see "time") — in seconds if |
| () | it is the master clock, or parent clock beats if it is a forked child clock. |
+------------+--------------------------------------------------------------------------------------------+
| "set_beat_ | Immediately set the beat length of the current clock (see "beat_length"). |
| length"(be | |
| at_length) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_beat_ | Smoothly change the current clock's beat length to "beat_length_target" (in seconds per |
| length_tar | beat), arriving at "when". |
| get"(beat_ | |
| length_tar | |
| get, when) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_beat_ | Set several beat-length targets at once, building a multi-segment tempo curve on the |
| length_tar | current clock. |
| gets"(beat | |
| _length_ta | |
| rgets, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_rate" | Immediately set the rate of the current clock (see "rate"). |
| (rate) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_rate_ | Smoothly change the current clock's rate to "rate_target" (in beats per second), arriving |
| target"(ra | at "when". |
| te_target, | |
| when[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_rate_ | Set several rate targets at once, building a multi-segment tempo curve on the current |
| targets"(r | clock. |
| ate_target | |
| s, whens[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_tempo | Immediately set the tempo of the current clock (see "tempo"). |
| "(tempo) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_tempo | Smoothly change the current clock's tempo to "tempo_target" (in beats per minute), |
| _target"(t | arriving at "when". |
| empo_targe | |
| t, when[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "set_tempo | Set several tempo targets at once, building a multi-segment tempo curve on the current |
| _targets"( | clock. |
| tempo_targ | |
| ets, | |
| whens[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "stop_temp | Stop following any function or looping envelope previously started on the current clock's |
| o_loop_or_ | tempo (via "apply_tempo_function()"/"apply_rate_fu |
| function"( | nction()"/"apply_beat_length_function()" or a looping "apply_tempo_envelope()"). |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "terminate | Kill the child clocks of the currently active clock, returning once they have finished |
| _forked_ch | unwinding (see "terminate_forked_children()"). |
| ildren"() | |
+------------+--------------------------------------------------------------------------------------------+
| "wait"(dt[ | Block the clock currently active on this thread for "dt" beats (or seconds, if |
| , units]) | "units="time""), yielding to the scheduler. |
+------------+--------------------------------------------------------------------------------------------+
| "wait_for_ | Block on the currently active clock until its child clocks have finished (see |
| children_t | "wait_for_children_to_finish()"). |
| o_finish"( | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "wait_for_ | Block on the currently active clock until *clock* has finished (see |
| clock_to_f | "wait_for_clock_to_finish()"). |
| inish"(clo | |
| ck) | |
+------------+--------------------------------------------------------------------------------------------+
| "wait_fore | Block forever on the currently active clock (see "wait_forever()") — usually to keep the |
| ver"() | main script alive while child clocks do the work. |
+------------+--------------------------------------------------------------------------------------------+
| "wait_unti | Block the clock currently active on this thread until the *absolute* beat (or time, if |
| l"(when[, | "units="time"") given by "when". |
| units]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Envelope" | Class representing a piece-wise exponential function. |
| ([levels, | |
| durations, | |
| curve_shap | |
| es, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "EnvelopeS | A segment of an envelope, with the ability to perform interpolation and integration. |
| egment"(st | |
| art_time, | |
| end_time, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "ChordHand | This handle, returned by instrument.start_chord, allows us to manipulate a chord that we |
| le"(note_h | have started, (i.e. by changing pitch, volume, or another other parameter, or by ending |
| andles, | the note). |
| intervals) | |
+------------+--------------------------------------------------------------------------------------------+
| "Ensemble" | Host for multiple "ScampInstrument" objects, keeping shared resources, and shared default |
| ([default_ | settings. |
| soundfont, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "NoteHandl | This handle, which is returned by instrument.start_note, allows us to manipulate the note |
| e"(note_id | that we have started, (i.e. by changing pitch, volume, or another other parameter, or by |
| , instrume | ending the note). |
| nt) | |
+------------+--------------------------------------------------------------------------------------------+
| "ScampInst | Instrument class that does the playing of the notes. |
| rument"([n | |
| ame, | |
| ensemble, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "NotePrope | Class that holds information about any and all playback or notational details for a note |
| rties"(*ar | or chord aside from its pitch, volume and duration. |
| gs, | |
| **kwargs) | |
+------------+--------------------------------------------------------------------------------------------+
| "Performan | Representation of note playback events, usually a transcription of the notes played by an |
| ce"([parts | "Ensemble". |
| , tempo_en | |
| velope]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Performan | Represents a single note played by a "ScampInstrument". |
| ceNote"(st | |
| art_beat, | |
| length, | |
| pitch, | |
| ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "Performan | Transcription of the notes played by a single "ScampInstrument". |
| cePart"([i | |
| nstrument, | |
| name, | |
| voices, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "NotePlayb | Represents an adjustment to the pitch, volume and/or length of the playback of a single |
| ackAdjustm | note |
| ent"([pitc | |
| h_adjustme | |
| nt, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "ParamPlay | Represents a multiply/add playback adjustment to a single parameter. |
| backAdjust | |
| ment"([mul | |
| tiply, | |
| add]) | |
+------------+--------------------------------------------------------------------------------------------+
| "MIDIStrea | Playback implementation that sends an outgoing MIDI stream to an external synthesizer / |
| mPlaybackI | program |
| mplementat | |
| ion"([...] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "OSCPlayba | Playback implementation that sends outgoing OSC messages to an external synthesizer / |
| ckImplemen | program |
| tation"(po | |
| rt[, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "PlaybackI | Abstract base class for playback implementations, which do the actual work of playback, |
| mplementat | either by playing sounds or by sending messages to external synthesizers to play sounds. |
| ion"() | |
+------------+--------------------------------------------------------------------------------------------+
| "Soundfont | Playback implementation that does Soundfont playback, via the MIDI protocol. |
| PlaybackIm | |
| plementati | |
| on"([...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "BeatQuant | Scheme for making a decision about which divisor to use to quantize a beat |
| izationSch | |
| eme"(lengt | |
| h, | |
| divisors[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "MeasureQu | Scheme for quantizing a measure, including beat lengths and which beat divisors to allow. |
| antization | |
| Scheme"(be | |
| at_schemes | |
| , ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "Quantizat | Scheme for quantizing a "PerformancePart" or "Performance" |
| ionScheme" | |
| (measure_s | |
| chemes[, | |
| loop]) | |
+------------+--------------------------------------------------------------------------------------------+
| "TimeSigna | Class representing the time signature of a measure |
| ture"(nume | |
| rator, den | |
| ominator[, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Measure"( | Representation of a single measure within in a Staff |
| voices, ti | |
| me_signatu | |
| re[, ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "NoteLike" | Represents a note, chord, or rest that can be notated without ties |
| (pitch, | |
| volume, wr | |
| itten_leng | |
| th, ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "Score"([p | Representation of a score in traditional western notation. |
| arts, | |
| title, | |
| composer, | |
| tempo_enve | |
| lope]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Staff"(me | Representation of a single staff of a western-notated score |
| asures[, | |
| name]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StaffGrou | Representation of a StaffGroup (used for the multiple staves of a single instrument) |
| p"(staves[ | |
| , name, cl | |
| ef_choices | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Tuplet"(t | Representation of a Tuplet object within a single voice of music. |
| uplet_divi | |
| sions, nor | |
| mal_divisi | |
| ons, ...) | |
+------------+--------------------------------------------------------------------------------------------+
| "Voice"(co | Representation of a single voice within a single measure of a single staff of music. |
| ntents, ti | |
| me_signatu | |
| re) | |
+------------+--------------------------------------------------------------------------------------------+
| "Session"( | A Session combines the functionality of a master Clock, an Ensemble, and a Transcriber. |
| [tempo, de | |
| fault_soun | |
| dfont, | |
| ...]) | |
+------------+--------------------------------------------------------------------------------------------+
| "engraving | Instance of "EngravingSettings" containing the actual engraving defaults to be consulted |
| _settings" | |
+------------+--------------------------------------------------------------------------------------------+
| "playback_ | Instance of "PlaybackSettings" containing the actual playback defaults to be consulted |
| settings" | |
+------------+--------------------------------------------------------------------------------------------+
| "quantizat | Instance of "QuantizationSettings" containing the actual quantization defaults to be |
| ion_settin | consulted |
| gs" | |
+------------+--------------------------------------------------------------------------------------------+
| "ChangePed | Change piano pedal spanner. |
| al"([label | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartBrac | Start bracket spanner (e.g. a text bracket with a hook). |
| ket"([labe | |
| l]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartDash | Start dashes spanner. |
| es"([label | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartHair | Start hairpin spanner. |
| pin"([labe | |
| l]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartPeda | Start piano pedal spanner. |
| l"([label] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartPhra | Phrasing slurs are an additional type of slur available in LilyPond useful for creating |
| singSlur"( | long, overarching slurs that can have smaller, regular slurs inside of them. |
| [label]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartSlur | Start slur spanner type. |
| "([label]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StartTril | Start trill spanner. |
| l"([label] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopBrack | Stop bracket spanner. |
| et"([label | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopDashe | Stop dashes spanner. |
| s"([label] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopHairp | Stop hairpin spanner. |
| in"([label | |
| ]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopPedal | Stop piano pedal spanner. |
| "([label]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopPhras | Stop spanner for a phrasing slur. |
| ingSlur"([ | |
| label]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopSlur" | Stop slur spanner type. |
| ([label]) | |
+------------+--------------------------------------------------------------------------------------------+
| "StopTrill | Stop trill spanner. |
| "([label]) | |
+------------+--------------------------------------------------------------------------------------------+
| "SpellingP | Object that translates pitches or pitch classes to the actual spelling used in a score |
| olicy"([st | |
| ep_alterat | |
| ion_pairs] | |
| ) | |
+------------+--------------------------------------------------------------------------------------------+
| "StaffText | Represents text that will be attached to the staff at a given note. |
| "(text[, | |
| italic, | |
| bold, plac | |
| ement]) | |
+------------+--------------------------------------------------------------------------------------------+
| "Transcrib | Class responsible for transcribing notes played by instruments into a "Performance". |
| er"() | |
+------------+--------------------------------------------------------------------------------------------+