-
Notifications
You must be signed in to change notification settings - Fork 35
Lyrics
storybrew can help with making a lyrics storyboard by loading subtitle files and automatically generating text sprites. You can find an example of this in scripts/Lyrics.cs.
Subtitles can be loaded in your script with the following method:
var subtitles = LoadSubtitles(path);
Where path points to a .srt file in your project's folder (not mapset!). This is a standard subtitle file that can be made with a tool like aegisub. These subtitles contain multiple lines that can be accessed this way:
foreach (var line in subtitles.Lines)
Each line has Text, StartTime and EndTime properties.
First, you need to declare a font:
var font = LoadFont(spritesPath, new FontDescription() {
FontPath = "Verdana",
FontSize = 26,
});
Then you can use it to build text sprites:
var texture = font.GetTexture("Some text");
var sprite = layer.CreateSprite(texture.Path, OsbOrigin.Centre, new Vector2(320, 400));
And by using the previously loaded subtitles, you can display your lyrics :
foreach (var line in subtitles.Lines)
{
var texture = font.GetTexture(line.Text);
var sprite = layer.CreateSprite(texture.Path, OsbOrigin.Centre, new Vector2(320, 400));
sprite.Fade(line.StartTime - 200, line.StartTime, 0, 1);
sprite.Fade(line.EndTime - 200, line.EndTime, 1, 0);
}
Need help with something that isn't in the wiki? Try contacting Damnae in osu! or Discord.
