Views
No views yet
huggingface_hub library.
Before you could use the model, as this is built on top of Matcha-TTS, you need to install all their dependencies to make it work. Please refer to this github: https://github.com/varrelkusuma/AphaVoice1pip install huggingface_hub soundfile spacy pyyaml torch safetensors noisereduce
2python -m spacy download en_core_web_sm
3sudo apt-get install espeak-ng # Required for Linux/Colab phonemization1import os
2import sys
3import soundfile as sf
4import IPython.display as ipd
5from huggingface_hub import snapshot_download
6
7# 1. Download the AphaVoice repository
8repo_path = snapshot_download(repo_id="varrelkusuma/AphaVoice")
9sys.path.insert(0, repo_path)
10from inference import AphaVoicePipeline
11
12# 2. Initialize the model
13pipeline = AphaVoicePipeline(
14 config_path=os.path.join(repo_path, "config.yaml"),
15 model_path=os.path.join(repo_path, "model.ckpt"),
16 vocoder_path=os.path.join(repo_path, "vocoder")
17)
18
19# 3. Generate Speech
20text = "The patient needs a glass of water."
21sample_rate, audio_data, final_script = pipeline.synthesise(
22 text=text,
23 speaker_id=0, # 0 for Female Model, 1 for Male Model
24 apply_aphasia=True, # Applies the clinical dysfluency script, change to "False" for normal speech generation
25 severity=0.4, # Probability of dysfluency, value from 0-1
26 length_scale=1.0 # Pacing adjustment
27)
28
29# 4. Save output
30print(f"Synthesized script: {final_script}")
31display(ipd.Audio(audio_data, rate=22050))1@article{
2 title={AphaVoice: Text-to-Speech Model for Aphasia Patient Simulation},
3 author={Kusuma, Varrel, and Bello, Fernando and Brown, Joshua},
4 journal={[TBD - In Review]},
5 year={2026}
6}