Skip to content

Commit

Permalink
fix(synth/daft): check octave range when playing sound
Browse files Browse the repository at this point in the history
  • Loading branch information
domi7777 committed Nov 14, 2024
1 parent 18baf30 commit 10e2802
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/scenes/DaftSynthScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class DaftSynthScene extends SimpleSynthScene {
}

playSound(index: number): void {
index += this.getNoteIndexOffset();
const note = allFrequencies[index].freq;
logger.log('Playing note', note);
return playDaftPunkSynth({
Expand Down
4 changes: 2 additions & 2 deletions src/scenes/SimpleSynthScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ export class SimpleSynthScene extends PadsScene {
/**
* when changing the range of the notes, we need to offset the index to get the correct note
*/
private getNoteIndexOffset() {
protected getNoteIndexOffset() {
return this.getLowerRangeIndex() * numberOfNotes;
}

private getLowerRangeIndex() {
protected getLowerRangeIndex() {
return this.settings.octaveRange!.min - 1;
}

Expand Down

0 comments on commit 10e2802

Please sign in to comment.