YuriSizov / boscaceoil-blue

A beginner-friendly music making app.
Other
498 stars 17 forks source link

File format v4 ideas #1

Open YuriSizov opened 5 months ago

YuriSizov commented 5 months ago

Due to the sequential nature of the saved file format pretty much any change or fix to it requires an introduction of the next format version. This issue is a tracker for ideas, suggestions, and bugs, which require file format changes, so they can be done together as a one version increment.

Ideas

Implementation notes

String support

Right now the document only supports integers as values. In fact, the entire thing is just one line of comma-separated integers (with a trailing comma to wrap things up). Some of the ideas above require us to be able to store strings. The file is a text document, which is great, and using UTF-8 we shouldn't have any encoding issues.

Strings can be stored as two comma-separated values: an int that signifies the string's length, and then the string itself, without any modifications or wrapping, e.g.

12,Hello world!,

The file reader, as it is implemented in Bosca Ceoil Blue, goes through the string character by character. So a string can contain a comma, and it won't break the parser. We would rely solely on length, which is not that different from how instrument and pattern parsing is implemented.

JD557 commented 5 months ago

I know it's a bit off-topic regarding the file format, but if you plan to break the format, please also look into the old issues tracker for issues that are simple to fix, but we're not due to being a breaking change.

The example that immediately comes to mind is https://github.com/TerryCavanagh/boscaceoil/issues/103, which bothers me way more than it should 😅

YuriSizov commented 5 months ago

@JD557 Thanks for a pointer! I definitely want to look into all open issues in the original repo once the bulk of this port is done.

The one you've linked isn't directly related to the file format, but depending on the fix the old format importers must handle it gracefully. So, for instance, if we change existing scales and add "Minor (Compat)" etc at the end of the list, all existing files must seamlessly use that new compat value instead of the original one. Which, I guess, does mean that to properly store new scales we'd need to enforce the next file format version, heh!

nobuyukinyuu commented 4 months ago

Here is a chunk type that can be used for adding metadata to wave format files, for future reference: https://www.recordingblogs.com/wiki/list-chunk-of-a-wave-file

Most players should ignore chunks they don't understand. I seem to remember Cool Edit storing similar metadata in either LIST or INFO chunks. There is no universal standard and other annotation chunk types exist ..

YuriSizov commented 4 months ago

@nobuyukinyuu Ah, that's nice! MIDI also has a few events that might be fitting for song metadata and claim of ownership. This gives more weight to the idea, thanks!