{"id":47709436,"url":"https://github.com/organization/hifisampler-go","last_synced_at":"2026-04-04T20:01:34.507Z","repository":{"id":347851587,"uuid":"1195447001","full_name":"organization/hifisampler-go","owner":"organization","description":"A high-performance UTAU resampler based on pc-nsf-hifigan, rewritten in Go.","archived":false,"fork":false,"pushed_at":"2026-04-03T08:44:46.000Z","size":23108,"stargazers_count":17,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-03T20:02:39.876Z","etag":null,"topics":["go","hifigan","hifisampler","onnx","openutau","resampler","rust","singing-voice-synthesis","utau"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/organization.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-29T17:26:02.000Z","updated_at":"2026-04-03T16:53:49.000Z","dependencies_parsed_at":"2026-04-03T19:00:57.471Z","dependency_job_id":null,"html_url":"https://github.com/organization/hifisampler-go","commit_stats":null,"previous_names":["organization/hifisampler-go"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/organization/hifisampler-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/organization%2Fhifisampler-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/organization%2Fhifisampler-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/organization%2Fhifisampler-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/organization%2Fhifisampler-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/organization","download_url":"https://codeload.github.com/organization/hifisampler-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/organization%2Fhifisampler-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31411657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T19:29:44.979Z","status":"ssl_error","status_checked_at":"2026-04-04T19:29:11.535Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","hifigan","hifisampler","onnx","openutau","resampler","rust","singing-voice-synthesis","utau"],"created_at":"2026-04-02T18:26:22.544Z","updated_at":"2026-04-04T20:01:34.486Z","avatar_url":"https://github.com/organization.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hifisampler-go\n\nA high-performance UTAU resampler based on [pc-nsf-hifigan](https://github.com/openvpi/vocoders), rewritten in Go.\n\nThis is a Go rewrite of [hifisampler](https://github.com/openhachimi/hifisampler) (originally Python + C#) for improved startup time, lower memory usage, and single-binary deployment. (drop-in replacement)\n\n**For Jinriki please use [Hachimisampler](https://github.com/openhachimi/hachimisampler).**\n\n## Compare\n\n#### Env\n\n- AMD Ryzen 7800X3D\n- NVIDIA RTX4080\n\n|                    Python PyTorch (Original, GPU)                   |                                                        Go (GPU) |\n|:------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------:|\n| ![Python GPU](https://github.com/user-attachments/assets/82ceb50d-e477-4fba-87df-a9317eb74121) | ![Go GPU](https://github.com/user-attachments/assets/bd2f71fb-9db0-4af4-9965-8f31670e2fd9) |\n\n- `hifisampler-go` is 2.75+ times faster than `hifisampler`.\n\n|                    Python PyTorch (Original, CPU)                   |                                                        Go (CPU) |\n|:------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------:|\n| \u003cimg width=\"412\" height=\"42\" alt=\"image\" src=\"https://github.com/user-attachments/assets/b3cea130-5547-468e-b0dd-54bd8def192d\" /\u003e | \u003cimg width=\"395\" height=\"49\" alt=\"image\" src=\"https://github.com/user-attachments/assets/c91d9543-d4ba-447d-8685-1e95f5c22371\" /\u003e |\n| \u003cimg width=\"300\" alt=\"image\" src=\"https://github.com/user-attachments/assets/91d431f4-c77a-4f39-b885-fef8be824a6b\" /\u003e | \u003cimg width=\"300\" alt=\"image\" src=\"https://github.com/user-attachments/assets/ea46a648-a33b-4a34-82ae-953708d6899f\" /\u003e |\n\n### Voice Sample\n\n#### Env\n\n- MacBook Pro 14 (M4 Pro), macOS 26.4\n- CoreML\n\n|                 Worldline-R (Original)                 |                                                         hifisampler-go                                                      |\n|:------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------:|\n| \u003cvideo src=\"https://github.com/user-attachments/assets/79b9e642-142c-4798-8bd2-40817916557d\"\u003e\u003c/video\u003e | \u003cvideo src=\"https://github.com/user-attachments/assets/b2ec56f6-c169-4f77-8973-e2472ba65057\"\u003e\u003c/video\u003e |\n\n- End of rain (feat. 初音ミク), Shake Sphere. UST By cillia\n\n## Architecture\n\n- **Server** (`hifiserver`): HTTP + TCP + IPC server that loads ONNX models and performs neural vocoder inference\n- **Client (HTTP)** (`hifisampler`): Lightweight Rust executable; communicates via HTTP\n- **Client (IPC)** (`hifisampler-ipc`): Minimal Rust executable; tries IPC (Unix socket / Named Pipe) first, falls back to TCP\n\n| Component | Language | Protocol |\n|-----------|----------|----------|\n| Server    | Go       | HTTP :8572, TCP :8573, IPC (Unix socket / Named Pipe) |\n| Client HTTP | Rust   | HTTP |\n| Client IPC  | Rust   | IPC → TCP fallback |\n\nThe IPC client is recommended for OpenUTAU where the resampler is called dozens of times per second, as it eliminates network stack overhead entirely.\n\n## GPU Support\n\nThe server automatically detects and uses the best available GPU via ONNX Runtime execution providers:\n\n| GPU Vendor | Provider | Platform | Detection Priority |\n|---|---|---|---|\n| NVIDIA | TensorRT | Windows, Linux | 1st (fastest for conv-heavy models) |\n| NVIDIA | CUDA | Windows, Linux | 2nd |\n| AMD | MIGraphX | Linux | 3rd |\n| Intel | OpenVINO (AUTO) | Windows, Linux | 4th (auto-selects NPU/GPU/CPU) |\n| Qualcomm | QNN (HTP) | Windows ARM64, Linux ARM64 | 5th (Snapdragon NPU, FP16) |\n| NVIDIA/AMD/Intel | DirectML | Windows | 6th |\n| Apple Silicon, Intel Mac | CoreML | macOS | 7th (ML Program + subgraph) |\n| (fallback) | CPU | All | Last |\n\nDownload the server variant matching your GPU from the [releases](https://github.com/organization/hifisampler-go/releases) page.\n\n## TensorRT Setup (NVIDIA, experimental)\n\nTensorRT provides **10-30x faster** vocoder inference compared to the default CUDA provider. If you have an NVIDIA GPU, TensorRT is strongly recommended.\n\n### Prerequisites\n- NVIDIA GPU (GTX 10xx or newer)\n- CUDA Toolkit 11.x+ installed\n- TensorRT 10.x runtime (`nvinfer_10.dll` / `libnvinfer.so.10`)\n\n### Installation\n\n**Windows (pip):**\n```bash\npip install tensorrt\n# Copy DLLs next to hifiserver.exe:\ncopy %LOCALAPPDATA%\\Programs\\Python\\Python3*\\Lib\\site-packages\\tensorrt_libs\\nvinfer*.dll .\n```\n\n**Windows (manual):**\nDownload TensorRT from [NVIDIA Developer](https://developer.nvidia.com/tensorrt) and add its `lib/` directory to your PATH.\n\n**Linux:**\n```bash\n# Ubuntu/Debian\nsudo apt install libnvinfer10 libnvinfer-plugin10\n# Or via pip\npip install tensorrt\n```\n\n### How it works\n\n1. **First run**: TensorRT compiles the vocoder ONNX model into an optimized engine. This takes **2-5 minutes** (one-time cost).\n2. **Engine is cached** in `./trt_cache/` — subsequent runs start instantly.\n3. **Inference**: ~3-16ms per note (vs ~110ms with CUDA EP).\n\n### Configuration\n\nIn `config.yaml`:\n\n```yaml\ntensorrt:\n  max_frames: 1024      # Max mel frames. 1024 ≈ 11.9s audio. Increase for longer notes.\n  opt_frames: 80        # Most common note length (frames). TRT optimizes for this.\n  cache_path: \"./trt_cache\"  # Engine cache directory. Delete to force rebuild.\n  builder_opt_level: 5  # 1-5. Higher = slower build, faster inference.\n  workspace_size_mb: 2048  # GPU memory for builder (MB).\n```\n\n**Key settings:**\n- **`max_frames`**: Maximum note length in mel frames. If a note exceeds this, TensorRT falls back to CUDA EP automatically. Default `1024` covers ~12 seconds. Set to `2048` for very long notes.\n- **`opt_frames`**: The note length TRT optimizes most aggressively for. Set to your typical note length (default 80 frames ≈ 0.93s).\n- **`cache_path`**: Delete this directory to force a full engine rebuild (e.g., after changing `max_frames`).\n\n### Troubleshooting\n\n- **\"nvinfer.dll not found\"**: Install TensorRT or add its directory to PATH.\n- **First inference very slow (minutes)**: Normal — TRT is building the engine. Wait for it to complete; subsequent runs use the cache.\n- **OOM during engine build**: Reduce `workspace_size_mb` or `max_frames`.\n- **Note fails with shape error**: The note exceeds `max_frames`. Increase the value in config.yaml and delete `trt_cache/`.\n\n## How to use\n\n### 1. Download\n\nFrom the [releases](https://github.com/organization/hifisampler-go/releases) page, download:\n- **Client**: `hifisampler-\u003cos\u003e-\u003carch\u003e` (HTTP) or `hifisampler-ipc-\u003cos\u003e-\u003carch\u003e` (IPC) for your platform\n- **Server**: `hifiserver-\u003cos\u003e-\u003carch\u003e-\u003cgpu\u003e.zip/.tar.gz` for your platform and GPU\n\n### 2. Download models\n\nModels are auto-downloaded on first run. You can also place them manually:\n\n```\nhifiserver.exe (or hifiserver)\npc_nsf_hifigan_44.1k_hop512_128bin_2025.02/\n  model.onnx\nhnsep/\n  vr/\n    model_fp16.onnx\n    config.yaml\nconfig.default.yaml\n```\n\nOnly ONNX models are supported. If you have PyTorch `.ckpt` models, convert them using:\n```bash\npython scripts/convert_hnsep_to_onnx.py\n```\n\n### 3. Start the server\n\n#### Linux / macOS\n\n```bash\n./start.sh            # Linux/macOS (auto-detects binary)\n./hifiserver          # or run directly\n```\n\n#### Windows\n\nClick `hifiserver-...exe`\n\nThe server listens on HTTP :8572, TCP :8573, and IPC (`/tmp/hifisampler.sock` or `\\\\.\\pipe\\hifisampler`) by default.\n\n### 4. Configure UTAU\n\nSet the UTAU resampler to `hifisampler-ipc` (or `.exe` on Windows).\n\nFor OpenUTAU, you can create a symbolic link:\n```cmd\nmklink \"C:\\[OpenUTAU Path]\\Resamplers\\hifisampler-ipc.exe\" \"C:\\[Project Path]\\hifisampler-ipc.exe\"\n```\n\n## Client Configuration\n\nThe client reads settings from `hifisampler-client.toml` (searched in current directory, then exe directory):\n\n```toml\n# IPC path (Unix socket or Named Pipe)\nipc_path = \"/tmp/hifisampler.sock\"  # Windows: \\\\.\\pipe\\hifisampler\n\n# TCP fallback address\nserver = \"127.0.0.1\"\nport = 8573\n```\n\nIf no config file is found, defaults to IPC with TCP fallback to `127.0.0.1:8573`.\n\n## Server Configuration\n\nOn first run, the server creates `config.yaml` from `config.default.yaml`. Key settings:\n\n```yaml\nmodel:\n  vocoder_path: \"./pc_nsf_hifigan_44.1k_hop512_128bin_2025.02/model.onnx\"\n  hnsep_model_path: \"./hnsep/vr/model_fp16.onnx\"\n\naudio:\n  sample_rate: 44100\n  hop_size: 512\n  n_mels: 128\n\nprocessing:\n  wave_norm: true       # Enable loudness normalization\n  loop_mode: true       # Mel spectrum loop mode\n  peak_limit: 1.0\n\nperformance:\n  max_workers: -1       # -1 = auto-detect (NumCPU/2, clamped 2-8)\n  device: \"auto\"        # \"auto\", \"cuda\", \"tensorrt\", \"migraphx\", \"directml\", \"openvino\", \"coreml\", \"qnn\", \"cpu\"\n  ipc_path: \"/tmp/hifisampler.sock\"  # Unix socket. Windows: \\\\.\\pipe\\hifisampler\n```\n\n## Implemented flags\n\n- **g:** Adjust gender/formants. Range: `-600` to `600` | Default: `0`\n- **Hb:** Adjust breath/noise. Range: `0` to `500` | Default: `100`\n- **Hv:** Adjust voice/harmonic. Range: `0` to `150` | Default: `100`\n- **HG:** Vocal fry/growl. Range: `0` to `100` | Default: `0`\n- **P:** Normalize loudness at the note level, targeting -16 LUFS. Requires `wave_norm: true`. Range: `0` to `100` | Default: `100`\n- **t:** Shift pitch in cents (1 cent = 1/100 semitone). Range: `-1200` to `1200` | Default: `0`\n- **Ht:** Adjust tension. Range: `-100` to `100` | Default: `0`\n- **A:** Amplitude modulation based on pitch vibrato. Range: `-100` to `100` | Default: `0`\n- **G:** Force regenerate feature cache. No value needed.\n- **He:** Enable Mel spectrum loop mode. No value needed.\n\n_Note: Flags `B` and `V` were renamed to `Hb` and `Hv` to avoid conflicts with other UTAU flags._\n\n## Building from source\n\n### Prerequisites\n- Go 1.26+ (server)\n- Rust stable (clients, RustFFT bridge)\n- GCC/MinGW or Clang (server, required for RustFFT CGO bridge)\n\n### Clients (Rust)\n```bash\n# HTTP client\ncd client-rs \u0026\u0026 cargo build --release\n\n# IPC client (Unix socket / Named Pipe + TCP fallback)\ncd client-rs-ipc \u0026\u0026 cargo build --release\n```\n\n### Server (Go, requires CGO for RustFFT)\n```bash\n# Build RustFFT bridge first\ncd internal/dsp/rustfft \u0026\u0026 cargo build --release \u0026\u0026 cd ../../..\n\n# Build server with SIMD support\nGOEXPERIMENT=simd CGO_ENABLED=1 go build -tags rustfft -ldflags=\"-s -w\" -o hifiserver ./cmd/server\n```\n\nThe ONNX Runtime shared library must be available at runtime. Place the `.dll`/`.so`/`.dylib` alongside the server binary or set `ORT_LIB_PATH`.\n\n### All at once\n```bash\nmake build-all\n```\n\n## Migration from Python version\n\n- ONNX models (`.onnx`) work as-is, no conversion needed\n- Feature cache files (`.hifi.npz`) are compatible and will be read by the Go version\n- HN-SEP cache files (PyTorch `.pt` format) will be regenerated on first use\n- PyTorch `.ckpt` model support has been removed; convert to ONNX first\n\n## Acknowledgments\n\n- [yjzxkxdn](https://github.com/yjzxkxdn)\n- [openvpi](https://github.com/openvpi) for pc-nsf-hifigan\n- [MinaminoTenki](https://github.com/Lanhuace-Wan)\n- [Linkzerosss](https://github.com/Linkzerosss)\n- [MUTED64](https://github.com/MUTED64)\n- [mili-tan](https://github.com/mili-tan)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forganization%2Fhifisampler-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forganization%2Fhifisampler-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forganization%2Fhifisampler-go/lists"}