Swayam Sahoo

Rest

Overview

The Rest class can be accesed within a Part object of a Scopul object. It has 2 properties: measure, length

Here’s an example of how you could get a Rest object:

from Scopul import Scopul

scop = Scopul("test.mid")

# Get parts
parts = scop.parts

# Get random part's sequence
random_part = parts[0].sequence

# Lets say, for example, 
# random_part = [<Sequence.Note object at 0x0000024774D85190>, <Sequence.Rest object at 0x0000024774D1D9D0>]

rest = random_part[1] # Getting the second object in the sequence, which is a rest


Creating a Rest object

Rest(self, music21=None, length=None, measure=None)

You can create your own note class, which you may use to append to the existing MIDI or use for other purposes

Args

There are two ways to create a Rest class:

To make it your self:

from Scopul import Rest

my_note = Rest(length=1.5, measure=5)


To use a music21 object to create a Note object:

from Scopul import Note
from music21 import note

music21_rest = note.Rest(quarterlength=4)
scopul_note = Note(m21=music21_rest) # Automatically sets up all the attributes


Properties