chords
JustLatticeChord
This class implements chords based on lattice coordinates.
Source code in /opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/jintonic/chords.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
prime_limit: int
property
JustLatticeChord prime limit.
tones: List[JustInterval]
property
JustLatticeChord constituent intervals from root (tones).
Returns:
Type | Description |
---|---|
List[JustInterval]
|
The tones of the chord as JustIntervals from the fundamental. |
Examples:
>>> chord = JustLatticeChord.from_name(60, [0, 0, 0], 'major triad')
>>> chord.tones
[JustInterval(1, 1), JustInterval(5, 4), JustInterval(3, 2)]
hertz: List[float]
property
JustLatticeChord constituent Hertz values.
Returns:
Type | Description |
---|---|
List[float]
|
The frequencies in Hertz of the constituent pitches |
Examples:
>>> chord = JustLatticeChord.from_name(60, [0, 0, 0], 'minor triad')
>>> chord.hertz
[60.0, 72.0, 90.0]
harmonics: List[int]
property
JustLatticeChord harmonics (relative frequencies).
Returns:
Type | Description |
---|---|
List[int]
|
The lattice's prime limit |
Examples:
>>> chord = JustLatticeChord.from_name(60, [0, 0, 0], 'minor triad')
>>> chord.harmonics
[10, 12, 15]
identities: List[int]
property
JustLatticeChord constituent identities.
Returns:
Type | Description |
---|---|
List[int]
|
The constituent identities |
Examples:
>>> chord = JustLatticeChord.from_name(60, [0, 0, 0], 'minor triad')
>>> chord.identities
[5, 3, 15]
__init__(fundamental, root, nodes)
Initializes a JustLatticeChord.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fundamental |
float
|
Fundamental pitch in Hertz. |
required |
root |
List[int]
|
Root lattice node (the chord's root tone) |
required |
nodes |
List[List[int]]
|
Lattice nodes of each constituent chord tone. |
required |
Examples:
>>> nodes = [[-1, 0, 1], [1, 0, 0], [0, 0, 1]]
>>> JustLatticeChord(fundamental=100.0, root=[1, 0, 0], nodes=nodes)
JustLatticeChord(100.0 Hz, [3/2, 7/4, 9/8, 21/16], [3-7-9-21])
Source code in /opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/jintonic/chords.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
from_name(fundamental, root, name)
classmethod
Initializes a JustLatticeChord from a conventional chord name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fundamental |
float
|
The fundamental frequency in Hertz |
required |
root |
List[int]
|
The root node lattice coordinates |
required |
name |
str
|
The chord name |
required |
Returns:
Type | Description |
---|---|
JustLatticeChord
|
A JustLatticeChord |
The list of valid names is
- "sub-minor triad"
- "minor triad"
- "diminished triad"
- "major triad"
- "sub-minor seventh"
- "minor seventh"
- "half-diminished seventh"
- "major seventh"
- "super-major seventh"
- "dominant seventh"
- "added second"
- "minor ninth"
- "major ninth"
- "dominant ninth"
- "4-6-7"
- "5-7-9"
Examples:
>>> JustLatticeChord.from_name(60, [0, 0, 0], 'minor triad')
JustLatticeChord(60.0 Hz, [1/1, 6/5, 3/2], [5-3-15])
>>> JustLatticeChord.from_name(60, [-1, 0, 0], 'major triad')
JustLatticeChord(60.0 Hz, [4/3, 5/3, 1/1], [1-5-3])
Source code in /opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/jintonic/chords.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
pivot(axis=3)
Pivots the JustLatticeChord along the given axis.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
axis |
int
|
Prime limit axis (a prime number) |
3
|
Returns:
Type | Description |
---|---|
JustLatticeChord
|
A pivoted JustLatticeChord |
Note
Returns a copy
Examples:
>>> chord = JustLatticeChord.from_name(60, [0, 0, 0], 'major triad')
>>> chord.pivot(3)
JustLatticeChord(60.0 Hz, [1/1, 5/4, 4/3], [3-15-1])
Source code in /opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/jintonic/chords.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
transpose(node)
JustLatticeChord transposition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node |
List[int]
|
The target root node of the transposed chord. |
required |
Returns:
Type | Description |
---|---|
JustLatticeChord
|
A transposed JustLatticeChord |
Note
Returns a copy
Examples:
>>> chord = JustLatticeChord.from_name(60, [0, 0, 0], 'minor triad')
>>> node = [1, 0, 0]
>>> chord.transpose(node)
JustLatticeChord(60.0 Hz, [3/2, 9/5, 9/8], [5-3-15])
Source code in /opt/hostedtoolcache/Python/3.11.3/x64/lib/python3.11/site-packages/jintonic/chords.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|