MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / real_signal

Function real_signal

hmm_class/hmmc_concat.py:212–228  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

210
211
212def real_signal():
213 spf = wave.open('helloworld.wav', 'r')
214
215 #Extract Raw Audio from Wav File
216 # If you right-click on the file and go to "Get Info", you can see:
217 # sampling rate = 16000 Hz
218 # bits per sample = 16
219 # The first is quantization in time
220 # The second is quantization in amplitude
221 # We also do this for images!
222 # 2^16 = 65536 is how many different sound levels we have
223 signal = spf.readframes(-1)
224 signal = np.fromstring(signal, 'Int16')
225 T = len(signal)
226
227 hmm = HMM(10)
228 hmm.fit(signal.reshape(1, T))
229
230
231def fake_signal(init=simple_init):

Callers

nothing calls this directly

Calls 2

fitMethod · 0.95
HMMClass · 0.70

Tested by

no test coverage detected