Download cpp/src/synth.h from RL10x/tiny-voca-hindi: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/RL10x/tiny-voca-hindi/resolve/main/cpp/src/synth.h
- Command line
-
hf download hf://RL10x/tiny-voca-hindi/cpp/src/synth.h
-
curl -L -o synth.h https://huggingface.co/RL10x/tiny-voca-hindi/resolve/main/cpp/src/synth.h
1.38 kB
| // Source-filter synthesizer of the Hindi tiny-voca TTS: a C++ port of tiny_voca.model.SourceFilter.forward and | |
| // pulse_train (tts_hi/tiny_voca/model.py). Plain C++, no ggml: the network only predicts the per-frame heads. | |
| struct SynthConfig { | |
| int sample_rate = 24000, hop = 256; | |
| int synth_fft = 512, synth_hop = 128, noise_fft = 256, noise_hop = 64; | |
| int cep_causal = 80, cep_anti = 16, noise_cep = 32; | |
| float harmonic_limit = 0.47f; | |
| std::vector<float> causal_lifter, anti_lifter, noise_lifter; | |
| }; | |
| // harmonic: [T][cep_causal + cep_anti + hop/synth_hop] row-major, noise_head: [T][noise_cep + hop/noise_hop], | |
| // f0: [T] Hz, noise: T*hop white-noise samples. Returns T*hop samples. | |
| std::vector<float> synthesize_wave(const SynthConfig& c, const float* harmonic, const float* noise_head, const float* f0, | |
| int T, const float* noise); | |
| // Vocos ISTFTHead after its Linear: head [frames][n_fft + 2] = (log magnitude, phase) per bin -> torch.istft | |
| // (center=True, periodic Hann, window = n_fft). Returns hop * (frames - 1) samples. | |
| std::vector<float> vocos_istft(const float* head, int frames, int n_fft, int hop); | |
| // Band-limited pulse train (unit power), as model.pulse_train. | |
| std::vector<float> pulse_train(const float* f0, int T, int sample_rate, int hop, double limit); | |