-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
JSON project format #3981
Comments
Did you have plans how to handle external resources? Is this specific point different between XML and json? |
@JohannesLorenz it would just mimic the existing folder layout ( |
Good idea. |
From what I've read YAML is less common for data and more common for configuration. YAML becomes valuable if we have a lot of self-references. Quoting j2y:
|
@tresf , I thought it could be human-readable =) |
Related thing: .lmmsrc.json |
Yaml is best suitable, if you want to edit something or whatever, I suggest comments in projects files with ranges of instruments... It's easier to script by keyboard, without playing audio, than tunin stuff in engine, because mouse clics are too far away to work with at certain parts of interface and entering numbers by hand trough lmms takes a lot of time... I suggest you to not use JSON, because JSON is more horrific to edit then xml, t. javascript programmer |
If we go with YAML, yaml.org points to libfyaml being a spec 1.2 compliant (with 1.3 features it says). It's MIT so it's compatible with GPL. It uses CMake and gives instructions of how to include it. Cons listed:
|
beside the technical considerations between formats of files, would this be a finite break with backward compatibility? |
@musikBear the general consensus is to preserve backwards compatibility at all costs for the foreseeable future for any feature; |
so, if we move to yaml, will there be a way to convert existing project files/presets to yaml? imo keeping support for xml longer than a few versions would be a bit of a hassle, especially if something changed in how the file is structured. Maybe LMMS could automatically convert on project save? |
I think it could auto-convert on project open. |
Since we're also considering a file extension change (I assume from @tresf possible solutions and screenshot example), it probably wouldn't be an auto-convert on save, but only when using save as to explicitly specify the new format. Using the same extension is dangerous since we don't really have any header identifier in the file to say that it's this or that format. My opinion is to have a new file format which will be default on save as, but if using the older This means our save pipeline needs to be modified which will need to be tested in depth. |
@Veratil wrote:
Absolutely 100% spot ON |
one way to avoid that is to attempt to read as yaml, and if it fails it falls back to xml and then converts on save. Would that not be a good way, and why not? |
We aren't treating a single file extension as two separate formats. It's not worth talking about. |
(I assume this means annotating all values, not just literal pitch ranges, given the objection in the comment to "entering numbers by hand through lmms".) I'm against this.
I do like the idea of providing meta-information about the project file format though. I think JSON schema would be suitable here: a schema can be referenced just once at the root of a project file, we can keep a schema up to date as LMMS is developed, it can describe all possible aspects of a project file, and there are libraries for most common languages to use schemas and validate files against them.
I agree that forbidding trailing commas is irritating (C++ has that issue with member initialiser lists which I don't like), but I think "really horrifying" is an exaggeration and this is a rather weak reason not to use JSON. It's not like YAML doesn't have nasty gotchas either: unquoted strings can end up being interpreted as different types in rather unintuitive ways; it's insecure (YAML libraries for multiple languages have or have had arbitrary code execution problems or even features) and we don't want to propagate malware; etc. Not to mention that it's considerably more complex than JSON. I don't see the point of overcomplicating this; it's primarily meant to be a serialisation format after all, and JSON is far from illegible. |
about the trailing commas, doesnt the JSON library for C/C++ handle that? so you wouldn't need to worry about trailing commas anyways |
I have thought about a kind of 'report-feature' Its just some loose thoughts.. |
@musikBear sooo... the help feature? |
@gingkathfox @musikBear can we please stop speculative rhetoric? JSON (or YAML) is meant to improve the experience. It's NOT meant to make a project file a human editable text document. If a UI feature is needed (such as link-specific annotations) track that in a feature. It'll make it just fine into the project file regardless of the format.
👍
💯 |
Project files doesn't have to break backward compatibility. @Veratil I suggest that opening filetype can go opening by extension, changing new extension to .lp (lmms project) and make project file be folder of actual project, from which you can choose on and can be saved to another projects, and projects folders like these could be renderable whole at the time into multiple files. Each of those project folders could contain samples used included in zip, so everything to re-render on another machine would come with a project file, which is nowadays issue. Even if I download something from .lmms portal I have problem opening files. @musikBear just notes file in zip directory with project is what I would suggest, and projects could be folders, remember some people have to transfer samples as individual files and this could help that. @gingkathfox trialing commas are standard of JSON since it changed for saving one line change of github of JSON, however JSON from C++ library is not beautified and I would keep the white space, therefore I would use YAML, maybe some extended YAML, that would allow comments that are not project file, but "range" of value in the line, because then you could just write project file to make music, which would be iconic. Project files over 5MB renders for hours on normal machine, therefore I really think there's enough space to keep white space, it's literally nothing, even on slow DSL internet, and file size doesn't have to be hyper optimalized if it would be negative in one way. |
Qt certainly can (https://doc.qt.io/qt-5/qjsondocument.html#JsonFormat-enum), as can RapidJSON (https://rapidjson.org/classrapidjson_1_1_pretty_writer.html). I'm sure the same goes for most other libraries. |
Sorry my bad. But how you comment inside JSON? |
{
"comment": "This is a comment"
} 😁 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The moderation is done by humans. Let's keep this on-topic and civil please. |
In regards to project formats being a home for in-depth documentation (such as descriptions and value ranges), the project file is currently not the place for it. I agree that polluting the document for commenting purposes is a gross implementation, but that's not the purpose of a project file. Range is part of the instruments, knobs sliders and plugins and managed as such in code. Tracking this information in the project file is not currently a requirement in the software and likewise would need a strong argument for this to keep it in the design. |
i mean, i dont get all this about comments and range, a project would be literally this: {
"name": "This is totally a real project!",
"instruments: [
"tripleoscillator": {
"triposcsetting1": "triposcsetting1value"
}
]
} obviously this is oversimplified, but thats beside the point. the point is you wont need comments. if youre poking at the project file manually, i think we can safely assume you know where to find everything. So heres what i think LMMS should do with project files:
will edit with more as i think of them |
@gingkathfox agree with everything except prettifying. I always prettify by default and as long as there's no major file size penalty, will be my recommendation. Case and point, you just did it to prove your point. 😉 Minified adds a small amount of storage space for -- what I consider -- drastic degradation in readability. |
Here's something worth looking into: It's an open exchange format for DAWs, and allows project files that follow the format to be opened in any DAW that supports it (currently Bitwig Studio and PreSonus Studio One). It's XML in a ZIP container. |
Proposal to add a new JSON-backed, ZIP-encapsulated project format.
The Problem
.mmpz
format is confusing because it's a standard compression with a byte offset that makes it unreadable by common archive tools like 7zip..xml
project format is very resilient but XML can be tricky for power-users to hand-edit and is less popular format for newcomers (as opposed to.yml
,.json
, etc).mmpz
format is compressed, no current standard exists for storing and extracting project resources (samples, patches, soundfonts, plugins, etc)..zip
file and folders/files within.Possible Solutions
.mmpz
save code to fix the byte offset. This would cause compatibility issues, but could address the 7zip problems.-- OR --
.zip
format, designed using standards that our power users already know and are familiar with.Mockup
Benefits
Before
After (mockup)
The text was updated successfully, but these errors were encountered: