How to use the st/music.notesSame 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 / spec / music_spec.es6 View on Github external
it("notesSame", function() {
    expect(notesSame("C5", "C6")).toBe(true);
    expect(notesSame("C5", "C5")).toBe(true);

    expect(notesSame("C5", "D5")).toBe(false);
    expect(notesSame("C#5", "C5")).toBe(false);
    expect(notesSame("Ab5", "A3")).toBe(false);

    expect(notesSame("Db5", "Db6")).toBe(true);
    expect(notesSame("G#5", "G#7")).toBe(true);

    // wrapping
    expect(notesSame("B#5", "C6")).toBe(true);
    expect(notesSame("B#5", "C7")).toBe(true);

    expect(notesSame("B3", "Cb5")).toBe(true);
    expect(notesSame("B5", "Cb3")).toBe(true);
  });
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("notesSame", function() {
    expect(notesSame("C5", "C6")).toBe(true);
    expect(notesSame("C5", "C5")).toBe(true);

    expect(notesSame("C5", "D5")).toBe(false);
    expect(notesSame("C#5", "C5")).toBe(false);
    expect(notesSame("Ab5", "A3")).toBe(false);

    expect(notesSame("Db5", "Db6")).toBe(true);
    expect(notesSame("G#5", "G#7")).toBe(true);

    // wrapping
    expect(notesSame("B#5", "C6")).toBe(true);
    expect(notesSame("B#5", "C7")).toBe(true);

    expect(notesSame("B3", "Cb5")).toBe(true);
    expect(notesSame("B5", "Cb3")).toBe(true);
  });
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("notesSame", function() {
    expect(notesSame("C5", "C6")).toBe(true);
    expect(notesSame("C5", "C5")).toBe(true);

    expect(notesSame("C5", "D5")).toBe(false);
    expect(notesSame("C#5", "C5")).toBe(false);
    expect(notesSame("Ab5", "A3")).toBe(false);

    expect(notesSame("Db5", "Db6")).toBe(true);
    expect(notesSame("G#5", "G#7")).toBe(true);

    // wrapping
    expect(notesSame("B#5", "C6")).toBe(true);
    expect(notesSame("B#5", "C7")).toBe(true);

    expect(notesSame("B3", "Cb5")).toBe(true);
    expect(notesSame("B5", "Cb3")).toBe(true);
  });
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("notesSame", function() {
    expect(notesSame("C5", "C6")).toBe(true);
    expect(notesSame("C5", "C5")).toBe(true);

    expect(notesSame("C5", "D5")).toBe(false);
    expect(notesSame("C#5", "C5")).toBe(false);
    expect(notesSame("Ab5", "A3")).toBe(false);

    expect(notesSame("Db5", "Db6")).toBe(true);
    expect(notesSame("G#5", "G#7")).toBe(true);

    // wrapping
    expect(notesSame("B#5", "C6")).toBe(true);
    expect(notesSame("B#5", "C7")).toBe(true);

    expect(notesSame("B3", "Cb5")).toBe(true);
    expect(notesSame("B5", "Cb3")).toBe(true);
  });
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("notesSame", function() {
    expect(notesSame("C5", "C6")).toBe(true);
    expect(notesSame("C5", "C5")).toBe(true);

    expect(notesSame("C5", "D5")).toBe(false);
    expect(notesSame("C#5", "C5")).toBe(false);
    expect(notesSame("Ab5", "A3")).toBe(false);

    expect(notesSame("Db5", "Db6")).toBe(true);
    expect(notesSame("G#5", "G#7")).toBe(true);

    // wrapping
    expect(notesSame("B#5", "C6")).toBe(true);
    expect(notesSame("B#5", "C7")).toBe(true);

    expect(notesSame("B3", "Cb5")).toBe(true);
    expect(notesSame("B5", "Cb3")).toBe(true);
  });
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("notesSame", function() {
    expect(notesSame("C5", "C6")).toBe(true);
    expect(notesSame("C5", "C5")).toBe(true);

    expect(notesSame("C5", "D5")).toBe(false);
    expect(notesSame("C#5", "C5")).toBe(false);
    expect(notesSame("Ab5", "A3")).toBe(false);

    expect(notesSame("Db5", "Db6")).toBe(true);
    expect(notesSame("G#5", "G#7")).toBe(true);

    // wrapping
    expect(notesSame("B#5", "C6")).toBe(true);
    expect(notesSame("B#5", "C7")).toBe(true);

    expect(notesSame("B3", "Cb5")).toBe(true);
    expect(notesSame("B5", "Cb3")).toBe(true);
  });
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("notesSame", function() {
    expect(notesSame("C5", "C6")).toBe(true);
    expect(notesSame("C5", "C5")).toBe(true);

    expect(notesSame("C5", "D5")).toBe(false);
    expect(notesSame("C#5", "C5")).toBe(false);
    expect(notesSame("Ab5", "A3")).toBe(false);

    expect(notesSame("Db5", "Db6")).toBe(true);
    expect(notesSame("G#5", "G#7")).toBe(true);

    // wrapping
    expect(notesSame("B#5", "C6")).toBe(true);
    expect(notesSame("B#5", "C7")).toBe(true);

    expect(notesSame("B3", "Cb5")).toBe(true);
    expect(notesSame("B5", "Cb3")).toBe(true);
  });
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("notesSame", function() {
    expect(notesSame("C5", "C6")).toBe(true);
    expect(notesSame("C5", "C5")).toBe(true);

    expect(notesSame("C5", "D5")).toBe(false);
    expect(notesSame("C#5", "C5")).toBe(false);
    expect(notesSame("Ab5", "A3")).toBe(false);

    expect(notesSame("Db5", "Db6")).toBe(true);
    expect(notesSame("G#5", "G#7")).toBe(true);

    // wrapping
    expect(notesSame("B#5", "C6")).toBe(true);
    expect(notesSame("B#5", "C7")).toBe(true);

    expect(notesSame("B3", "Cb5")).toBe(true);
    expect(notesSame("B5", "Cb3")).toBe(true);
  });
github leafo / sightreading.training / static / spec / music_spec.es6 View on Github external
it("notesSame", function() {
    expect(notesSame("C5", "C6")).toBe(true);
    expect(notesSame("C5", "C5")).toBe(true);

    expect(notesSame("C5", "D5")).toBe(false);
    expect(notesSame("C#5", "C5")).toBe(false);
    expect(notesSame("Ab5", "A3")).toBe(false);

    expect(notesSame("Db5", "Db6")).toBe(true);
    expect(notesSame("G#5", "G#7")).toBe(true);

    // wrapping
    expect(notesSame("B#5", "C6")).toBe(true);
    expect(notesSame("B#5", "C7")).toBe(true);

    expect(notesSame("B3", "Cb5")).toBe(true);
    expect(notesSame("B5", "Cb3")).toBe(true);
  });
github leafo / sightreading.training / static / js / note_list.es6 View on Github external
if (Array.isArray(first)) {
      if (first.length != notes.length) {
        return false;
      }
      if (anyOctave) {
        let noteSet = {}
        notes.forEach((n) => noteSet[n.replace(/\d+$/, "")] = true)
        return first.every((n) => noteSet[n.replace(/\d+$/, "")])
      } else {
        const pitches = notes.map(parseNote)
        return first.map(parseNote).every((n) => pitches.indexOf(n) >= 0)
      }
    } else {
      if (anyOctave) {
        return notes.length == 1 && notesSame(notes[0], first)
      } else {
        return notes.length == 1 && parseNote(notes[0]) == parseNote(first)
      }

    }
  }