Skip to main content

Goal

This page explains Score and Note details for song synthesis. The behavior is based on Revolution\Voicevox\Song\Note, Score, and SongAudioQuery.

Note class

Note represents one musical note (or one rest).

Constructor arguments

Frame-length calculation

length is in frames. From seconds:
This is not very intuitive, so Note::len() is the practical helper for MIDI-oriented workflows.
  • Uses the common MIDI assumption: quarter note = 480 ticks
  • Default tempo is 125 BPM
  • Internally rounds to integer with round(), so long songs can accumulate small rounding errors
Note::len() is convenient, but keep cumulative rounding error in mind for long compositions.

Rest representation

A rest is expressed as:

MIDI note quick table

Score class

Score is a container for an array of Note objects.

Critical rule

The first note must always be a rest.

Main API

  • Score::make(array $notes) to create a score
  • add(Note $note) to append one note
  • toJson() to serialize
Score internally normalizes array input and handles empty-string/null lyric cases, so it stays safe with Laravel’s ConvertEmptyStringsToNull middleware in form-driven flows.
In production, storing chart data in JSON is usually more maintainable than hardcoding long note arrays in PHP.
  1. Save your own chart format as JSON
  2. Load JSON and convert into Note / Score
  3. Pass it to Voicevox::song() for synthesis

JSON example

Load and synthesize

Last modified on May 23, 2026