kordweb 0.7.1 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,13 +5,14 @@
5
5
  [![GitHub all releases](https://img.shields.io/github/downloads/twitchax/kord/total?label=binary)](https://github.com/twitchax/kord/releases)
6
6
  [![npm](https://img.shields.io/npm/dt/kordweb?label=npm)](https://www.npmjs.com/package/kordweb)
7
7
  [![Documentation](https://docs.rs/kord/badge.svg)](https://docs.rs/kord)
8
- [![Rust](https://img.shields.io/badge/rust-nightly-blue.svg?maxAge=3600)](https://github.com/twitchax/kord)
9
8
  [![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
9
 
11
10
  # kord
12
11
 
13
12
  A music theory binary and library for Rust / JS (via WASM) ([capability playground](https://kord.twitchax.com/)).
14
13
 
14
+ > **Note**: The [`kord-web`](kord-web/) directory contains a web application that serves as a demonstration and example of how to integrate the Kord library with modern web frameworks. It is not part of the core library but showcases the library's WASM capabilities in a real-world web application (and it is the example website linked above).
15
+
15
16
  ## Binary Usage
16
17
 
17
18
  ### Install
@@ -51,18 +52,20 @@ NPM:
51
52
  $ npm install --save kordweb
52
53
  ```
53
54
 
54
- ### Wasmer
55
+ ### WebAssembly (via OCI Registry)
56
+
57
+ Run directly from GitHub Container Registry using any WASI-compatible runtime. This has a reduced capability set (no audio input / output), but works well for core use cases.
55
58
 
56
- This has a reduced capability set (no audio input / output), but works well for some of the core use cases.
59
+ With Wasmtime:
57
60
 
58
61
  ```bash
59
- $ wasmer install twitchax/kord
62
+ $ wasmtime run ghcr.io/twitchax/kord:latest describe Am7
60
63
  ```
61
64
 
62
- Alternatively, you can use `wasmer run`.
65
+ With wkg (WebAssembly Package Manager):
63
66
 
64
67
  ```bash
65
- $ wasmer run twitchax/kord -- describe Am7
68
+ $ wkg get github:twitchax/kord
66
69
  ```
67
70
 
68
71
  ### Help Docs
@@ -75,7 +78,7 @@ A tool to easily explore music theory principles.
75
78
  Usage: kord.exe [COMMAND]
76
79
 
77
80
  Commands:
78
- describe Describes a chord
81
+ describe Describes a chord, scale, or mode
79
82
  play Describes and plays a chord
80
83
  loop Loops on a set of chord changes, while simultaneously outputting the descriptions
81
84
  guess Attempt to guess the chord from a set of notes (ordered by simplicity)
@@ -84,8 +87,10 @@ Commands:
84
87
  help Print this message or the help of the given subcommand(s)
85
88
 
86
89
  Options:
87
- -h, --help Print help information
88
- -V, --version Print version information
90
+ -v, --verbose Flag that specifies verbose logging
91
+ -q, --quiet Flag that suppresses all tracing output
92
+ -h, --help Print help information
93
+ -V, --version Print version information
89
94
  ```
90
95
 
91
96
  ### Describe A Chord
@@ -99,6 +104,57 @@ Cmaj7
99
104
  C, E, G, B
100
105
  ```
101
106
 
107
+ ### Describe A Scale
108
+
109
+ The `describe` command automatically detects scales:
110
+
111
+ ```bash
112
+ $ kord describe "C major pentatonic"
113
+
114
+ C major pentatonic
115
+ a five-note scale with no half steps
116
+ C, D, E, G, A
117
+ ```
118
+
119
+ ```bash
120
+ $ kord describe "A harmonic minor"
121
+
122
+ A harmonic minor
123
+ minor scale with raised 7th
124
+ A, B, C, D, E, F, G♯
125
+ ```
126
+
127
+ ### Describe A Mode
128
+
129
+ Modes are also auto-detected:
130
+
131
+ ```bash
132
+ $ kord describe "D dorian"
133
+
134
+ D dorian
135
+ dorian mode, second mode of major scale
136
+ D, E, F, G, A, B, C
137
+ ```
138
+
139
+ ```bash
140
+ $ kord describe "F lydian"
141
+
142
+ F lydian
143
+ lydian mode, fourth mode of major scale
144
+ F, G, A, B, C, D, E
145
+ ```
146
+
147
+ You can also force interpretation with `--type`:
148
+
149
+ ```bash
150
+ $ kord describe -t chord "C"
151
+
152
+ C
153
+ major
154
+ C, D, E, F, G, A, B
155
+ C, E, G
156
+ ```
157
+
102
158
  ### Play A Chord
103
159
 
104
160
  ```bash
@@ -188,32 +244,47 @@ kord = "*" #choose a version
188
244
  ### Examples
189
245
 
190
246
  ```rust
191
- use klib::known_chord::KnownChord;
192
- use klib::modifier::Degree;
193
- use klib::note::*;
194
- use klib::chord::*;
247
+ use klib::core::known_chord::KnownChord;
248
+ use klib::core::modifier::Degree;
249
+ use klib::core::note::*;
250
+ use klib::core::chord::*;
195
251
 
196
252
  // Check to see what _kind_ of chord this is.
197
253
  assert_eq!(Chord::new(C).augmented().seven().known_chord(), KnownChord::AugmentedDominant(Degree::Seven));
198
254
  ```
199
255
 
200
256
  ```rust
201
- use crate::klib::base::Parsable;
202
- use klib::note::*;
203
- use klib::chord::*;
257
+ use klib::core::base::Parsable;
258
+ use klib::core::note::*;
259
+ use klib::core::chord::*;
204
260
 
205
261
  // Parse a chord from a string, and inspect the scale.
206
262
  assert_eq!(Chord::parse("Cm7b5").unwrap().scale(), vec![C, D, EFlat, F, GFlat, AFlat, BFlat]);
207
263
  ```
208
264
 
209
265
  ```rust
210
- use klib::note::*;
211
- use klib::chord::*;
266
+ use klib::core::note::*;
267
+ use klib::core::chord::*;
212
268
 
213
269
  // From a note, create a chord, and look at the chord tones.
214
270
  assert_eq!(C.into_chord().augmented().major7().chord(), vec![C, E, GSharp, B]);
215
271
  ```
216
272
 
273
+ ```rust
274
+ use klib::core::base::Parsable;
275
+ use klib::core::notation::Notation;
276
+
277
+ // Parse any notation type (chord, scale, or mode) automatically.
278
+ let scale = Notation::parse("C major pentatonic").unwrap();
279
+ assert!(scale.is_scale());
280
+
281
+ let mode = Notation::parse("D dorian").unwrap();
282
+ assert!(mode.is_mode());
283
+
284
+ let chord = Notation::parse("Cmaj7").unwrap();
285
+ assert!(chord.is_chord());
286
+ ```
287
+
217
288
  ## JS Usage
218
289
 
219
290
  The npm package is available [here](https://www.npmjs.com/package/kordweb).
@@ -252,7 +323,7 @@ KordChord.parse('C').minor().seven().chord().map(n => n.name()); // [ 'C4', 'Eb4
252
323
  ## Feature Flags
253
324
 
254
325
  The library and binary both support various feature flags. Of most important note are:
255
- * `default = ["cli", "analyze", "audio"]`
326
+ * `default = ["cli", "analyze", "audio", "ml_infer", "ml_loader_mel", "ml_target_folded", "ml_train_precision_fp32", "ml_store_precision_half"]`
256
327
  * `cli`: enables the CLI features, and can be removed if only compiling the library.
257
328
  * `analyze = ["analyze_mic", "analyze_file"]`: enables the `analyze` subcommand, which allows for analyzing audio data (and the underlying library features).
258
329
  * `analyze_mic`: enables the `analyze mic` subcommand, which allows for analyzing audio from a microphone (and the underlying library features).
@@ -266,13 +337,42 @@ The library and binary both support various feature flags. Of most important no
266
337
  * > NOTE: Adding the `analyze_mic` feature flag will enable the `ml infer mic` subcommand, which allows for inferring with ML models from a microphone.
267
338
  * > NOTE: Adding the `analyze_file` feature flag will enable the `ml infer file` subcommand, which allows for inferring with ML models from a file.
268
339
  * `ml_gpu`: enables the features to use a GPU for ML _training_.
340
+ * `ml_sample_gather`: enables the `ml gather` subcommand for capturing raw samples from a microphone (requires `analyze_mic`).
341
+ * `ml_hpt`: enables the `ml hpt` subcommand for sweeping hyperparameters (implies `ml_train`).
342
+ * `ml_sample_process`: enables the `ml process` subcommand for generating samples from aligned MIDI and audio files (WAV or FLAC), naming each emitted sample with its originating measure index, rounded duration (in seconds), and chord tones.
269
343
  * `wasm`: enables the features to compile to wasm.
270
344
  * `plot`: enables the features to plot data.
271
345
 
272
- ## Test
346
+ For detailed ML training configuration options (loaders, targets, precision settings), see the [ML Training Configuration](DEVELOPMENT.md#ml-training-configuration) section in [DEVELOPMENT.md](DEVELOPMENT.md).
347
+
348
+ ## Development
349
+
350
+ For detailed development instructions, see [DEVELOPMENT.md](DEVELOPMENT.md).
351
+
352
+ ### Test
353
+
354
+ ```bash
355
+ cargo make test
356
+ ```
357
+
358
+ ### Docker
359
+
360
+ Build:
361
+ ```bash
362
+ cargo make docker-build
363
+ ```
364
+
365
+ Run:
366
+ ```bash
367
+ cargo make docker-run
368
+ ```
369
+
370
+ ### Fly.io Deployment
371
+
372
+ CI deploys the site whenever a `v*` tag is pushed (the `deploy_web` job, which needs the `FLY_API_TOKEN` repo secret). To deploy by hand from the repo-root `fly.toml`:
273
373
 
274
374
  ```bash
275
- cargo test
375
+ cargo make fly-deploy
276
376
  ```
277
377
 
278
378
  ## License