How to use the st/music.Chord function in st

To help you get started, we’ve selected a few st examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leafo / sightreading.training / static / js / generators.es6 View on Github external
notesInRandomChord() {
    let degree = 1 + this.generator.int() % this.scale.steps.length
    let steps = this.scale.buildChordSteps(degree, 3) // seven chords
    let chord = new Chord(this.scale.degreeToName(degree), steps)
    this.lastChord = chord
    return this.notes.filter(n => chord.containsNote(n))
  }
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("gets the chord name of a m chord", function() {
      let chord = new Chord("E", "m");
      expect(chord.chordShapeName()).toBe("m")
    })
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("checks if chords are dominant", function() {
      expect(new Chord("A", "m7b5").isDominant()).toBe(false)
      expect(new Chord("F#", "7").isDominant()).toBe(true)
      expect(new Chord("G", "M").isDominant()).toBe(true)
      expect(new Chord("G", "m").isDominant()).toBe(false)
    })
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("gets the chord name of a 7 chord", function() {
      let chord = new Chord("F", "7");
      expect(chord.chordShapeName()).toBe("7")
    })
github leafo / sightreading.training / static / spec / generators_spec.es6 View on Github external
it("gets all chords for scale", function() {
    let generator = new ChordGenerator(new KeySignature(0))
    let chords = generator.allChords()

    expect(chords).toEqual([
      new Chord("C", "M"),
      new Chord("D", "m"),
      new Chord("E", "m"),
      new Chord("F", "M"),
      new Chord("G", "M"),
      new Chord("A", "m"),
      new Chord("B", "dim"),
    ])
  })
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("gets the chord name of a m7 chord", function() {
      let chord = new Chord("G", "m7");
      expect(chord.chordShapeName()).toBe("m7")
    })
github leafo / sightreading.training / static / spec / generators_spec.es6 View on Github external
it("gets all chords for scale", function() {
    let generator = new ChordGenerator(new KeySignature(0))
    let chords = generator.allChords()

    expect(chords).toEqual([
      new Chord("C", "M"),
      new Chord("D", "m"),
      new Chord("E", "m"),
      new Chord("F", "M"),
      new Chord("G", "M"),
      new Chord("A", "m"),
      new Chord("B", "dim"),
    ])
  })
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("gets the chord name of a M7 chord", function() {
      let chord = new Chord("C", "M7");
      expect(chord.chordShapeName()).toBe("M7")
    })
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("gets the chord name of a m7b5 chord", function() {
      let chord = new Chord("A", "m7b5");
      expect(chord.chordShapeName()).toBe("m7b5")
    })
  })
github leafo / sightreading.training / static / spec / generators_spec.es6 View on Github external
it("gets all chords for scale", function() {
    let generator = new ChordGenerator(new KeySignature(0))
    let chords = generator.allChords()

    expect(chords).toEqual([
      new Chord("C", "M"),
      new Chord("D", "m"),
      new Chord("E", "m"),
      new Chord("F", "M"),
      new Chord("G", "M"),
      new Chord("A", "m"),
      new Chord("B", "dim"),
    ])
  })