Jump to content

Wolfgang_Raspi

Members
  • Posts

    1
  • Joined

  • Last visited

Wolfgang_Raspi's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. Hi, I'm new to MCC hardware and also programming so sorry if this is either a noob question or has already been solved: I want to read continuosly data from a accelerometer with a MCC172 and output this data simultaneously and as fast as possible via a USB-audio device. I used the "continuous_scan.py" file as a starting point but I'm getting "Buffer overruns" after a short period of time. My code looks basically something like this: p = pyaudio.PyAudio() stream = p.open(format=pyaudio.paFloat32, channels=1, rate=8192, output=True) while True: read_result = hat.a_in_scan_read_numpy(read_request_size, timeout) # Check for an overrun error if read_result.hardware_overrun: print('\n\nHardware overrun\n') break elif read_result.buffer_overrun: print('\n\nBuffer overrun\n') stream.stop_stream() stream.close() p.terminate() print('\n\nStopping Audio Output...\n') break data=read_result.data output_bytes = (0.5 * data).tobytes() stream.write(output_bytes) I hope someone can help me with this, thanks!
×
×
  • Create New...