Vocal engine (wauvio/vocal)

v3 — Expression, ornaments and events

Ornaments

make_ornament(name, dur, depth) returns a bend curve (semitones vs seconds from note start). Names: fall, doit, shakuri, scoop_in, kobushi, turn, trill, mordent. depth scales size; unknown names return an empty curve. Apply with NoteRef::ornament().

Humanisation and auto-expression

  • Humanize — timing, bias, length, pitch, tone (per-note random brightness/breathiness/mouth opening), entry (starting pitch error corrected within ≈90 ms), pressure (breath pressure sag over a phrase), phrase_gap (0.30 s), seed. All deterministic; different seeds are different “takes”. apply_humanize(), apply_pressure().
  • AutoExpr — switches vibrato (onset/fade/depth follow note length), dynamics (louder toward a phrase’s high point), phrase_end (longer fall and release on the last note), articulation (crisper consonants on fast notes); touches only fields still at Style defaults.
  • phrase_arc_shape(kind, u) — arch, crescendo, decrescendo, swell.

Speech intonation

speech_contour(kind, u) gives the sentence contour. accent_contour(morae, dur, nucleus, height_st = 3, declination_st = 1, mora_weighting) builds a Tokyo-type pitch-accent contour: nucleus 0 = heiban (L H H…), 1 = atamadaka (H L L…), n ≥ 2 = L H…H(n) L…; a nucleus beyond the last mora means accent on the last mora. Timing follows mora_cum(), exactly what the engine uses.

Events

Non-lexical vocal events are written as lyric tags — <kind[:variant][,intensity=0..1][,pitch=semitones][,key=value…]> — and expanded at render time into ordinary notes with pitch contours and lanes, so they are produced by the same voice. Kinds are available from event_kinds(): laugh, giggle, sob, hum/hmm, shout, kyaa, and interjections (ah, eh, un, fuun, uun, eeto, ano, waa, hya, hee, eee, maa).

  • Variants are lyric syllables for most kinds (they must parse to at least one mora). hum/hmm accept only “”, “hmm”, “hm?” and “mhm”; laugh/giggle also accept “kusu”.
  • parse_event_tag(tag, EventSpec&), is_event_tag(), diagnose_event(spec) (unknown kind/variant/parameter; empty = fine), expand_event(note, spec, seed). EventSpec::bad lists malformed parameters.
  • Use Singer::event(kind, midi, seconds, intensity, variant) or put the tag in a lyric (note_sec(69, 1.2, "<laugh>")).

Full API listing

wauvio/vocal/yune-v3/expression.hpp

wauvio::vocal::v3::Free functions, constants and aliases

//   fall, doit, shakuri, scoop_in, kobushi, turn, trill, mordent
// `depth` scales the size (1 = typical). Unknown names return an empty curve.
inline Curve make_ornament(const std::string& name, double dur, float depth = 1.f)

wauvio::vocal::v3::struct Humanize

