xenharmonic-devs / scale-workshop

Design and visualize microtonal scales and play them in your web browser. Export your scales for use with VST instruments. Convert Scala files to various tuning formats.
MIT License
73 stars 10 forks source link

Adding click and play note for Lattices #701

Open wilckerson opened 2 months ago

wilckerson commented 2 months ago

This PR comes from a feature that I miss, which I didn't find an open issue, where the Lattices could play the notes by clicking/touching them. The feature was added to the Lattice node and label, helping with the click region that may become small on mobile phones.

The logic used to handle the click/touch was the same as VirtualPiano.vue. I think it could be extracted in a helper function and refactored to all places to use the same underlying implementation. However, it can be done in another PR to avoid this one getting bigger.

Thanks.

wilckerson commented 2 months ago

@frostburn would you mind reviewing this one? Thanks

frostburn commented 2 months ago

The issues are poorly organized. Playing notes by clicking is mentioned here in comment in a TODO list: https://github.com/xenharmonic-devs/scale-workshop/issues/38

The main reason playing hasn't been implemented is the ambiquity of the equave. Shepard tones could solve that issue, but come with their own set of issues.

Let's see what you got here...

frostburn commented 2 months ago

Stuff I noticed

  1. The lattice nodes are hard to click on. Activating the closest vertex when the SVG is clicked could lead to a better UX.
  2. I was kind of expecting to hear 1/1 when clicking the equave, but I guess it makes sense to play what the label says.
  3. Sustaining clicked nodes when Shift is pressed could be nice, but we'd need that on the virtual keyboard as well.
  4. Missing an entry in CHANGELOG.md

Nice work overall!

frostburn commented 2 months ago

Please make an issue about the refactoring if you're not going to do it here.

frostburn commented 1 month ago

@wilckerson What's the status of this PR? Just let us know if you don't have time to work on it and I can tidy it up.

wilckerson commented 1 month ago

@frostburn Sorry for taking so long, I can work on those fixes in the following days. But thank you for offering help =)

frostburn commented 1 month ago

@frostburn Sorry for taking so long, I can work on those fixes in the following days. But thank you for offering help =)

No problem. Thanks for keeping us in the loop.

wilckerson commented 1 month ago

@frostburn I have handled your feedback and you may close this PR. Sorry for taking so long. The only parts that I was not able to implement here were:

frostburn commented 1 month ago

Clicking on a lattice node and dragging away enters a buggy mode where the note plays when you hover over the node again. Clicking on the node when in this buggy state makes the note play indefinitely.

frostburn commented 1 month ago

The frequencies associated with a node are incorrect when using lattice permutations such as created using Generator sequence and pressing the Lattice button: https://sw3.lumipakkanen.com/scale/_1if4acyL

frostburn commented 1 month ago

Cycles and 3D lattice options were added recently? Are you going to add functionality for them too?

frostburn commented 1 month ago

Fixing the buggy click and drag behavior probably requires redesigning of the whole event system. My suggestion is to put this lattice stuff on hold and redesign the event system in a separate PR if you're up for it. Adding touch dragging similar to Hexatone addressing #717 would be nice too.

wilckerson commented 1 month ago

Alright. It sounds good. Let me see what I can do. Thanks