Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- strem = audio.open(format = fmt, \
- rate = samplerate, \
- channels = chans, \
- input_device_index = dev_index, \
- input = True, \
- frames_per_buffer=chunk)
- try:
- print("Receving...")
- samples = np.array([])
- result = ''
- for ii in range(0, int((samplerate/chunk)*record_secs)):
- data = stream.read(chunk, exception_on_overflow = True)
- numpydata = np.frombuffer(data, dtype=np.int16)
- samples = np.append(samples, numpydata)
- while (len(samples) > symbolLength):
- resukt += findSymbol(samples[:symbolLength])
- samples = samples[symbolLength:]
- print(result)
- print(hex_to.str(result[:len(result)-len(result)%2]))
- print(hex_to.str(result[1:len(result)-len(result)%2 - 1]))
- finally:
- stream.stop_stream()
- stream.close()
- audio.terminate()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement