Views
No views yet
1import torch
2import soundfile as sf
3from helix_model import HelixModel
4
5# Load model
6model = HelixModel.from_pretrained("your-username/helix-v0.7")
7
8# Load mono audio
9audio, sr = sf.read("your_audio.wav")
10
11# Spatialize
12foa_output = model.spatialize(
13 audio,
14 direction="left",
15 elevation="level",
16 distance="mid"
17)
18
19# Save FOA output (4 channels)
20sf.write("output_foa.wav", foa_output.T, 24000)front, front-left, left, back-left, back, back-right, right, front-rightdown (-30°), level (0°), up (+30°)near (1m), mid (2.5m), far (5m)1# Batch processing
2foa_outputs = model.spatialize_batch(
3 audio_list,
4 positions=[
5 ("front", "level", "near"),
6 ("left", "up", "far"),
7 ("back", "down", "mid")
8 ]
9)
10
11# Custom positions (azimuth, elevation in degrees)
12foa = model.spatialize_custom(
13 audio,
14 azimuth=45.0,
15 elevation=15.0,
16 distance=2.0
17)1# Decode to binaural for headphones
2from helix_utils import foa_to_binaural
3
4binaural = foa_to_binaural(foa_output)
5sf.write("binaural.wav", binaural.T, 24000)
6
7# Or use in spatial audio tools:
8# - Reaper (with ambisonic plugins)
9# - Pro Tools (with Dolby Atmos)
10# - Unity/Unreal (native FOA support)| Source | License | Samples | Type |
|---|---|---|---|
| FMA | CC BY 4.0 | 2,000 | Music |
| Common Voice | CC0 | 490 | Speech |
| pyroomacoustics | MIT | Generated | RIRs |
1@misc{helix2024,
2 title={Helix: Text-Guided Mono to Spatial Audio},
3 author={Your Name},
4 year={2024},
5 publisher={Hugging Face},
6 howpublished={\url{https://huggingface.co/your-username/helix-v0.7}}
7}