Swayam Sahoo

Chord

Overview

The chord class can be accesed within a Part object of a Scopul object. It has 4 properties: name, measure, velocity, length

Here’s an example of how you could get a chord 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.Chord object at 0x0000024774D85190>, <Sequence.Rest object at 0x0000024774D1D9D0>]

chord = random_part[0] # Getting the first object in the sequence, which is a chord


Creating a Chord object

Chord(self, m21=None, notes: list = 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

To make it your self:

from Scopul import Note, Chord

N1 = Note(name="C#4", length=1.5)
N2 = Note(name="E4", length=1.5)
N3 = Note(name="G4", length=1.5)

my_note = Chord(notes=[N1, N2, N3], measure=5)


To use a music21 object to create a Note object:

from Scopul import Note
from music21 import chord

music21_chord = chord.Chord(['D', 'F#', 'A'])
scopul_note = Note(m21=music21_chord) # Automatically sets up all the attributes


Properties