Merge branch 'main' into fix-tutorial-bugs
This commit is contained in:
commit
85d0d06cab
33 changed files with 3796 additions and 2764 deletions
|
|
@ -26,7 +26,7 @@
|
|||
"homepage": "https://github.com/tidalcycles/strudel#readme",
|
||||
"dependencies": {
|
||||
"@strudel.cycles/core": "^0.4.1",
|
||||
"@tonaljs/tonal": "^4.6.5",
|
||||
"@tonaljs/tonal": "^4.7.2",
|
||||
"chord-voicings": "^0.0.1",
|
||||
"webmidi": "^3.0.21"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@ import { describe, it, expect } from 'vitest';
|
|||
|
||||
describe('tonal', () => {
|
||||
it('Should run tonal functions ', () => {
|
||||
expect(pure('c3').scale('C major').scaleTranspose(1)._firstCycleValues).toEqual(['D3']);
|
||||
expect(pure('c3').scale('C major').scaleTranspose(1).firstCycleValues).toEqual(['D3']);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ function scaleOffset(scale, offset, note) {
|
|||
*/
|
||||
|
||||
Pattern.prototype._transpose = function (intervalOrSemitones) {
|
||||
return this._withHap((hap) => {
|
||||
return this.withHap((hap) => {
|
||||
const interval = !isNaN(Number(intervalOrSemitones))
|
||||
? Interval.fromSemitones(intervalOrSemitones /* as number */)
|
||||
: String(intervalOrSemitones);
|
||||
|
|
@ -111,7 +111,7 @@ Pattern.prototype._transpose = function (intervalOrSemitones) {
|
|||
*/
|
||||
|
||||
Pattern.prototype._scaleTranspose = function (offset /* : number | string */) {
|
||||
return this._withHap((hap) => {
|
||||
return this.withHap((hap) => {
|
||||
if (!hap.context.scale) {
|
||||
throw new Error('can only use scaleTranspose after .scale');
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ Pattern.prototype._scaleTranspose = function (offset /* : number | string */) {
|
|||
*/
|
||||
|
||||
Pattern.prototype._scale = function (scale /* : string */) {
|
||||
return this._withHap((hap) => {
|
||||
return this.withHap((hap) => {
|
||||
let note = hap.value;
|
||||
const asNumber = Number(note);
|
||||
if (!isNaN(asNumber)) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ Pattern.prototype.voicings = function (range) {
|
|||
}
|
||||
return this.fmapNested((event) => {
|
||||
lastVoicing = getVoicing(event.value, lastVoicing, range);
|
||||
return stack(...lastVoicing)._withContext(() => ({
|
||||
return stack(...lastVoicing).withContext(() => ({
|
||||
locations: event.context.locations || [],
|
||||
}));
|
||||
});
|
||||
|
|
@ -59,7 +59,7 @@ Pattern.prototype.voicings = function (range) {
|
|||
|
||||
Pattern.prototype._rootNotes = function (octave = 2) {
|
||||
return this.fmap((value) => {
|
||||
const [_, root] = value.match(/^([a-gA-G][b#]?).*$/);
|
||||
const root = value.match(/^([a-gA-G][b#]?).*$/)[1];
|
||||
return root + octave;
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue