Commit graph

25 commits

Author SHA1 Message Date
William Carroll
edc8f4ef6e Remodel model.selectedChord as Maybe Chord
Until the user presses play, we shouldn't display any chords.
2020-04-13 09:42:26 +01:00
William Carroll
6a91065677 Whitelist and blacklist note classes
Often I want to practice only C, F, and G-chords in all inversions. Next I'd
like to only support the chords for various keys.
2020-04-12 23:35:16 +01:00
William Carroll
083763f7f2 Only display chords that fit on the displayed piano
Only show the chords that we can fit on the piano.

TODO: Debug occasional instance where we render chords that do not fit. I am
unsure how to reproduce these states at the moment.
2020-04-12 23:33:56 +01:00
William Carroll
3ee1b1f670 Support suspended chords
I'm not sure how valuable it is to study all of the inversions of the suspended
chords. Maybe it is. I'll let the users decide.
2020-04-12 23:32:00 +01:00
William Carroll
bf460fe5ac Whitelist and blacklist chordTypes
Allow and disallow chords by the type of chords.
2020-04-12 19:32:54 +01:00
William Carroll
1298263629 Whitelist and blacklist chords by inversion type
Add checkboxes to support various chord positions.
2020-04-12 19:20:00 +01:00
William Carroll
24692ab465 Properly support chord inversions
While I did change a lot of functionality, I also ran `elm-format` across the
codebase, which makes these changes a bit noisy.

Here is the TL;DR:
- Properly support chord inversions
- Ensure that the piano styling changes dynamically when I change the variables
  like `naturalWidth`
- Add start and end notes to define the size of the piano and which chords we
  create
- Support elm-format and run it across entire project
- Debug Misc.comesBefore
- Introduce a ChordInspector and debugger

TODO: Ensure that we only generate chords where all of the notes can be rendered
on the displayed keys.

TODO: Add preferences panel, so that I can do things like "Practice blues chords
in C and E with chord substitutions."
2020-04-12 16:43:34 +01:00
William Carroll
730aecc076 Support NoteClass
Remodel application to support the scientific pitch notation for notes. Instead
of supporting simply "C", support "C4". This change created cascading
changes. After refactoring for around an hour, I restored the app to a working
state. The current state is not desirable, but it compiles. More changes on the
way.
2020-04-11 23:11:04 +01:00
William Carroll
808e6ee484 Support Misc module
Define two functions for attempting to return an element in a list that precedes
or succeeds another element.

I prefer having something like Utils.List. Perhaps I will refactor.
2020-04-11 23:10:14 +01:00
William Carroll
c24c9b7fb9 Support BPM for tempo
Using BPM as the unit for tempo.

TODO: Consider a higher-fidelity way to calculate BPM, although I'm not sure
this is critical functionality; an interesting problem is just seducing me, and
this app would be better off resisting the temptation.
2020-04-11 17:46:46 +01:00
William Carroll
93bdebf9b2 Track app ideas
Use an org file to track random ideas or features or improvements.
2020-04-11 17:44:20 +01:00
William Carroll
3c8bfe85c9 Prefer type alias to type
Elm reminds me of Haskell. In fact, I'm using `haskell-mode` (for now) in Emacs
to write my Elm code, and it works reliably. I'm not writing a Haskell app, but
if I were, I would define my application Model with the following Haskell code:

```haskell
data Model = Model { whitelistedChords :: [Theory.Chord]
                   , selectedChord :: Theory.Chord
                   , isPaused :: Bool
                   , tempo :: Int
                   }
```

When I first modelled my application state, I did something similar. After
reading more Elm examples of SPAs, I see that people prefer using type aliases
to define records. As far as I know, you cannot do this in Haskell; I believe
all types are "tagged" (something about "nominal typing" comes to mind). Anyhow,
Elm isn't Haskell; Haskell has cool features like type classes; Elm has cool
features like human-readable error messages and exhaustiveness checking for
cases. I love Haskell, and I love Elm, and you didn't ask.

Anyhow, this commit refactors my records as type aliases instead of types. I
think the resulting code is more readable and ergonomic.
2020-04-11 16:50:02 +01:00
William Carroll
52eb456a0f Support basic tempo
Supporting Play/Pause events, and Increase/Decrease tempo.

TODO: Convert milliseconds to BPM
2020-04-11 16:09:11 +01:00
William Carroll
2f446d0441 Improve the styling of the piano
Create a more convincing representation of the piano.

