-
Notifications
You must be signed in to change notification settings - Fork 0
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
MIDI-122: MidiPiece-Improvements #1
Conversation
Looking at the trimming functionality I was thinking about 2 possible changes:
Example: trimmed_midi_piece = midi_piece.trim(1, 4) Returns: LMK your opinion. For now I left it as is. |
It isn't possible to vectorizem |
By trimming with index interval, do you mean a similar functionality to what I think we can add an argument like Thinking about adding pieces - I'd say that doing something like this can be tricky: piece_a[3: 10] + piece_b[120:130] You could do this without any time shifts, or by shifting the second piece to start right after the first one. Either way it's difficult to define so it makes musical sense - I'm sort of thinking about throwing an error in |
That's correct. I'll add the argument, shouldn't make much difference but maybe someone will need it one day. 🙏
I see what you mean. I don't think throwing an error would be 'user-friendly' I suppose that letting the user do what they want, disregarding the musicality could be a good thing. It sort of depends on whether we want Fortepyan to be your friendly music helper 😄, or a tool you use for working with MIDI from a more technical standpoint. With the second option the harsh "join two pieces as is" would work as an editor. To connect those ideas maybe throwing a warning would do? Something along the lines of "Hey it's connected but are you sure this is what you want?" 😅 |
Yes, warning will be good for this 👍 Generally speaking I'd say MidiPiece class should go more in the direction of a "tool you use for working with MIDI from a more technical standpoint" :) |
I'm following this documentation guide as well as material mkdocs documentation to create some baseline of how our documentation could look like. I'll be doing some research on good practices and will try to apply them to Fortepyan. |
@SamuelJanas Thanks! For reference here's a couple of well documented projects: |
Is there a way to generate the documentation automatically from docstrings, and also add images in mkdocs? Showing piano rolls before/after could be very helpful for some operations. I'm also thinking about adding the JS piano roll player to our documentation, I guess it's also going to cause some problems with the automatic docstring-documentation conversion 🤔 |
I believe it's treating the docstrings similarly to markdown so there might be a way. I'll inspect how it could be done. But I was thinking about including a separate page dedicated to examples and visualisations. Pydantic has a similar page that's under construction. This way we could write a more detailed description for the charts without cluttering the technical aspect of the documentation. |
@@ -129,6 +129,9 @@ def trim(self, start: float, finish: float, shift_time: bool = True, slice_type: | |||
Trimming with time shift disabled: | |||
>>> midi_piece.trim(start=1.0, finish=5.0, shift_time=False) | |||
|
|||
An example of a trimmed MIDI piece: | |||
![Trimmed MIDI piece](../assets/random_midi_piece.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shortly speaking, it's possible to add an image to the documentation. relative links work just fine, it is, however, a little tricky to guess what will be the final path.
mkdocstrings/mkdocstrings#456 Issue I found the answer in.
This PR is complete. Some improvements were made to MidiPiece. We have the beginning of technical docs and CI/CD has been set up. LMK if you feel like anything else is needed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 💪
Can you propose and document a version bumping mechanism for this? Up till now I used to do:
bumpver update --patch
python -m build
twine upload -r pypi dist/*
We have those settings for bumpver in pyproject.toml:
[tool.bumpver]
current_version = "0.2.4"
version_pattern = "MAJOR.MINOR.PATCH"
commit_message = "bump version {old_version} -> {new_version}"
commit = true
tag = true
push = true
The commit, tag, and push combination is doing a lot, and I'm guessing it's not consistent with the gitflow
apporach we were discussing. Can you propose a new approach for this? I like using bumpver, so maybe it would make sense to use it during git flow release
, but without commit, tag, and push 🤔
docs/index.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is some generic template, can you make it fortepyan-specific? Explicit instructions on how to get the documentation running locally would be great, including required dependencies. I almost got mkdocs serve
to work, but I'm stuck on:
ModuleNotFoundError: No module named 'mkdocstrings_handlers'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try running it on a fresh environment and note what needs to be done! Sorry for inconvenience.
I was thinking about it. I've managed to come up with a solution that would keep the minimal commands to write at 2. That would include creating two shell scripts. Something along the lines of
The rest would be handled by github actions. I'll change the |
Sounds good, we can try that! Maybe we could store those scripts in |
Quick update here. I've written the scripts, I was able to test them on windows only so if you get that weird end of the line error coming from different EOL in windows and linux then I'm terribly sorry! 😞
After running: pip install -r requirements.txt
pip install mkdocs-material
pip install mkdocstrings-python on a fresh environment, I was able to run |
Thanks, docs work for me as well after this, I probably messed something up previously 🙈 I think we can wait with figuring out the docs dependencies until we get to deployment setup. |
MidiPiece Improvements
Unit tests
packaging and releases