Skip to main content
deleted 7 characters in body
Source Link
recursive
  • 10.5k
  • 21
  • 36

Stax, 25 24 bytes

╝─°U┤ƒXz☺=∞♫8åì=Só╢♀↔$è◄╝─°U┤ƒXz☺=≡eA╕δ┴╬\¿☺zt┼§ 

Run and debug it onlineRun and debug it online

The corresponding ascii representation of the same program is this.

{h9%H_H32/-c2>c4>-c7>c9>-mrE-v12%^^ 

Effectively, it calculates the keyboard index of each note using a formula, then calculates the resulting interval.

  1. Start from the base note, A = 02, B = 24, ... G = 1214
  2. Calculate the accidental offset 2 - code / 32 where code is the ascii code of the last character.
  3. Add them together.
  4. If the result is > 24, subtract 1 to remove B#.
  5. If the result is > 7, subtract 1 to remove E#.
  6. Modularly subtract the two resulting note indexes, and add 1.

Stax, 25 24 bytes

╝─°U┤ƒXz☺=∞♫8åì=Só╢♀↔$è◄ 

Run and debug it online

The corresponding ascii representation of the same program is this.

{h9%H_H32/-c2>-c7>-mrE-v12%^^ 

Effectively, it calculates the keyboard index of each note using a formula, then calculates the resulting interval.

  1. Start from the base note, A = 0, B = 2, ... G = 12
  2. Calculate the accidental offset 2 - code / 32 where code is the ascii code of the last character.
  3. Add them together.
  4. If the result is > 2, subtract 1 to remove B#.
  5. If the result is > 7, subtract 1 to remove E#.
  6. Modularly subtract the two resulting note indexes, and add 1.

Stax, 25 24 bytes

╝─°U┤ƒXz☺=≡eA╕δ┴╬\¿☺zt┼§ 

Run and debug it online

The corresponding ascii representation of the same program is this.

{h9%H_H32/-c4>-c9>-mrE-v12%^^ 

Effectively, it calculates the keyboard index of each note using a formula, then calculates the resulting interval.

  1. Start from the base note, A = 2, B = 4, ... G = 14
  2. Calculate the accidental offset 2 - code / 32 where code is the ascii code of the last character.
  3. Add them together.
  4. If the result is > 4, subtract 1 to remove B#.
  5. If the result is > 7, subtract 1 to remove E#.
  6. Modularly subtract the two resulting note indexes, and add 1.
added 51 characters in body
Source Link
recursive
  • 10.5k
  • 21
  • 36

Stax, 25 25 24 bytes

ûì↑'╬•!╒Fu·ÖF∙εi┬○aÄ~≈►ê9╝─°U┤ƒXz☺=∞♫8åì=Só╢♀↔$è◄ 

Run and debug it onlineRun and debug it online

The corresponding ascii representation of the same program is this.

{h63-H_H32h9%H_H32/-c2>-c7>-mrE-v12%^^ 

Effectively, it calculates the keyboard index of each note using a formula, then calculates the resulting interval.

  1. Start from the base note, A = 0, B = 2, ... G = 12
  2. Calculate the accidental offset 2 - code / 32 where code is the ascii code of the last character.
  3. Add them together.
  4. If the result is > 2, subtract 1 to remove B#.
  5. If the result is > 7, subtract 1 to remove E#.
  6. Modularly subtract the two resulting note indexes, and add 1.

Stax, 25 bytes

ûì↑'╬•!╒Fu·ÖF∙εi┬○aÄ~≈►ê9 

Run and debug it online

The corresponding ascii representation of the same program is this.

{h63-H_H32/-c2>-c7>-mrE-v12%^^ 

Effectively, it calculates the keyboard index of each note using a formula, then calculates the resulting interval.

  1. Start from the base note, A = 0, B = 2, ... G = 12
  2. Calculate the accidental offset 2 - code / 32 where code is the ascii code of the last character.
  3. Add them together.
  4. If the result is > 2, subtract 1 to remove B#.
  5. If the result is > 7, subtract 1 to remove E#.
  6. Modularly subtract the two resulting note indexes, and add 1.

Stax, 25 24 bytes

╝─°U┤ƒXz☺=∞♫8åì=Só╢♀↔$è◄ 

Run and debug it online

The corresponding ascii representation of the same program is this.

{h9%H_H32/-c2>-c7>-mrE-v12%^^ 

Effectively, it calculates the keyboard index of each note using a formula, then calculates the resulting interval.

  1. Start from the base note, A = 0, B = 2, ... G = 12
  2. Calculate the accidental offset 2 - code / 32 where code is the ascii code of the last character.
  3. Add them together.
  4. If the result is > 2, subtract 1 to remove B#.
  5. If the result is > 7, subtract 1 to remove E#.
  6. Modularly subtract the two resulting note indexes, and add 1.
Source Link
recursive
  • 10.5k
  • 21
  • 36

Stax, 25 bytes

ûì↑'╬•!╒Fu·ÖF∙εi┬○aÄ~≈►ê9 

Run and debug it online

The corresponding ascii representation of the same program is this.

{h63-H_H32/-c2>-c7>-mrE-v12%^^ 

Effectively, it calculates the keyboard index of each note using a formula, then calculates the resulting interval.

  1. Start from the base note, A = 0, B = 2, ... G = 12
  2. Calculate the accidental offset 2 - code / 32 where code is the ascii code of the last character.
  3. Add them together.
  4. If the result is > 2, subtract 1 to remove B#.
  5. If the result is > 7, subtract 1 to remove E#.
  6. Modularly subtract the two resulting note indexes, and add 1.