popgen readme update

This commit is contained in:
David Westgate 2024-12-11 03:39:16 -08:00
parent aa28c02c91
commit 3c4ddaee2a

View File

@ -23,12 +23,9 @@ cargo run -- --help
cargo run -- -b 80 --root C[2] cargo run -- -b 80 --root C[2]
``` ```
## View Source ## View Source
[popgen.rs](./src/popgen.rs) [popgen.rs](./src/popgen.rs)
## Access outputs
TODO
## Reflections, Results, Analysis ## Reflections, Results, Analysis
The effort involved for this portfolio objective was non trivial. I'll briefy discuss a some of the techniques and challenges involved specific to this implementation in rust. For a "how it works" perspective, I feel the comments copied over from python source and my few additions allow the code to be self documenting The effort involved for this portfolio objective was non trivial. I'll briefy discuss a some of the techniques and challenges involved specific to this implementation in rust. For a "how it works" perspective, I feel the comments copied over from python source and my few additions allow the code to be self documenting
@ -38,6 +35,7 @@ The effort involved for this portfolio objective was non trivial. I'll briefy di
* [rand](https://crates.io/crates/rand): Picking the sequence of notes requires some randomness * [rand](https://crates.io/crates/rand): Picking the sequence of notes requires some randomness
* [regex](https://crates.io/crates/regex): The go-to for regex, validating and parsing the note from the command line arguments * [regex](https://crates.io/crates/regex): The go-to for regex, validating and parsing the note from the command line arguments
* [rodio](https://crates.io/crates/rodio): Back in a portfolio objective rodio, cpal, portaudio-rs. I did a little research, and it seemed that rodio was the most abstract/easy to use, but still allowed me to manually set the sample rate as is necessary * [rodio](https://crates.io/crates/rodio): Back in a portfolio objective rodio, cpal, portaudio-rs. I did a little research, and it seemed that rodio was the most abstract/easy to use, but still allowed me to manually set the sample rate as is necessary
* [hound](https://crates.io/crates/hound): This was recommened on a previous portfolio objective for saving wave files
### Typing hell ### Typing hell
The most tedious aspect of this objective was dealing with the typecasting needed for integer and float arithmetic. I won't discuss strong typing/rust arguments or any of that, but the crux of issues here came down to a few competing philosophies. The most tedious aspect of this objective was dealing with the typecasting needed for integer and float arithmetic. I won't discuss strong typing/rust arguments or any of that, but the crux of issues here came down to a few competing philosophies.
@ -51,3 +49,12 @@ While the code here works it containers several occourences of risky `as` castin
I brought in the provided unit tests for `note_to_key_offset` and `chord_to_note_offset`. These turned out to be rather useful for ensuring my functions of the same name worked correctly. I began adding some tests for `make_notes` and may do the same for other functional units. I could move the tests into another source file, but decided not to, as to better parallel the source material. I brought in the provided unit tests for `note_to_key_offset` and `chord_to_note_offset`. These turned out to be rather useful for ensuring my functions of the same name worked correctly. I began adding some tests for `make_notes` and may do the same for other functional units. I could move the tests into another source file, but decided not to, as to better parallel the source material.
### Results: ### Results:
`popgen.rs` seems to work ok. I have done some testing with various root note inputs and other parameters, but not exhaustively. Similar to `popgen.py`, some note clicking is audible
## Access outputs
Two output files were generated. I must have a slight bug in the `save` function, because these sound of somewhat lower quality.
[out0.wav](out0.wav)
[out0.wav](out0.wav)