-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: Fruity Slicer #158
base: master
Are you sure you want to change the base?
feat: Fruity Slicer #158
Conversation
pyflp/plugin.py
Outdated
"""The BPM (beats per minute) of the sample.""" | ||
|
||
pitch_shift = _NativePluginProp[int]() | ||
"""Pitch shift, in cents. Linear, 1:1. |
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.
Linear and 1:1 is the same thing. Remove 1:1.
I plan on creating a glossary section in my docs which explains all these terms.
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.
Apart from the changes mentioned, you alsoe need to:
- Import and add
FruitySlicer
here - Add a test preset and add unit tests for it.
If you feel that one of the existing or a new construct
adapter can be used, let me know.
pyflp/plugin.py
Outdated
|
||
| Type | Value | Representation | | ||
|---------|--------|--------------------------| | ||
| Min | -20000 | 25% / 60 bpm to 240 bpm | |
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.
Use a shorter 60-240 BPM
for all 3 of them
pyflp/plugin.py
Outdated
animate = _NativePluginProp[bool]() | ||
"""Whether to highlight the slices as they are played.""" | ||
|
||
starting_note = _NativePluginProp[int]() |
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.
Shorter name start_note
), | ||
"fade_in" / c.Int32ul, | ||
"fade_out" / c.Int32ul, | ||
"file_path" / c.PascalString(c.Int8ul, "utf-8"), |
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.
Might be a VarInt
prefixed string. If 2 bytes are used to encode a path having >127 characters then its definitely VarInt prefixed.
pyflp/plugin.py
Outdated
/ c.PrefixedArray( | ||
c.Int32ul, | ||
c.Struct( | ||
"name" / c.PascalString(c.Int8ul, "utf-8"), |
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.
Same as above.
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.
Just checked these, the file path does seem to be a u8, but interestingly, the slice name field seems to be a bit unusual. The name is capped at 257 bytes, but it uses a different size format that seems to adapt to the actual length of the string. From what I can tell, the first byte is either the length of the string or 0xFF to indicate that the length is actually defined by the next four bytes (a u32). For example, hex 40
would indicate a string of 64 bytes, and the size field would only take up one byte. However, hex ff01010000
would indicate a string of 257 bytes, and the size field would take up five bytes, the first simply defining the next four as the size. I haven't checked, and it doesn't really matter for this purpose, but it might be possible that this could extend to a u64 as well using the same pattern. Perhaps an adapter (AdaptiveInteger
?) could be implemented for this?
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.
This is legit weird. Whatever could have stopped IL from using a VarInt instead? An adapter isn't enough here. We need a Construct subclass here.
Also are you sure about the file path? Windows allows path names upto 32767 characters with the 260 limitation removed. It might be that the file_path
uses the same encoding as slice name
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.
The file path does seem to be limited to 255 characters, but it gets weirder -- attempting to load a sample with a longer path results in FL Studio itself crashing with the memory error free(): invalid next size (normal)
. I tested this in both FL 20 and 21 with the same result. It's probably safe to say that the path is a u8, but if you can't reproduce this, I'm not sure what's going on 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.
I get no such error in FL Studio 20.8.3.2304 - either while loading, or saving the project, or even re-opening the project.
This is how the file path was serialised, in the form of old 8.3 format using the ~1
hack.
The full path is:
F:\ABCABCABCABCABCABCABCABCABCABCABCABCABCBACBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBBABCBBCBABCBC\ABCABCABCABCABCABCABCABCABCABCABCABCABCBACBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBBABCBBCBABCBC\ABCABCABCABCABCABCABCABCABCABCABCABCABCBACBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBBABCBBCBABCBC\DJAY...
There is a setting on Windows to remove the 260 limitation. Have you enabled it?
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
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 do have enabled, but I believe the reason it was crashing may have been due to Wine (I run Linux). With a unique file path of 259 characters, it seemed to use the same format as the slice names (the data field was FF 03 01 00 00). I assume maybe it shortens paths that are 260 characters or longer, but keeps paths that are longer than 260 characters the same, where this obscure format is only used for paths between 255 and 259 characters.
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.
Alright the length doesn't matter here, our construct will just need to check if the FF marker exists (and parse the next 4 bytes if it does).
pyflp/plugin.py
Outdated
), | ||
), | ||
"animate" / c.Flag, | ||
"starting_note" / c.Int32ul, |
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.
Shorter name start_note
This adds a plugin data parser for the generator plugin Fruity Slicer.