Skip to main content
added 60 characters in body
Source Link
emanresu A
  • 46.8k
  • 5
  • 119
  • 258

Vyxal, 3534 bytes

«⟑,HǎẆṀ,‹¹β»Ẇ→| e׫⌈:?ḟ»×[Ḃ⟨Ǐ»9τ‹+İḟ»Ǎ‹ǒr$»fḢ+İ

Try it Online!Try it Online!

Takes input as notes in lowercase (db not Db or C#, this doesn't allow sharps)

Thanks to Unrelated String for saving a byte on the numbers ocmpression

«...«               # Compressed string `c db d eb e f gb g ab a bb b`
     ⌈:             # Split on spaces and make a copy
       ?ḟ           # Find the index of the input in those
         »...»9τ‹»fḢ   # The list [0,0,0,0,5,5,0,0,7,5,0,0]
                    # Note: This is surprisingly difficult to compress. The leading and trailing zeroes resist base compression, the high numbers make base compression inefficient, but attempting to index into [0,5,7] is worse.
                 +İ # Add those numbers to the input's number and modularly index into the notes.

Vyxal, 35 bytes

«⟑,HǎẆṀ,‹¹β»Ẇ→| e׫⌈:?ḟ»×[Ḃ⟨Ǐ»9τ‹+İ

Try it Online!

Takes input as notes in lowercase (db not Db or C#, this doesn't allow sharps)

«...«               # Compressed string `c db d eb e f gb g ab a bb b`
     ⌈:             # Split on spaces and make a copy
       ?ḟ           # Find the index of the input in those
         »...»9τ‹   # The list [0,0,0,0,5,5,0,0,7,5,0,0]
                    # Note: This is surprisingly difficult to compress. The leading and trailing zeroes resist base compression, the high numbers make base compression inefficient, but attempting to index into [0,5,7] is worse.
                 +İ # Add those numbers to the input's number and modularly index into the notes.

Vyxal, 34 bytes

«⟑,HǎẆṀ,‹¹β»Ẇ→| e׫⌈:?ḟ»Ǎ‹ǒr$»fḢ+İ

Try it Online!

Takes input as notes in lowercase (db not Db or C#, this doesn't allow sharps)

Thanks to Unrelated String for saving a byte on the numbers ocmpression

«...«              # Compressed string `c db d eb e f gb g ab a bb b`
     ⌈:            # Split on spaces and make a copy
       ?ḟ          # Find the index of the input in those
         »...»fḢ   # The list [0,0,0,0,5,5,0,0,7,5,0,0]
                   # Note: This is surprisingly difficult to compress. The leading and trailing zeroes resist base compression, the high numbers make base compression inefficient, but attempting to index into [0,5,7] is worse.
                +İ # Add those numbers to the input's number and modularly index into the notes.
Source Link
emanresu A
  • 46.8k
  • 5
  • 119
  • 258

Vyxal, 35 bytes

«⟑,HǎẆṀ,‹¹β»Ẇ→| e׫⌈:?ḟ»×[Ḃ⟨Ǐ»9τ‹+İ

Try it Online!

Takes input as notes in lowercase (db not Db or C#, this doesn't allow sharps)

«...«               # Compressed string `c db d eb e f gb g ab a bb b`
     ⌈:             # Split on spaces and make a copy
       ?ḟ           # Find the index of the input in those
         »...»9τ‹   # The list [0,0,0,0,5,5,0,0,7,5,0,0]
                    # Note: This is surprisingly difficult to compress. The leading and trailing zeroes resist base compression, the high numbers make base compression inefficient, but attempting to index into [0,5,7] is worse.
                 +İ # Add those numbers to the input's number and modularly index into the notes.