You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/js/map.mdx
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -173,6 +173,7 @@ constructor(
173
173
fifth: number,
174
174
referencePitch?:string,
175
175
referenceFreq?:number
176
+
midiMap?:Map1D;
176
177
);
177
178
```
178
179
@@ -241,11 +242,29 @@ T.toCents(m); // 400
241
242
toRatio(m: Interval): number;
242
243
```
243
244
244
-
returns the ratio of the passed `Interval` as a decimal number.
245
+
Returns the ratio of the passed `Interval` as a decimal number.
245
246
246
247
```ts
247
248
const T =TuningMap.fromEDO(31);
248
249
249
250
let m =Interval.fromName("A6");
250
251
T.toRatio(m); // 1.7489046221194973
251
252
```
253
+
254
+
### `toMIDI`
255
+
256
+
```ts
257
+
toMIDI(p: Pitch): number;
258
+
```
259
+
260
+
Returns an ordered pitch numbering for the passed `Pitch` as an integer. Available in any EDO `TuningMap` created via `TuningMap.fromEDO`. For 12TET, this will be the ordinary MIDI value for a given `Pitch`, but for other EDO tunings it provides an ordered MIDI-equvalent mapping.
Copy file name to clipboardExpand all lines: src/content/docs/js/pitch.mdx
+52-9Lines changed: 52 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -172,6 +172,22 @@ let p = SPN.toPitch("F4");
172
172
p.octave; // 4
173
173
```
174
174
175
+
### `intervalTo`
176
+
177
+
```ts
178
+
intervalTo(p: Pitch): Interval;
179
+
```
180
+
181
+
Returns the [`Interval`](/js/interval) from the current Pitch to another passed-in vector. Often a more convenient way to access [`Interval.between`](/js/interval/#intervalbetween)
182
+
183
+
```ts
184
+
let p =SPN.toPitch("C4");
185
+
let q =SPN.toPitch("E4");
186
+
187
+
let m =p.intervalTo(q); // m now holds a major third Interval
188
+
let n =Interval.between(p, q); // equivalent
189
+
```
190
+
175
191
### `stepsTo`
176
192
177
193
```ts
@@ -278,26 +294,53 @@ p = SPN.toPitch("Bbb4")
278
294
p.alterationIn(context); // -2, Bbb is too flat for this context
279
295
```
280
296
281
-
##Transformations
297
+
### `highest`
282
298
283
-
The following methods produce a new vector from the current `Pitch`. None of them mutate the original object.
299
+
```ts
300
+
highest(arr: Pitch[], T?:TuningMap): Pitch;
301
+
```
284
302
285
-
### `intervalTo`
303
+
Returns the highest `Pitch` in a passed-in array. Uses an optional `TuningMap` to determine which `Pitch` is higher than the others; if no `TuningMap` is passed in, defaults to 12TET.
Returns the [`Interval`](/js/interval) from the current Pitch to another passed-in vector. Often a more convenient way to access [`Interval.between`](/js/interval/#intervalbetween)
311
+
### `lowest`
292
312
293
313
```ts
294
-
let p =SPN.toPitch("C4");
295
-
let q =SPN.toPitch("E4");
314
+
lowest(arr: Pitch[], T?:TuningMap): Pitch;
315
+
```
296
316
297
-
let m =p.intervalTo(q); // m now holds a major third Interval
298
-
let n =Interval.between(p, q); // equivalent
317
+
Returns the lowest `Pitch` in a passed-in array. Uses an optional `TuningMap` to determine which `Pitch` is lower than the others; if no `TuningMap` is passed in, defaults to 12TET.
Returns the nearest `Pitch` in a passed-in array to the calling `Pitch` instance. Uses an optional `TuningMap` to determine which `Pitch` is lower than the others; if no `TuningMap` is passed in, defaults to 12TET.
0 commit comments