17 votes

1Keys: my 1 kilobyte JavaScript piano is open source on GitHub

7 comments

  1. KilledByAPixel
    Link
    Hi everyone, I have been working on some crazy stuff that I hope to share soon, this is one tiny piece of the puzzle. It is a reasonably high quality and playable keyboard with 3 instrument...

    Hi everyone, I have been working on some crazy stuff that I hope to share soon, this is one tiny piece of the puzzle.

    It is a reasonably high quality and playable keyboard with 3 instrument settings and variable length simultaneous notes. I would venture to say the best JavaScript piano anywhere near this size.

    The code is open source on github with a cleaned up version too.

    Thank you for reading and have a nice day, be safe and wear a mask!

    4 votes
  2. [6]
    Pistos
    Link
    Nice. I notice that I can't play certain chords, but I think that's more a problem with my [old] keyboard not being able to send simultaneous "key down" events for certain sets of keys. I realize...

    Nice. I notice that I can't play certain chords, but I think that's more a problem with my [old] keyboard not being able to send simultaneous "key down" events for certain sets of keys.

    I realize I'm an edge case, but I just wanted to mention that the keybindings are really messed up when using a non-standard layout like Dvorak. :D This is more an expression of amusement than a complaint or bug report.

    1 vote
    1. [4]
      pseudolobster
      Link Parent
      That's actually a solvable problem, and might be a good idea anyway, to deal with layouts like the French AZERTY. https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code

      That's actually a solvable problem, and might be a good idea anyway, to deal with layouts like the French AZERTY.

      https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code

      2 votes
      1. [3]
        KilledByAPixel
        Link Parent
        I could switch to using that for the enhanced version, the 1k version does a cool little trick to map the physical key to piano key, but it only works for characters......

        I could switch to using that for the enhanced version, the 1k version does a cool little trick to map the physical key to piano key, but it only works for characters...

        `zsxdcvgbhnjm,l.;/q2w3er5t6y7ui9o0p[=]`.indexOf(i.key.toLowerCase())
        
        2 votes
        1. [2]
          Pistos
          Link Parent
          Oh, okay. Here's the Dvorak version of that, then: ;oqejkixdbhmwnvsz'2,3.p5y6f7gc9r0l/]= I'm not sure the leading "`" you have there is intentional, but, if so, that key is in the same spot for...

          Oh, okay. Here's the Dvorak version of that, then:

          ;oqejkixdbhmwnvsz'2,3.p5y6f7gc9r0l/]=

          I'm not sure the leading "`" you have there is intentional, but, if so, that key is in the same spot for Dvorak.

          2 votes
    2. KilledByAPixel
      Link Parent
      Some other users have reported similar things with their keyboards. With my mechanical I can do any 6 notes it seems. I just added an enhanced version to github, it wouldn't be hard for me to have...

      Some other users have reported similar things with their keyboards. With my mechanical I can do any 6 notes it seems.

      I just added an enhanced version to github, it wouldn't be hard for me to have a drop down for alternate keyboard layouts. The 1k is too tight for that though.

      1 vote