-
Notifications
You must be signed in to change notification settings - Fork 4
/
bottpad.sh
executable file
·84 lines (58 loc) · 2 KB
/
bottpad.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
77
78
79
80
81
82
83
84
#!/bin/sh
# build sample
# #seed with random initial char
echo "==== generating text"
seeds=(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
seed=${seeds[$RANDOM % ${#seeds[@]} ]}
temperature=$(python -c "import random; print random.random()")
echo "using temperature" $temperature
cd char-rnn
th sample.lua build_epoch.t7 \
-gpuid -1 -primetext $seed -seed $RANDOM \
-temperature $temperature -verbose 0 > ../sample.txt
echo "==== fetching google tts"
cd ../vidmaker
./audmaker.py ../sample.txt tts.mp3
echo "==== reencoding google tts for sox"
ffmpeg -y -loglevel panic -i tts.mp3 tts.wav
echo "==== warping audio"
bassgain=$(python -c "import random; print random.randint(0, 70)")
warpgain=$(python -c "import random; print random.randint(-300, 60)")
speedtweak=$(python -c "import random; print random.randrange(0.5, 1.2)")
echo $bassgain $warpgain $speedtweak
sox -v 10 tts.wav tts_gain.wav bass "+$bassgain"
sox -v 0.005 tts.wav tts_gain_warped.wav gain "+$warpgain"
sox -m tts.wav tts_gain.wav tts_gain_warped.wav \
tts_merged.wav
sox tts_merged.wav tts_echo.wav \
reverse reverb 30 reverse \
speed $speedtweak \
echo "get +/-"
plus=$(python -c "import random; print random.randint(0,500)")
minus=$(python -c "import random; print random.randint(-300,0)")
sox tts_echo.wav tts_echo_high.wav pitch $plus
sox tts_echo.wav tts_echo_low.wav pitch $minus
echo "==== merging warped streams"
sox -m tts_echo_high.wav \
tts_echo_low.wav \
tts_echo.wav tts_final.wav pad 0 2
ffmpeg -loglevel panic -y -i tts_final.wav -ar 16000 -ab 32k tts_final.mp3
echo "==== generating video"
./vidmaker.py ../sample.txt tts_final.mp3 ../render.mkv
echo "==== cleaning up"
cd ..
title=$(cat sample.txt.title)
body=$(cat sample.txt.body)
echo $title
echo $body
youtube-upload \
--title="$title :: $temperature" \
--description="$body" \
--category="Education" "render.mkv"
while [[ $? -ne 0 ]]
do
youtube-upload \
--title="$title :: $temperature" \
--description="$bodyesc" \
--category="Education" "render.mkv"
done