v3 — Ensemble, FX chain and mic
Ensemble
Header ensemble.hpp. Several Singers rendered together and mixed to stereo — harmonies, doubled leads, small choirs, duets. Every part is an independent monophonic singer, so each keeps its own coarticulation, pitch tracker and voice. Parts are mixed with constant-power panning; no normalisation is applied by render_stereo() (save() normalises to a 0.9 peak).
Singer lead; /* … add notes … */
Ensemble e;
e.add(lead, "lead"); // centre
e.add_double(lead, 2); // two other takes, detuned and spread
e.add_harmony(lead, +4, "third", -0.4f, 0.6f); // a third above, left, quieter
e.add_harmony(lead, -5, "low", 0.4f, 0.6f, &profile); // a fourth below, sung by another voice
StereoBuffer mix = e.render_stereo();| Method | Meaning |
|---|---|
add(singer, name, pan, gain, delay_s) | Copy of a singer as a part; returns Part& (singer, name, pan, gain, delay, mute) |
add_voice(profile, name, pan, gain) | Empty part with its own voice to fill |
add_harmony(lead, semitones, name, pan, gain = 0.7, voice*, delay_s) | Same notes shifted; optionally another voice |
add_double(lead, copies = 2, spread = 0.7, detune_cents = 6, gain = 0.55, max_delay_s = 0.012, first_take = 11) | Double-tracking with per-copy timing/pitch imperfection, detune, entry delay and stereo spread |
size(), operator[], clear(), render_stereo(), save() | Access and output |
Vocal FX chain
Header vocal_fx.hpp, included by vocal/v3_fx.hpp (kept separate so the engine itself does not depend on wauvio::fx). make_vocal_chain(preset, bpm) builds an fx::Chain: EQ → compressor → (delay) → reverb → limiter. Presets from vocal_chain_presets(): natural (transparent polish, a little room), pop (tighter, brighter, dotted-eighth slap, bigger reverb; delay syncs when bpm > 0), intimate (close, warm, nearly dry), hall (gentle compression, long hall). Unknown names throw std::invalid_argument. process_vocal(dry, preset, mic*, sr, bpm) runs optional mic model plus chain from a mono render to finished stereo; overloads accept a StereoBuffer such as an ensemble mix.
MicModel
Header mic.hpp. An optional recording stage; Singer::render never calls it, so apply it to the rendered buffer with apply_mic(buffer, sr, model). Fields (0–1): proximity (low-shelf warmth, up to +5 dB below ≈200 Hz), air (high shelf above ≈9 kHz, up to +4 dB), de_ess (dynamic cut of 5–9 kHz when sibilants spike), mouth_noise (tiny deterministic clicks in quiet passages), seed.
Full API listing
wauvio/vocal/yune-v3/ensemble.hpp
wauvio::vocal::v3::class Ensemble
/// V3: several Singers rendered together and mixed to stereo: harmonies, doubled leads, small choirs, duets.
///
/// Singer lead; ... add notes ...
/// Ensemble e;
/// e.add(lead, "lead"); // centre
/// e.add_double(lead, 2); // two other takes, detuned and spread left/right
/// e.add_harmony(lead, +4, "third", -0.4f, 0.6f); // a third above, a little left, quieter
/// e.add_harmony(lead, -5, "low", 0.4f, 0.6f, &voice_itsuki()); // a fourth below, sung by another voice
/// StereoBuffer mix = e.render_stereo();
///
/// Every part is an independent monophonic Singer, so each keeps its own coarticulation, pitch tracker and
/// voice. Parts are mixed with constant-power panning; no normalisation is applied (use normalize or a chain).
class Ensemble
public:
struct Part
Singer singer;
std::string name;
float pan = 0.f; // -1 left .. +1 right
float gain = 1.f;
double delay = 0.0; // seconds of silence added in front of this part
bool mute = false;
/// Adds a copy of `s` as a part and returns it (set .pan/.gain/.delay or edit .singer afterwards).
Part& add(const Singer& s, const std::string& name = "", float pan = 0.f, float gain = 1.f, double delay_s = 0.0)
/// Adds an empty part with its own voice for you to fill in (`ensemble[i].singer.note(...)`).
Part& add_voice(const VoiceProfile& p, const std::string& name = "", float pan = 0.f, float gain = 1.f)
/// Same notes, shifted by `semitones`. Pass a profile to have another voice sing it.
Part& add_harmony(const Singer& lead, int semitones, const std::string& name = "", float pan = 0.f, float gain = 0.7f,
const VoiceProfile* voice = nullptr, double delay_s = 0.0)
/// Double-tracking: `copies` extra takes of the same notes, each with its own timing/pitch imperfection,
/// a few cents of detune and a small entry delay, spread across the stereo field.
/// spread: 0..1 how far left/right the copies go; detune_cents: largest detune; gain: level of each copy.
Ensemble& add_double(const Singer& lead, int copies = 2, float spread = 0.7f, double detune_cents = 6.0,
float gain = 0.55f, double max_delay_s = 0.012, uint32_t first_take = 11)
size_t size() const noexcept { return parts_.size(); }
Part& operator[](size_t i) { return parts_.at(i); }
const Part& operator[](size_t i) const { return parts_.at(i); }
void clear() { parts_.clear(); }
/// Renders every part and mixes them (parts are rendered independently, so this is deterministic).
StereoBuffer render_stereo(int sample_rate = 0) const
/// Renders, normalises to 0.9 peak and writes a stereo WAV.
void save(const std::string& path, int sample_rate = 0) const
wauvio/vocal/yune-v3/vocal_fx.hpp
Free functions, constants and aliases
// Optional: a ready-made vocal effect chain built from wauvio::fx. Include wauvio/vocal/v3_fx.hpp (which pulls in this
// header, wauvio/fx.hpp and the V3 vocal engine). Kept separate so the vocal engine itself does not depend on wauvio::fx.
inline std::vector<std::string> vocal_chain_presets() { return { "natural", "pop", "intimate", "hall" }; }
/// V3: EQ -> compressor -> (delay) -> reverb -> limiter, voiced for a sung lead.
/// natural : transparent polish, a little room
/// pop : tighter and brighter, dotted-eighth slap, bigger reverb
/// intimate : close, warm, nearly dry
/// hall : gentle compression, long hall
/// bpm > 0 syncs the delay (pop) to the song tempo. Unknown preset names throw std::invalid_argument.
inline fx::Chain make_vocal_chain(const std::string& preset = "natural", double bpm = 0.0)
/// One call: (optional mic model) -> chain, from a mono voice render to a finished stereo signal.
inline StereoBuffer process_vocal(Buffer dry, const std::string& preset = "natural", const MicModel* mic = nullptr,
int sample_rate = 0, double bpm = 0.0)
/// Same for an already-stereo signal (for example Ensemble::render_stereo()).
inline StereoBuffer process_vocal(StereoBuffer s, const std::string& preset = "natural", int sample_rate = 0, double bpm = 0.0)
wauvio/vocal/yune-v3/mic.hpp
wauvio::vocal::v3::struct MicModel
// Optional "recording" stage: proximity warmth, de-esser, air band, mouth/lip noise.
// Not part of the voice (Singer::render never calls it); apply to the rendered Buffer.
struct MicModel
float proximity = 0.f; // 0..1: low-shelf warmth (+0..5 dB below ~200 Hz), as when singing close
float air = 0.f; // 0..1: high shelf above ~9 kHz (+0..4 dB)
float de_ess = 0.f; // 0..1: dynamic cut of 5-9 kHz when sibilants spike
float mouth_noise = 0.f; // 0..1: tiny deterministic lip/tongue clicks in quiet passages
uint32_t seed = 7;
struct Bq { double b0 = 1, b1 = 0, b2 = 0, a1 = 0, a2 = 0, z1 = 0, z2 = 0;
double run(double x) { const double y = b0 * x + z1; z1 = b1 * x - a1 * y + z2; z2 = b2 * x - a2 * y; return y; } };
inline Bq shelf(bool high, double fc, double gain_db, double sr) { // RBJ shelf, S = 1
inline Bq bandpass(double fc, double Q, double sr)
inline void apply_mic(Buffer& b, int sr, const MicModel& m)
wauvio/vocal/v3_fx.hpp
This header declares no public types or functions (it is an umbrella / include-only header).