Skip to content
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

Allow export-points to export multiple results #15

Closed
MattEqualsCoder opened this issue Aug 9, 2023 · 8 comments
Closed

Allow export-points to export multiple results #15

MattEqualsCoder opened this issue Aug 9, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@MattEqualsCoder
Copy link

Is your feature request related to a problem? Please describe.
I'd like to use the PyMusicLooper in conjunction with an app I'm developing to allow people to create pcm files for SNES msus. The app allows people to adjust normalization, temp, and other settings along with being able to set loop points. My hope is to use PyMusicLooper to give people options for auto detected loop points.

Describe the solution you'd like
If operating on a single file, have a flag to export the top X results rather than just the top 1 result.

Describe alternatives you've considered (if relevant)
I've considered trying to scrape the interactive mode results in an app, but that seems rather flimsy.

Additional context
N/A

@MattEqualsCoder MattEqualsCoder added the enhancement New feature or request label Aug 9, 2023
@arkrow
Copy link
Owner

arkrow commented Aug 9, 2023

Is your app coded in python? If so, you can directly use the MusicLooper class in the pymusiclooper.core module for programmatic access to most of the core functionality (code can be seen here). Docstrings and type hints for this class are being worked on and should be available with the next release. The main difference is that it does not handle external streams with yt-dlp like the CLI.

If not using python or for the sake of flexibility, how would you prefer the data format if such an option was available? A text file with the each line formatted as {loop_start} {loop_end} {note_difference} {loudness_difference} {score} seems like the best candidate that can be parsed easily, but would like to hear your input.

@MattEqualsCoder
Copy link
Author

It's an external app written in C#, so directly using the classes isn't really viable unfortunately.

I think that output looks good, though. Spitting those results out to a file and/or the console would be acceptable and easy enough to parse, I feel.

arkrow added a commit that referenced this issue Aug 11, 2023
- Implements #15
- Refactors export LoopExportHandler.run() function for maintainability
@arkrow
Copy link
Owner

arkrow commented Aug 11, 2023

Initial support has been added as of commit 4934afc on the master branch and will be officially available later in the next version release (3.2.0).

Brief description since the documentation has not been added yet:

--alt-export-top N can be used to return the N top loop points (line by line, separated by spaces; format can be seen below), essentially in the same order as in interactive mode.

{loop_start} {loop_end} {note_difference} {loudness_difference} {score}

--alt-export-top -1 can be used to export all discovered loop points. Works with both STDOUT and TXT modes (text mode outputs to a {filename}.alt_export.txt file in the specified output directory).

@arodriguez810
Copy link

arodriguez810 commented Oct 29, 2023

Hello arkrow:

What is the format of the values loop_start and loop_end?, I want to convert them to seconds in Javascript.

3514894 8138262 0.008402583189308643 0.033898335136782975 0.9997586271641953

ty

@arkrow
Copy link
Owner

arkrow commented Oct 30, 2023

What is the format of the values loop_start and loop_end?, I want to convert them to seconds in Javascript.

Both values are in samples, so you can simply divide them by the original file's sample rate, or use an equivalent conversion function.

@MattEqualsCoder
Copy link
Author

The comment above reminded me that I needed to test out the latest code and the new flag, and at first glance it looks good! Thanks for the change!

Any idea when 3.2.0 will be released? Not rushing you or anything, I'm just wondering when I'll need to find time to integrate the changes.

@arkrow
Copy link
Owner

arkrow commented Nov 5, 2023

@MattEqualsCoder Sounds great! Thanks for the feedback. I'm currently working on a few things I'd like to finalize before the next release: a new feature, internal changes, as well as code and CLI documentation. Since current progress is going well, I'd say 3.2.0 could be released by the end of this month.

@arkrow
Copy link
Owner

arkrow commented Dec 1, 2023

The --alt-export-top option has now been officially added as of the 3.2.0 version release. Thanks for the feedback! If you run into any problems, or have an idea to make the CLI tool easier to interface with/be called externally, please do feel free to open a new issue.

@arkrow arkrow closed this as completed Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants