Fix ziffers chords

This commit is contained in:
2023-09-19 00:07:04 +03:00
parent 7e0bf58aff
commit 2644c34e7a
2 changed files with 10 additions and 17 deletions

View File

@ -230,7 +230,7 @@ export class SoundEvent extends AudibleEvent {
// Frequency management // Frequency management
public sound = (value: string) => this.updateValue("s", value); public sound = (value: string) => this.updateValue("s", value);
public chord = (value: number[]) => this.updateValue("chord", value); public chord = (value: object[]) => this.updateValue("chord", value);
public snd = this.sound; public snd = this.sound;
public nudge = (value: number) => this.updateValue("nudge", value); public nudge = (value: number) => this.updateValue("nudge", value);
public cut = (value: number) => this.updateValue("cut", value); public cut = (value: number) => this.updateValue("cut", value);
@ -292,11 +292,11 @@ export class SoundEvent extends AudibleEvent {
out = (): void => { out = (): void => {
if (this.values.chord) { if (this.values.chord) {
this.values.chord.forEach((freq: number) => { this.values.chord.forEach((obj: {[key: string]: number}) => {
const copy = { ...this.values }; const copy = {...this.values};
copy.freq = freq; copy.freq = obj.freq
// This is pure non-sense but I need to adapt somehow // This is pure non-sense but I need to adapt somehow
superdough(copy, this.values.dur * 2, this.values.dur); superdough(copy, copy.dur*2, copy.dur);
}); });
} else { } else {
// This is pure non-sense but I need to adapt somehow // This is pure non-sense but I need to adapt somehow

View File

@ -137,19 +137,12 @@ export class Player extends Event {
if (this.areWeThereYet()) { if (this.areWeThereYet()) {
const event = this.next() as Pitch | Chord | ZRest; const event = this.next() as Pitch | Chord | ZRest;
if (event instanceof Pitch) { if (event instanceof Pitch) {
const obj = event.getExisting( return new SoundEvent({dur: event.duration, freq: event.freq}, this.app).sound(name);
"freq",
"pitch",
"key",
"scale",
"octave",
"parsedScale"
);
obj.dur = event.duration;
return new SoundEvent(obj, this.app).sound(name);
} else if (event instanceof Chord) { } else if (event instanceof Chord) {
const pitches = event.freqs(); const pitches = event.pitches.map((p) => {
return new SoundEvent(event, this.app).chord(pitches).sound(name); return {freq: p.freq}
});
return new SoundEvent({dur: event.duration}, this.app).chord(pitches).sound(name);
} else if (event instanceof ZRest) { } else if (event instanceof ZRest) {
return RestEvent.createRestProxy(event.duration, this.app); return RestEvent.createRestProxy(event.duration, this.app);
} }