Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for black chords #17

Merged
merged 23 commits into from
Nov 26, 2023
Merged

Add support for black chords #17

merged 23 commits into from
Nov 26, 2023

Conversation

pganssle
Copy link
Owner

@pganssle pganssle commented Nov 20, 2023

This is the first pass at adding support for the "black chords" (#8).

This switches us over to Tone.js, to allow more easily expanding the chords. The Tone.js sampled piano sounds a little different from the original recorded versions, so we leave that available as a "legacy" mode.

Still to-do in this PR:

  • Add chord names (notes) to the flags when on a "black chords" level or greater
  • Improve the UI in the "music trainer" grid, which is now expanded to 14 chords.
  • Figure out why the hidden "Red" chord option is still showing up on iOS

I will leave it to another PR to figure out a better UI for training with the 10 "black chord" inversions.

This will change the sound of the chords a little (which is why we still
support the "old" version of the piano for the light mode), but it also
allows us to easily expand colors and instruments.

In the future, it will also allow us to play the chord for an arbitrary
length of time if desired.
Right now this is a stright expansion of the number of chords to include
the 5 black chords.

Still to do is adding the chord naming system.
If AUDIO_FILES has been populated, we don't actually use this function,
so we should move it inside the `if` statement so that it doesn't get
defined on every loop.
Hard to reproduce the bug, but the sound would occasionally come out
very tinny in the main game mode. Setting the volume any higher than 1
seems to give some clipping, leading to tinniness, so hopefully
explicitly initializing the volume to 1 will help.
Currently when there are a lot of colors on the screen or when you are
using a phone, there's some chance you might have to do some scrolling,
or there is other wasted space.

This eliminates the big "Chord Identification Method Trainer" text,
moves the controls in-line with the menu items, and hides the menu under
a hamburger button when using small screens.

It also makes some changes to the grid size depending on the screen size
and number of colors.
Apparently on mobile `vh` / `vw` refers to something like the whole
screen height / width rather than the actual rendered viewport. You can
use `dvh` to refer to just the part that is rendered. It's a relatively
new feature so I'm including some fallbacks.

Also switching over the logic of how the top-level container contains
the whole application.
Previously they were generated on the fly in Javascript.
@pganssle
Copy link
Owner Author

Made some progress on the UI for displaying chord names. This is what I have so far:

image

I'm not 100% satisfied with it, but it is a good start I think.

@pganssle
Copy link
Owner Author

Figure out why the hidden "Red" chord option is still showing up on iOS

OK, this seems to be an issue in Safari. I will either just leave it as is and the Safari users can just always have a weird "Level 0" option in the drop-down or I can try to go back to the old way where the option is added and removed programmatically by the Easter egg.

@pganssle
Copy link
Owner Author

I decided to add shapes to each of the note names, to help the kids remember them as sequences (you can turn off the shapes or the letters):

image

I'm not totally satisfied with how this came out, but I think it's good enough to ship at this point. I would like to put a border around the shapes, but the way I added the shapes was using clip-path, and it seems like it's annoyingly difficult to get nice-looking borders around clipped paths and I don't want to burn half a day on this.

@pganssle
Copy link
Owner Author

OK, so I know why the red chord thing is showing up on iOS, but I'm going to leave that for later to fix. I think everything else is ready to go.

@pganssle pganssle merged commit 4bc7b75 into main Nov 26, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant