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

Function real_signal

hmm_class/hmmc.py:240–256  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

238
239
240def real_signal():
241 spf = wave.open('helloworld.wav', 'r')
242
243 #Extract Raw Audio from Wav File
244 # If you right-click on the file and go to "Get Info", you can see:
245 # sampling rate = 16000 Hz
246 # bits per sample = 16
247 # The first is quantization in time
248 # The second is quantization in amplitude
249 # We also do this for images!
250 # 2^16 = 65536 is how many different sound levels we have
251 signal = spf.readframes(-1)
252 signal = np.fromstring(signal, 'Int16')
253 T = len(signal)
254
255 hmm = HMM(10)
256 hmm.fit(signal.reshape(1, T))
257
258
259def fake_signal(init=simple_init):

Callers

nothing calls this directly

Calls 2

fitMethod · 0.95
HMMClass · 0.70

Tested by

no test coverage detected