@@ -0,0 +1,943 @@
+# simple_wire.py%0A# Play microphone input to speaker using callback function%0A#%0A# Adapted from Wire(Callback) example%0A# https://people.csail.mit.edu/hubert/pyaudio/%0A%0Aimport pyaudio%0Aimport time%0A%0ACHANNELS = 1%0ARATE = 16000%0A%0A# Define callback function%0Adef my_callback_fun(input_string, block_size, time_info, status):%0A    return (input_string, pyaudio.paContinue)    # Return data and status%0A%0A# Create audio object%0Ap = pyaudio.PyAudio()%0A%0A# Open audio stream%0Astream = p.open(format = pyaudio.paInt16,   %09# 16 bits/sample%0A                channels = CHANNELS,%0A                rate = RATE,%0A                input = True,%0A                output = True,%0A                stream_callback = my_callback_fun)%0A%0Astream.start_stream()%0A%0Aprint 'Audio stream is on?', stream.is_active()%0A%0Aprint 'The wire will be on for 6 seconds'%0Atime.sleep(6)%0A%0A# Close audio stream%0Astream.stop_stream()%0A%0Aprint 'Audio stream is on?', stream.is_active()%0A%0Astream.close()%0Ap.terminate()%0A

Create Callback_example.py