How to use the st/music.KeySignature.allKeySignatures 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 / chord_generators.es6 View on Github external
constructor(keySignature, opts={}) {
    super(keySignature, opts)

    let keys = KeySignature.allKeySignatures()
    this.chordToKeys = {}
    for (let key of keys) {
      for (let chord of new MajorScale(key).allChords(this.noteCount)) {
        let cName = chord.toString()
        this.chordToKeys[cName] = this.chordToKeys[cName] || []
        this.chordToKeys[cName].push(key)
      }
    }
  }
github leafo / sightreading.training / static / js / components / flash_cards / chord_identification_exercise.es6 View on Github external
setupNext() {
    let sigs = KeySignature.allKeySignatures().filter(ks =>
      this.props.settings.keySignatures["" + ks.count]
    )

    let notes = 3
    let keySignature = sigs[this.rand.int() % sigs.length]

    if (!keySignature) {
      this.setState({
        currentCard: null
      })

      return
    }

    if (!this.generators) {
      this.generators = {}
github leafo / sightreading.training / static / js / components / sight_reading / settings_panel.es6 View on Github external
renderKeys() {
    let keyButton = (key) =>
      <button> {
          this.props.setKeySignature(key)
        }}
        className={classNames("toggle_option", {
          active: this.props.currentKey.name() == key.name()
        })}
        key={key.name()}&gt;
          {key.name()}
        </button>


    return KeySignature.allKeySignatures().concat([
      new ChromaticKeySignature()
    ]).map(key =&gt; keyButton(key))
  }
}
github leafo / sightreading.training / static / js / components / flash_cards / chord_identification_exercise.es6 View on Github external
render() {
      let settings = this.props.currentSettings

      return <div>
        <section>
          <h4>Key signature</h4>
          {KeySignature.allKeySignatures().map(ks =&gt; {
            let count = "" + ks.count
            return <label>
              <input checked="{settings.keySignatures[count]">
                  this.props.updateSettings({
                    ...settings,
                    keySignatures: {
                      ...settings.keySignatures,
                      [count]: !settings.keySignatures[count]
                    }
                  })
                }
                type="checkbox" /&gt;
              {" "}
              {ks.name()}</label></section></div>