Beta

Playing chords on guitar

Description
Loading description...
Combinatorics
Mathematics
Tutorials
Logic
Fundamentals
  • Please sign in or sign up to leave a comment.
  • dfhwze Avatar

    I'm planning to make a JS translation of this interesting kata. The random tests generator looks a bit scary though to mimic. Do you want more or less the same random tests generator for each language?

    • mauro-1 Avatar

      It isn't important to use the same test generator, but:

      • keep finger_test_cases (all valid and near-valid relative finger position)
      • generate all problems: out of range notes, more than 6 notes, impossible fingerings, ...
      • generate a good number of valid chords (full random chords are almost always unplayable)
      Question marked resolved by mauro-1 2 years ago
  • Voile Avatar

    Each note is composed of a note name ('A''G'), an optional accidental: ('♯'/'\u266f' or '♭'/'\u266d') and an octave number ('1''9').

    Random tests sometimes generate notes outside the specified range, such as G♯0.

  • Voile Avatar
    play('B2 D♯3 A3 B3 F♯4'): {'11 2 9 2 7 -', '7 6 7 - 0 2', '7 6 9 2 - 2', '7 6 7 4 - 2', '- 2 1 2 0 2', '7 6 7 4 7 -', '11 2 9 2 - 2', '7 6 9 2 7 -'} should equal {'- 2 1 2 0 2'}
    

    It seems that there are additional requirements on the finger distance between the barre and other fingers that are not mentioned (e.g Why is 11 2 9 2 - 2 invalid? It plays D♯3 B2 B3 A3 - F♯4, with barre at 2 all the way, 9 + 11 with two fingers)

    Similarly, 7 6 7 4 7 - looks doable (Plays B2 D♯3 A3 B3 F♯4 -, barre at 4, 6 + 7 + 7 + 7 with the 4 remaining fingers)

    • Voile Avatar

      Back to the first example: what stops one from playing 2 4 0 3 1 5 with barre at 1?

      Or just using 5 fingers together? since

      Barre isn't mandaory, the first finger can also be used on a single string like other fingers.

      and the open string can be ignored.

      And what's stopping 1 - 3 3 3 3 from barre at 1 pressed across the whole board and pressing 3 with the remaining fingers?

    • mauro-1 Avatar

      11 2 9 2 - 2: requires fingers on fret 2, 9 and 11 (distance 9-2=7, 11-2=9), but maximum distance is 2, 3 or 4 (see table in section "Fingers".

      From description: The guitarist can use at most 4 fingers. If the first finger is used for barre, there are 3 fingers remaining.

    • dfhwze Avatar
      case: 11 2 9 2 - 2
      
      fingers are on frets: 2, 9, 11
      distance between 2 and 9 cannot be overlapped by any fingers
      
    • Voile Avatar

      That sentence is immediately followed by "the thumb is under the neck of guitar". I don't think it'd be unreasonable to assume that the "4 fingers" there are talking about the other 4 fingers outside of the thumb.

    • Voile Avatar

      Never mind, I re-read the description yet again and it was the 4 fingers all along, the thumb was not involved in the whole deal at all.

      Issue marked resolved by Voile 2 years ago
  • dfhwze Avatar

    Some tags you may want to add:

    • combinatorics
    • mathematics
    • tutorials
    • logic
    • algorithms
  • dfhwze Avatar

    This kata doesn't handle octaves of notes with a 'directed pitch class' lower than 0 or higher than 11 correctly.

    B♯3 is equivalent to C3 not C4.

    # play('B♯3 A4', 9): set() should equal 
    # {'- - 10 14 - -', '- - 10 - 10 -',
    #  '- 15 - 14 - -', '- 15 19 - - -'}
    
    • rowcased Avatar

      C3 == 130.81

      B3 == 246.94

      C4 == 261.63

      so, B#3 == C4

    • dfhwze Avatar

      I'm not convinced. It depends what an octave is. Can notes having the same pitch be in different octaves? Is B#3 B3 sharpened or is it the B# that we can find in the 3th octave, in which case it's B2 sharpened? For instance, is B##########################3 still part of the 3th octave or is it in a higher octave? I think an octave is a fixed structure between certain pitches. Sharpening B changes the octave of the note.

    • dfhwze Avatar

      It doesn't matter. I just notice the description states how to handle such edge cases. It's different than what I'm used to, but it's clear what expected behavior is.

      Issue marked resolved by dfhwze 2 years ago
    • mauro-1 Avatar

      From description:

      The octave number is tied to the note name, C♭4 (=B3, one semitone below C4) is the highest note of octave 3.

      B#3 is "one semitone above B3" and not "the B# (C) of octave 3".

      It's the same convention used in scientific pitch notation.

  • dfhwze Avatar

    Multiple fingers can't be on the same string, so is this a distance in frets, regardless of string where the fingers are placed? Also, how do we measure distance, do we go from string to string?

    fingers with distance d can be used on frets with a maximum distance of d+1
    
    • dfhwze Avatar

      For instance:

      I count 4 fingers with distances in between that are valid. 11 (1 finger), 11 -> 9 (1 finger), 9 -> 11 (1 finger), 11 -> 10 (1 finger)

      play('D♯3 B3 F♯4 A4', 9): {'11 - 9 11 10 -', '11 14 - 11 10 -'} should equal {'11 - 9 11 10 -'}
      
    • dfhwze Avatar

      I still don't know much about guitar hand grips, but I managed to pass this kata.

      Question marked resolved by dfhwze 2 years ago
    • mauro-1 Avatar
      '11 - 9 11 10 -':
      1st finger: 9
      2nd finger: 10
      3rd finger: 11
      4th finger: 11
      

      Ok, max distance is 2 (11-9)

      '11 14 - 11 10 -':
      1st finger: 10
      2nd finger: 11
      3rd finger: 11
      4th finger: 14
      

      3rd-4th finger: 3 (14-11), too much

  • dfhwze Avatar

    Why is this allowed, if you state that holes are not allowed in barre? Is an unused string not a hole?

    '- 1 - 1 1 5'    yes    barre and 4th finger
    
    • mauro-1 Avatar

      Unused strings are always allowed.

      Thre string can't be played open because there is a finger on fret 1, but it isn't mandatory to use that string.

      Question marked resolved by mauro-1 2 years ago
  • dfhwze Avatar

    some suggestions

    • can you explain the concept of an 'open string' in the description?
    • it seems 'fret = 0' means open string, I would state this explicitly in the description
    • mauro-1 Avatar

      can you explain the concept of an 'open string' in the description?

      Done.

      it seems 'fret = 0' means open string, I would state this explicitly in the description

      Already sated in "output" section.

      Suggestion marked resolved by mauro-1 2 years ago
  • scarecrw Avatar

    Amazing kata! Thanks for putting this together!