Skip to main content
deleted 2930 characters in body
Source Link
badatgolf
  • 1.5k
  • 4
  • 7

Print the notes of an increasing octave-repeating scale.Print the notes of an increasing octave-repeating scale.

Challange

To quote Wikipedia:

An octave-repeating scale can be represented as a circular arrangement of pitch classes, ordered by increasing (or decreasing) pitch class. For instance, the increasing C major scale is C–D–E–F–G–A–B–[C], with the bracket indicating that the last note is an octave higher than the first note.

Major scales are defined by their combination of semitones and tones (whole steps and half steps):

Tone – Tone – Semitone – Tone – Tone – Tone – Semitone

Or in whole steps and half steps, it would be:

Whole – Whole – Half – Whole – Whole – Whole – Half

So, for example, in the C major scale, we first start with the C note. enter image description here Then we go up a tone (whole step) to a D enter image description here Another tone (whole step) to an E enter image description here Now a semitone (half step) to an F enter image description here Tone (whole step) to a G enter image description here Tone (whole step) to an A enter image description here Tone (whole step) to a B enter image description here And finally, a semitone (half step) to a C again enter image description here A minor scale (I'm talking about the natural minor scale as opposed to the harmonic minor scale and the melodic minor scale) follows the following formula

Tone – Semitone – Tone – Tone – Semitone – Tone – Tone

or

Whole – Half  – Whole – Whole – Half – Whole – Whole 

So, the C minor scale will look like enter image description here or, as letters: C, D, D#, F, G, G#, A#

So, your job today, is given a major or minor scale, print the notes.

Input/Output

  • Input/Output can be taken in any reasonable format for taking the name of the scale and returning the set of the increasing octave-repeating notes of that scale.

  • You don't need to print out the last note.

  • If the notes are enharmonic equivalent (same note but different names eg A#/Bb), you can print either of them, but you can't print C as B# or E as Fb)

  • If the scales are enharmonic equivalent (same scale but different names eg G#m and Abm), you have to handle both of them.

Input -> Output
C -> [C, D, E, F, G, A, B]
Cm -> [C, D, Eb (D#), F, G, Ab (G#), Bb (A#)]
G -> [G, A, B, C, D, E, F# (Gb)]
F#m -> [F# (Gb) – G# (Ab) – A – B – C# (Db) – D – E]

This is , so the shortest answer (in bytes) wins!

Print the notes of an increasing octave-repeating scale.

Challange

To quote Wikipedia:

An octave-repeating scale can be represented as a circular arrangement of pitch classes, ordered by increasing (or decreasing) pitch class. For instance, the increasing C major scale is C–D–E–F–G–A–B–[C], with the bracket indicating that the last note is an octave higher than the first note.

Major scales are defined by their combination of semitones and tones (whole steps and half steps):

Tone – Tone – Semitone – Tone – Tone – Tone – Semitone

Or in whole steps and half steps, it would be:

Whole – Whole – Half – Whole – Whole – Whole – Half

So, for example, in the C major scale, we first start with the C note. enter image description here Then we go up a tone (whole step) to a D enter image description here Another tone (whole step) to an E enter image description here Now a semitone (half step) to an F enter image description here Tone (whole step) to a G enter image description here Tone (whole step) to an A enter image description here Tone (whole step) to a B enter image description here And finally, a semitone (half step) to a C again enter image description here A minor scale (I'm talking about the natural minor scale as opposed to the harmonic minor scale and the melodic minor scale) follows the following formula

Tone – Semitone – Tone – Tone – Semitone – Tone – Tone

or

Whole – Half  – Whole – Whole – Half – Whole – Whole 

So, the C minor scale will look like enter image description here or, as letters: C, D, D#, F, G, G#, A#

So, your job today, is given a major or minor scale, print the notes.

Input/Output

  • Input/Output can be taken in any reasonable format for taking the name of the scale and returning the set of the increasing octave-repeating notes of that scale.

  • You don't need to print out the last note.

  • If the notes are enharmonic equivalent (same note but different names eg A#/Bb), you can print either of them, but you can't print C as B# or E as Fb)

  • If the scales are enharmonic equivalent (same scale but different names eg G#m and Abm), you have to handle both of them.

Input -> Output
C -> [C, D, E, F, G, A, B]
Cm -> [C, D, Eb (D#), F, G, Ab (G#), Bb (A#)]
G -> [G, A, B, C, D, E, F# (Gb)]
F#m -> [F# (Gb) – G# (Ab) – A – B – C# (Db) – D – E]

This is , so the shortest answer (in bytes) wins!

added 2125 characters in body
Source Link
badatgolf
  • 1.5k
  • 4
  • 7

Major scales are defined by their combination of semitones and tones (whole steps and half steps):

Tone – Tone – Semitone – Tone – Tone – Tone – Semitone

Or in whole steps and half steps, it would be:

Whole – Whole – Half – Whole – Whole – Whole – Half

So, for example, in the C major scale, we first start with the C note. enter image description here Then we go up a tone (whole step) to a D enter image description here Another tone (whole step) to an E enter image description here Now a semitone (half step) to an F enter image description here Tone (whole step) to a G enter image description here Tone (whole step) to an A enter image description here Tone (whole step) to a B enter image description here And finally, a semitone (half step) to a C again enter image description here A minor scale (I'm talking about the natural minor scale as opposed to the harmonic minor scale and the melodic minor scale) follows the following formula

Tone – Semitone – Tone – Tone – Semitone – Tone – Tone

or

Whole – Half  – Whole – Whole – Half – Whole – Whole 

So, the C minor scale will look like enter image description here or, as letters: C, D, D#, F, G, G#, A#

So, your job today, is given a major or minor scale, print the notes.

Input/Output can be taken in any reasonable format for taking the name of the scale and returning the set of the increasing octave-repeating notes of that scale.

  • Input/Output can be taken in any reasonable format for taking the name of the scale and returning the set of the increasing octave-repeating notes of that scale.

  • You don't need to print out the last note.

  • If the notes are enharmonic equivalent (same note but different names eg A#/Bb), you can print either of them, but you can't print C as B# or E as Fb)

  • If the scales are enharmonic equivalent (same scale but different names eg G#m and Abm), you have to handle both of them.

Input -> Output
C -> [C, D, E, F, G, A, B]
Cm -> [C, D, Eb (D#), F, G, Ab (G#), Bb (A#)]
G -> [G, A, B, C, D, E, F# (Gb)]
F#m -> [F# (Gb) – G# (Ab) – A – B – C# (Db) – D – E]

So, your job today, is given a major or minor scale, print the notes.

Input/Output can be taken in any reasonable format for taking the name of the scale and returning the set of the increasing octave-repeating notes of that scale.

Input -> Output
C -> [C, D, E, F, G, A, B]
Cm -> [C, D, Eb (D#), F, G, Ab (G#), Bb (A#)]
G -> [G, A, B, C, D, E, F# (Gb)]

Major scales are defined by their combination of semitones and tones (whole steps and half steps):

Tone – Tone – Semitone – Tone – Tone – Tone – Semitone

Or in whole steps and half steps, it would be:

Whole – Whole – Half – Whole – Whole – Whole – Half

So, for example, in the C major scale, we first start with the C note. enter image description here Then we go up a tone (whole step) to a D enter image description here Another tone (whole step) to an E enter image description here Now a semitone (half step) to an F enter image description here Tone (whole step) to a G enter image description here Tone (whole step) to an A enter image description here Tone (whole step) to a B enter image description here And finally, a semitone (half step) to a C again enter image description here A minor scale (I'm talking about the natural minor scale as opposed to the harmonic minor scale and the melodic minor scale) follows the following formula

Tone – Semitone – Tone – Tone – Semitone – Tone – Tone

or

Whole – Half  – Whole – Whole – Half – Whole – Whole 

So, the C minor scale will look like enter image description here or, as letters: C, D, D#, F, G, G#, A#

So, your job today, is given a major or minor scale, print the notes.

  • Input/Output can be taken in any reasonable format for taking the name of the scale and returning the set of the increasing octave-repeating notes of that scale.

  • You don't need to print out the last note.

  • If the notes are enharmonic equivalent (same note but different names eg A#/Bb), you can print either of them, but you can't print C as B# or E as Fb)

  • If the scales are enharmonic equivalent (same scale but different names eg G#m and Abm), you have to handle both of them.

Input -> Output
C -> [C, D, E, F, G, A, B]
Cm -> [C, D, Eb (D#), F, G, Ab (G#), Bb (A#)]
G -> [G, A, B, C, D, E, F# (Gb)]
F#m -> [F# (Gb) – G# (Ab) – A – B – C# (Db) – D – E]
Source Link
badatgolf
  • 1.5k
  • 4
  • 7

Print the notes of an increasing octave-repeating scale.

Challange

To quote Wikipedia:

An octave-repeating scale can be represented as a circular arrangement of pitch classes, ordered by increasing (or decreasing) pitch class. For instance, the increasing C major scale is C–D–E–F–G–A–B–[C], with the bracket indicating that the last note is an octave higher than the first note.

So, your job today, is given a major or minor scale, print the notes.

Input/Output

Input/Output can be taken in any reasonable format for taking the name of the scale and returning the set of the increasing octave-repeating notes of that scale.

Input -> Output
C -> [C, D, E, F, G, A, B]
Cm -> [C, D, Eb (D#), F, G, Ab (G#), Bb (A#)]
G -> [G, A, B, C, D, E, F# (Gb)]

This is , so the shortest answer (in bytes) wins!