Skip to content

Commit 9618c49

Browse files
committed
init
0 parents  commit 9618c49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2517
-0
lines changed

.gitignore

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
### https://raw.github.com/github/gitignore/f57304e9762876ae4c9b02867ed0cb887316387e/Python.gitignore
2+
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
8+
# C extensions
9+
*.so
10+
11+
# Distribution / packaging
12+
.Python
13+
env/
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
*.egg-info/
27+
.installed.cfg
28+
*.egg
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*,cover
49+
.hypothesis/
50+
51+
# Jupyter Notebook
52+
.ipynb_checkpoints
53+
54+
# pyenv
55+
.python-version
56+
57+
# celery beat schedule file
58+
celerybeat-schedule
59+
60+
# SageMath parsed files
61+
*.sage.py
62+
63+
# dotenv
64+
.env
65+
66+
# virtualenv
67+
.venv
68+
venv/
69+
ENV/
70+
71+
# Spyder project settings
72+
.spyderproject
73+
74+
# Rope project settings
75+
.ropeproject
76+
77+
# mkdocs documentation
78+
/site
79+
80+
/.idea/
81+
82+
/checkpoints/
83+
.DS_Store
84+
85+
XY_dev/
86+
XY_train/
87+
*.npy

README.md

Lines changed: 39 additions & 0 deletions

Trigger word detection - v1.ipynb

Lines changed: 1797 additions & 0 deletions
Large diffs are not rendered by default.

audio_examples/chime.wav

162 KB
Binary file not shown.

audio_examples/example_train.wav

1.68 MB
Binary file not shown.

audio_examples/insert_reference.wav

1.68 MB
Binary file not shown.

audio_examples/my_audio.wav

1.68 MB
Binary file not shown.

audio_examples/train_reference.wav

1.68 MB
Binary file not shown.

chime_output.wav

1.68 MB
Binary file not shown.

images/date_attention.png

131 KB

images/date_attention2.png

130 KB

images/label_diagram.png

81.4 KB

images/model_trigger.png

227 KB

images/music_gen.png

185 KB

images/ones_reference.png

36.7 KB

images/poorly_trained_model.png

10.1 KB

images/sound.png

197 KB

images/spectrogram.png

41.7 KB

images/train_label.png

40.7 KB

images/train_reference.png

342 KB

images/woebot.png

410 KB

insert_test.wav

1.68 MB
Binary file not shown.

models/tr_model.h5

7.33 MB
Binary file not shown.

raw_data/activates/1.wav

124 KB
Binary file not shown.

raw_data/activates/1_act2.wav

63 KB
Binary file not shown.

raw_data/activates/1_act3.wav

300 KB
Binary file not shown.

raw_data/activates/2.wav

157 KB
Binary file not shown.

raw_data/activates/2_act2.wav

62.5 KB
Binary file not shown.

raw_data/activates/3.wav

115 KB
Binary file not shown.

raw_data/activates/3_act2.wav

78.9 KB
Binary file not shown.

raw_data/activates/3_act3.wav

412 KB
Binary file not shown.

raw_data/activates/4_act2.wav

56.4 KB
Binary file not shown.

raw_data/backgrounds/1.wav

1.68 MB
Binary file not shown.

raw_data/backgrounds/2.wav

1.68 MB
Binary file not shown.

raw_data/dev/1.wav

1.68 MB
Binary file not shown.

raw_data/dev/2.wav

1.68 MB
Binary file not shown.

raw_data/negatives/1.wav

62.1 KB
Binary file not shown.

raw_data/negatives/1_0.wav

99.8 KB
Binary file not shown.

raw_data/negatives/2.wav

70.2 KB
Binary file not shown.

raw_data/negatives/2_1.wav

93.2 KB
Binary file not shown.

raw_data/negatives/3.wav

113 KB
Binary file not shown.

raw_data/negatives/3_2.wav

61.7 KB
Binary file not shown.

raw_data/negatives/4.wav

95.1 KB
Binary file not shown.

raw_data/negatives/4_0.wav

230 KB
Binary file not shown.

raw_data/negatives/5.wav

61.2 KB
Binary file not shown.

raw_data/negatives/5_1.wav

103 KB
Binary file not shown.

requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
numpy
2+
keras
3+
h5py
4+
pydub
5+
scipy
6+
matplotlib

td_utils.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import matplotlib.pyplot as plt
2+
from scipy.io import wavfile
3+
import os
4+
from pydub import AudioSegment
5+
6+
# Calculate and plot spectrogram for a wav audio file
7+
def graph_spectrogram(wav_file):
8+
rate, data = get_wav_info(wav_file)
9+
nfft = 200 # Length of each window segment
10+
fs = 8000 # Sampling frequencies
11+
noverlap = 120 # Overlap between windows
12+
nchannels = data.ndim
13+
if nchannels == 1:
14+
pxx, freqs, bins, im = plt.specgram(data, nfft, fs, noverlap = noverlap)
15+
elif nchannels == 2:
16+
pxx, freqs, bins, im = plt.specgram(data[:,0], nfft, fs, noverlap = noverlap)
17+
return pxx
18+
19+
# Load a wav file
20+
def get_wav_info(wav_file):
21+
rate, data = wavfile.read(wav_file)
22+
return rate, data
23+
24+
# Used to standardize volume of audio clip
25+
def match_target_amplitude(sound, target_dBFS):
26+
change_in_dBFS = target_dBFS - sound.dBFS
27+
return sound.apply_gain(change_in_dBFS)
28+
29+
# Load raw audio files for speech synthesis
30+
def load_raw_audio():
31+
activates = []
32+
backgrounds = []
33+
negatives = []
34+
for filename in os.listdir("./raw_data/activates"):
35+
if filename.endswith("wav"):
36+
activate = AudioSegment.from_wav("./raw_data/activates/"+filename)
37+
activates.append(activate)
38+
for filename in os.listdir("./raw_data/backgrounds"):
39+
if filename.endswith("wav"):
40+
background = AudioSegment.from_wav("./raw_data/backgrounds/"+filename)
41+
backgrounds.append(background)
42+
for filename in os.listdir("./raw_data/negatives"):
43+
if filename.endswith("wav"):
44+
negative = AudioSegment.from_wav("./raw_data/negatives/"+filename)
45+
negatives.append(negative)
46+
return activates, negatives, backgrounds

train.wav

1.68 MB
Binary file not shown.

0 commit comments

Comments
 (0)