I would like to compute the left-offset based on the naturalWidth. That change
is probably forthcoming.
2020-04-11 11:36:37 +01:00
William Carroll
3562343c19 Generate all known chords and display randomly selected chords
First of all, Elm's purity is beautiful. I think every language should model
their error messages and develop experience after Elm. If I didn't have to
download packages, I don't think I would need an internet connection to
troubleshoot my program's errors. This is how helpful I find the compiler.

Now that that's out of the way, here's what I've changed since we've last
corresponded:
- Use Elm's Browser.element to create a reactive application with state
- Write a function to generate all of the chords about which CDS knows
- Move some code out of Main.elm into other modules
- Depend on List.Extra, Random, Random.Extra

What's left:
- Lots of work
- Instead of clicking a button to show a new chord, use a timer
- Add mobile-first styling (probably add TailwindCSS)
- Persist settings in LocalStorage (and then eventually create user accounts)
- Allow users to curate the list of chords they're interested in practicing
- Deploy the website and dogfood it

Unknowns:
- How can I handle tempo? I don't expect setInterval to be enough (maybe it
  is)...
2020-04-11 10:45:42 +01:00
William Carroll
b600f709b4 Model data and sketch ideas for Chord Drill Sergeant
Initialize an Elm application to build a MVP for the Chord Drill Sergeant
application. There isn't much to see at the moment. I'm just sketching
ideas. More forthcoming...
2020-04-10 23:03:01 +01:00
William Carroll
c350222fcc Create README for Chord Drill Sergeant
See the README for more information.

I've wanted to use an application like this for awhile. I would like to start
developing this soon.
2020-04-10 14:48:00 +01:00
William Carroll
065d58dd5a Add README for typo-po
See the README for more context on typo-po.

I drank a strong cup of coffee this morning, and I cannot quiet the activity in
my head. I'm attempting to use READMEs in my //website/sandbox to track ideas
that I would typically track using my phone's notes application. Creating a
README forces me to write more than I may have written in my phone's
notes. Also, since this repository is available at https://git.wpcarro.dev, I
can share these ideas with friends by sending them a URL! So much for "stealth
mode"... Well I guess this stress-tests my theory that ideas are less important
than execution.
2020-04-10 13:54:33 +01:00
William Carroll
a2f68732de Create README for Github Issues Service
See the README for an overview of the concept.

Basically I would like a simpler way to collect feature requests and bug
reportss from my web apps.
2020-04-10 13:40:04 +01:00
William Carroll
514136c99a Run Prettier across projects
Problem:
Prettier was not running when I saved Emacs buffers.

Why?
- prettier-js-mode needs needs node; lorri exposes node to direnv; direnv
  exposes node to Emacs; lorri was not working as expected.

Solution:
Now that I'm using nix-buffer, I can properly expose node (and other
dependencies) to my Emacs buffers. Now Prettier is working.

Commentary:
Since prettier hadn't worked for so long, I stopped thinking about it. As such,
I did not include it as a dependency in boilerplate/typescript. I added it
now. I retroactively ran prettier across a few of my frontend projects to unify
the code styling.

I may need to run...
```shell
$ cd ~/briefcase
$ nix-shell
$ npx prettier --list-different "**/*.{js,ts,jsx,tsx,html,css,json}"
```
...to see which files I should have formatted.
2020-03-27 10:59:50 +00:00
William Carroll
f4f7f454fa Delete nut-score
In the spirit of minimalism, I would like to delete this half-baked project from
my repository.

Do less, but better.
2020-03-27 10:59:50 +00:00
William Carroll
6b224a9e31 Drop support for lorri
Lorri does not cleanly integrate with my corporate device, which cannot run
NixOS. To expose dependencies to Emacs buffers, I will use nix-buffer.el, which
reads its values from dir-locals.nix. To easily expose dependencies from my
existing shell.nix files into dir-locals.nix, I wrote a Nix utility function.
2020-03-27 10:59:50 +00:00
William Carroll
527aeeeced Add sandbox project using Contentful CMS
I used the boilerplate/typescript project as a starting point. This project
fetches and renders books that I'm defining in a Contentful CMS that I created.
2020-03-24 13:27:30 +00:00
William Carroll
57b58e9b2f Move nut-score into website/sandbox
Also move some .gitignore entries from the top-level .gitignore into a
subdirectory .gitignore.
2020-03-24 12:29:34 +00:00
William Carroll
f4fea2346e Move sandbox into website
Nest the sandbox work under ./website.
2020-03-20 00:52:05 +00:00