-
Notifications
You must be signed in to change notification settings - Fork 0
/
piper_install_mac.sh
76 lines (54 loc) · 2.49 KB
/
piper_install_mac.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Function to check if command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Install Homebrew if not installed
if ! command_exists brew; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# Create piper root folder if it doesn't exist
PIPER_ROOT_FOLDER=~/Documents/piper
mkdir -p "$PIPER_ROOT_FOLDER"
# Install espeak-ng using Homebrew
/opt/homebrew/bin/brew install espeak-ng
# Change directory to Piper root folder
cd "$PIPER_ROOT_FOLDER" || exit
# Clone Piper repository
git clone https://github.com/rhasspy/piper.git
# Change directory to piper
cd piper || exit
# Compile Piper
make
# Change directory back to Piper root folder
cd "$PIPER_ROOT_FOLDER" || exit
# Clone piper-phonemize repository
git clone https://github.com/rhasspy/piper-phonemize.git piper-phonemize
# Change directory to piper-phonemize
cd piper-phonemize || exit
# Compile piper-phonemize
make
# Change directory back to Piper root folder
cd "$PIPER_ROOT_FOLDER" || exit
mkdir -p "$PIPER_ROOT_FOLDER"/models
mkdir -p "$PIPER_ROOT_FOLDER"/models/librits
curl -L -o "$PIPER_ROOT_FOLDER"/models/librits/en_US-libritts-high.onnx https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/libritts/high/en_US-libritts-high.onnx
curl -L -o "$PIPER_ROOT_FOLDER"/models/librits/en_US-libritts-high.onnx.json https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/libritts/high/en_US-libritts-high.onnx.json
# Check if export statements already exist in .zprofile
if ! grep -qxF 'export PATH="/opt/homebrew/bin:${PATH}"' ~/.zprofile; then
echo 'export PATH="/opt/homebrew/bin:${PATH}"' >> ~/.zprofile
fi
if ! grep -qxF 'export DYLD_LIBRARY_PATH=/opt/homebrew/Cellar/espeak-ng/1.51/lib/:$DYLD_LIBRARY_PATH' ~/.zprofile; then
echo 'export DYLD_LIBRARY_PATH=/opt/homebrew/Cellar/espeak-ng/1.51/lib/:$DYLD_LIBRARY_PATH' >> ~/.zprofile
fi
if ! grep -qxF "export DYLD_LIBRARY_PATH=$PIPER_ROOT_FOLDER/piper-phonemize/install/lib:\$DYLD_LIBRARY_PATH" ~/.zprofile; then
echo "export DYLD_LIBRARY_PATH=$PIPER_ROOT_FOLDER/piper-phonemize/install/lib:\$DYLD_LIBRARY_PATH" >> ~/.zprofile
fi
# Confirm installation and setup
echo "Piper installation and setup completed successfully!"
# Source the updated .zprofile
source ~/.zprofile || exit
# Example usage
echo 'Welcome to the world of speech synthesis!' | "$PIPER_ROOT_FOLDER/piper/install/piper" \
--model "$PIPER_ROOT_FOLDER/models/librits/en_US-libritts-high.onnx" \
--output-file welcome.wav