- This script converts a scratch project file (.sb2) to a MusicXML file (song.xml).
- The generated xml file can be used as an input to Sinsy (Singing Voice Synthesis).
- Demo
Let's synthesize vocal part of "Twinkle twinkle little star" using the following score. We code the second measure and after. When the first note is not a rest, an empty measure with a rest will be automatically inserted at the beginning.
- Create a scratch project with lyrics and a melody line. You can refer to or copy a sample project here.
- Note that the name of the sprite needs to be "song".
- Use a pair of "Say ..." and "play note ... for ... beats" for a sound.
- Use "rest for ... beats" for a rest.
- Use preset variables for duration.
- Use hyphen to connect multiple syllables.
- "twin-" + "kle"
- "lit-" + "tle"
- "won-" + "der"
- One note cannot cross over a bar line between measures.
- Save/download the scratch project as a sb2 file.
- Scratch offline editor can also be used after downloading sb2 file.
- Click the button at the top of this page and upload your scratch project (sb2) file.
- Download a generated XML file (song.xml).
- Upload the xml file to Sinsy (Singing Voice Synthesis).
- Download or play the generated wave file.
Download the following files from [Download Zip] and save in the same folder.
- sb2musicxml.html
- sb2musicxml.js
- jszip.min.js
- test/song-homesweethome.wav
- Source scratch project (online) (generated from Japanese lyrics)
- Source scratch project (sb2 file)
- test/song-furusato.wav
- Source scratch project (online) (generated from Japanese lyrics)
- Source scratch project (sb2 file)
- Sing "Happy birthday" with four sprites (online) (generated from Japanese lyrics) <iframe width="560" height="315" src="https://www.youtube.com/embed/VCJcj3ZZ6Jo?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> - Combination with candle blowout; this project utilizes [seq2sprite](https://memakura.github.io/seq2sprite/). <iframe width="560" height="315" src="https://www.youtube.com/embed/95dDLoJVVFg?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
- Support sb3 (Scratch 3 project file).
- MIT License
- jszip.min.js is from https://stuk.github.io/jszip/.
- test/timing-test-homesweethome.sb2
- Combines a generated wave file and the original scratch project and plays simultaneously.
- You can find that "song" sprite is slower than wave file.
- To synchronize precisely, it might be better to use timer in a scratch script.
- test/timing-test-furusato.sb2
- In "song" sprite, variable "beginning-silent-duration" is used to adjust start timing. However, "Song" sprite has some delay especially when many blocks exist.
- Sprite "Giga" uses "timer". So it is synchronized precisely with the song (wave file).