Replies: 3 comments 1 reply
-
Another thing I'd like to add is JSON-based testing. I'd love to have a shared project with a .sng file that exercises all the abilities and bug fixes of the format and provides the JSON equivalent. Then we'd be able to git submodule them into each library so they test against the same input to check for the same output. |
Beta Was this translation helpful? Give feedback.
-
Makes sense to me. I suppose that figuring out that JSON step might be the first thing to do. If the goal is to take a standardized JSON format and be able to generate a SongPro file in various libraries it would be good to have that as a starting point. My thoughts on that is that is cannot be too complex, especially if you want someone to be able to pick a library and generate a song from scratch. Uncommon features should be optional, and the libraries should infer smart defaults. At this point though it begins blurring the line between a JSON format and the API of the library that's building the file. For example in my various song parsers/builders (OpenLyrics, ProPresenter) those formats allow some fairly complex options (chords, comments, colors, custom tags, UI labels, etc) but I'd imagine most people only want the lyrics. So I allow for both an array of these complex objects to be passed in that describe everything, or just a simple array of strings (the lyrics). An example from the OpenLyrics builder. This is how you can create a complex song with lots of added in features {
name: 'v1',
lines: [
{
part: "women",
content: [
{type: "comment", value: "sing this quietly"},
{type: "chord", root: "D", bass: "F#"},
{type: "text", value: "Amazing grace\n"},
{type: "chord", root: "C",},
{type: "text", value: "how sweet the sound\nthat saved "},
{type: "chord", root: "B7" },
{type: "text", value: "a "},
{type: "tag", name:"red", value: "wretch"}
{type: "text", value: " like me"}
]
}
]
} or if you just wanted the lyrics only and didn't need/care for those extras, you can do this: {
name: 'v1',
lines: [ "Amazing grace\nhow sweet the sound\nthat saved a wretch like me" ]
} I say all that because (and keep in mind I am not a musician!) I would imagine that adding chords to a song programatically might be annoying in some cases. It might be easier to just create a SongPro file with the lyrics only, and then open that file later and add the chords in visually. But if using a tool to create the file or if it were converted from another format it would be great to have the ability to do it all right there too. Alternatively though... if you already knew the chords I suppose there's nothing stopping you from just added them as text to the lyrics in the builder either. I mean... why not, it would be zero effort, right? So with that in mind, in theory creating a basic SongPro file could look something like this: Plain Stringsconst opts = {
attrs: {
title: "Free Bird",
artist: "Lynyrd Skynyrd"
},
sections: [
{
name: "Verse 1",
lines: [
"If I leave here tomorrow",
"Would you still remember me",
"For I must be travelin' on now",
"'Cause there's too many places I've got to see",
"But if I stay here with you girl",
"Things just couldn't be the same",
"'Cause I'm as free as a bird now",
"And this bird you cannot change, oh",
]
},
]
};
SongPro.build(opts); Plain strings with Chordsconst opts = {
attrs: {
title: "Free Bird",
artist: "Lynyrd Skynyrd"
},
sections: [
{
name: "Verse 1",
lines: [
"[G]If I [D/F#]leave here to-[Em]morrow",
"[F]Would you [C]still remember [Dsus4]me",
"[G]For I must [D/F#]be travelin' [Em]on now",
"[F]'Cause there's too many [C]places I've got to [Dsus4]see",
"[G]But if I [D/F#]stay here with [Em]you girl",
"[F]Things just [C]couldn't be the [Dsus4]same",
"[G]'Cause I'm as [D/F#]free as a [Em]bird now",
"[F]And this [C]bird you cannot [Dsus4]change, oh"
]
},
]
};
SongPro.build(opts); Objects with chords(this is basically the object that the current JS parser produces) const opts = {
attrs: {
title: "Free Bird",
artist: "Lynyrd Skynyrd",
},
sections: [
{
name: "Verse 1",
lines: [
{
parts: [
{ chord: "G", lyric: "If I" },
{ chord: "D/F#", lyric: "leave here to-" },
{ chord: "Em", lyric: "morrow" },
],
},
{
parts: [
{ chord: "F", lyric: "Would you" },
{ chord: "C", lyric: "still remember" },
{ chord: "Dsus4", lyric: "me" },
],
},
{
parts: [
{ chord: "G", lyric: "For I must" },
{ chord: "D/F#", lyric: "be travelin'" },
{ chord: "Em", lyric: "on now" },
],
},
{
parts: [
{ chord: "F", lyric: "'Cause there's too many" },
{ chord: "C", lyric: "places I've got to" },
{ chord: "Dsus4", lyric: "see" },
],
},
{
parts: [
{ chord: "G", lyric: "But if I" },
{ chord: "D/F#", lyric: "stay here with" },
{ chord: "Em", lyric: "you girl" },
],
},
{
parts: [
{ chord: "F", lyric: "Things just" },
{ chord: "C", lyric: "couldn't be the" },
{ chord: "Dsus4", lyric: "same" },
],
},
{
parts: [
{ chord: "G", lyric: "'Cause I'm as" },
{ chord: "D/F#", lyric: "free as a" },
{ chord: "Em", lyric: "bird now" },
],
},
{
parts: [
{ chord: "F", lyric: "And this" },
{ chord: "C", lyric: "bird you cannot" },
{ chord: "Dsus4", lyric: "change, oh" },
],
},
],
},
],
};
SongPro.build(opts); Just my $0.02 for now. |
Beta Was this translation helpful? Give feedback.
-
I was coming from the angle of only using JSON for testing - a common format that could work across all languages. I suppose it's a valid output format as well, though. But I have no expectation that end users should worry about using the JSON format, unless they are a developer. I want the CLI and Web tooling to allow people to use the markdown-esque SongPro format to generate ASCII, HTML or PDF charts. And yes, I think the JSON will pretty much look like the object that each language generates. I do think there's a different in the JS library where core attributes are put under |
Beta Was this translation helpful? Give feedback.
-
Currently all the SongPro libraries in various languages can take the text of a SongPro formatted text file/string and create a SongPro object out of it. Users of the libraries can the generate whatever output they'd like.
I think the libraries would benefit from some additional functionality to improve interoperability with the SongPro format. Here are some things I think would be good additions:
Given all of the above, I'd be interested in talking about what the API for all that might look like.
I'd also love for all of this to be available in a command-line tool that's available for macOS, Windows and Linux - that's why I worked at getting the Crystal library up to spec.
I'm still not sure if Crystal is a good language investment but it's very similar to Ruby, can cross-compile and was a lot easier to learn than Rust (the other language I was considering for a CLI)
Beta Was this translation helpful? Give feedback.
All reactions