Navigation Menu

Skip to content

Commit

Permalink
smoothness for progression
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Jun 22, 2016
1 parent 2c08bfd commit abcfef5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/data.es6
Expand Up @@ -120,6 +120,7 @@ N.GENERATORS = [
{
name: "progression",
inputs: [
smoothInput,
{
name: "progression",
type: "select",
Expand Down Expand Up @@ -186,7 +187,7 @@ N.GENERATORS = [
let scale = new MajorScale(keySignature)
let progressionInputs = this.inputs.find(i => i.name == "progression")
let progression = progressionInputs.values.find(v => v.name == options.progression)
return new ProgressionGenerator(scale, staff.range, progression.value)
return new ProgressionGenerator(scale, staff.range, progression.value, options)
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/generators.es6
Expand Up @@ -439,8 +439,9 @@ export class SevenOpenNotes extends ShapeGenerator {
}
}

export class ProgressionGenerator {
constructor(scale, range, progression) {
export class ProgressionGenerator extends Generator {
constructor(scale, range, progression, opts) {
super(opts)
this.position = 0
this.progression = progression
this.generator = new MersenneTwister()
Expand All @@ -458,7 +459,7 @@ export class ProgressionGenerator {
}
}

nextNote() {
_nextNote() {
let [degree, shape] = this.progression[this.position % this.progression.length]
this.position += 1

Expand Down

0 comments on commit abcfef5

Please sign in to comment.