struct Humanize
    bool   on = false;
    double timing = 0.0;    // s, spread of note-start offsets
    double bias = 0.0;      // s, constant push (+ late / lazy, - ahead)
    double length = 0.0;    // fraction, spread of note-length changes
    double pitch = 0.0;     // semitones, spread of per-note tuning offsets
    double tone = 0.0;      // 0..1: per-note random brightness / breathiness / mouth-opening (no two notes sound identical)
    double entry = 0.0;     // semitones, spread of the pitch error a note starts with (corrected within ~90 ms)
    double pressure = 0.0;  // 0..1: breath pressure sags over a phrase (slightly quieter and flatter toward its end)
    double phrase_gap = 0.30; // s of silence that starts a new phrase
    uint32_t seed = 1;      // different seed = a different "take"
    inline float hash01(uint32_t x) { x ^= x >> 16; x *= 0x7feb352dU; x ^= x >> 15; x *= 0x846ca68bU; x ^= x >> 16; return static_cast<float>(x & 0xFFFFFF) / 16777216.f; }
    inline float sym3(uint32_t seed, uint32_t i, uint32_t k) {      // ~triangular in [-1,1]
inline void apply_humanize(std::vector<SynthNote>& ns, const Humanize& h)
// Breath pressure over phrases: a gentle level and pitch sag that resets at each new phrase.
inline void apply_pressure(std::vector<SynthNote>& ns, const Humanize& h)

wauvio::vocal::v3::struct AutoExpr

struct AutoExpr
    bool on = false;
    bool vibrato = true;      // onset/fade/depth follow note length
    bool dynamics = true;     // louder toward the phrase's high point
    bool phrase_end = true;   // longer fall + release on a phrase's last note
    bool articulation = true; // crisper consonants on fast notes
    double phrase_gap = 0.30; // s of silence that starts a new phrase
inline void apply_auto_expression(std::vector<SynthNote>& ns, const AutoExpr& a, const VoiceModel& voice)
inline double phrase_arc_shape(const std::string& kind, double u)
/// V3: Tokyo-type pitch accent as a contour (semitones vs seconds from the start of an utterance).
/// nucleus: 0 = heiban (L H H H ... no fall), 1 = atamadaka (H L L ...), n >= 2 = L H .. H(n) L ...
/// (the pitch falls after mora n; a nucleus past the last mora means accent on the last mora, as in
/// "otouto" + particle). height_st is the L-H distance; declination_st is the slow downdrift over the utterance.
/// Mora timing follows mora_cum(), i.e. exactly what the engine will do with those morae.
inline Curve accent_contour(const std::vector<Mora>& ms, double dur, int nucleus,
                            float height_st = 3.0f, float declination_st = 1.0f, float mora_weighting = 1.f)
inline double speech_contour(const std::string& kind, double u)

wauvio/vocal/yune-v3/events.hpp

wauvio::vocal::v3::struct EventSpec

// Non-lexical vocal events (laughs, giggles, sobs, shouts, hums, interjections).
// They are written as a lyric tag, e.g. `<laugh>`, `<laugh:he,intensity=0.8>`,
// `<sob>`, `<hmm?>`, `<kyaa>`, and are expanded at render time into ordinary
// notes with pitch contours and expression lanes, so they
// are generated by the same voice, not spelled out as syllables.
//   <kind[:variant][,intensity=0..1][,pitch=semitones][,key=value...]>
struct EventSpec
    std::string kind, variant;
    std::map<std::string, float> p;
    std::vector<std::string> bad;    // V3: problems found while parsing (malformed or non-numeric parameters)
    float get(const std::string& k, float d) const { auto it = p.find(k); return it == p.end() ? d : it->second; }
inline bool is_event_tag(const std::string& s) { return s.size() >= 3 && s.front() == '<' && s.back() == '>'; }
inline bool parse_event_tag(const std::string& tag, EventSpec& out)
    struct Rng
        uint32_t s;
        float next() { s ^= s << 13; s ^= s >> 17; s ^= s << 5; return static_cast<float>(s & 0xFFFFFF) / 16777216.f; }
        float sym() { return next() * 2.f - 1.f; }
    // normalised (0..1) contour -> seconds, offset by the fractional part of the pitch
    inline Curve scale_contour(const std::vector<std::pair<double, double>>& c, double dur, double off)
    inline SynthNote make(const SynthNote& par, double t0, double dur, double midi_f, const std::string& lyric, float vel,
                          const std::vector<std::pair<double, double>>& contour)

    inline void glottal_end(SynthNote& n) {           // abrupt stop with a touch of creak (あっ!)
    struct Interj { const char* lyric; std::vector<std::pair<double, double>> contour; float vel, breath; bool glottal; float mouth, tension; };
    inline const std::map<std::string, Interj>& interjections()
inline std::vector<std::string> event_kinds()
/// V3: everything wrong with a parsed event tag (unknown kind, unknown variant, unknown or malformed parameter).
/// Empty = fine. Variants are lyric syllables for most kinds (they must parse to at least one mora);
/// hum/hmm accept only "", "hmm", "hm?" and "mhm"; laugh/giggle also accept "kusu".
inline std::vector<std::string> diagnose_event(const EventSpec& sp)
// Expands one event note into ordinary notes. Returns an empty list for an unknown kind.
inline std::vector<SynthNote> expand_event(const SynthNote& par, const EventSpec& sp, uint32_t seed)