Exemple #1
0
def test_local_app_in_out():
    # connect Node.output to Node.input
    # so copy inaudio buffer to out audio buffer

    app = pg.mkQApp()

    dev = PyAudio()
    dev.configure(nb_channel=2,
                  sample_rate=44100.,
                  input_device_index=0,
                  output_device_index=0,
                  format='int16',
                  chunksize=1024)
    dev.output.configure(protocol='tcp',
                         interface='127.0.0.1',
                         transfermode='plaindata')
    dev.input.connect(dev.output)
    dev.initialize()
    dev.start()

    def terminate():
        dev.stop()
        dev.close()
        app.quit()

    # start for a while
    timer = QtCore.QTimer(singleShot=True, interval=3000)
    timer.timeout.connect(terminate)
    timer.start()
    app.exec_()
Exemple #2
0
def test_local_app_in_out():
    # connect Node.output to Node.input
    # so copy inaudio buffer to out audio buffer
    
    app = pg.mkQApp()
    
    dev = PyAudio()
    dev.configure(nb_channel=2, sample_rate=44100.,
                    input_device_index=0, output_device_index=0,
                    format='int16', chunksize=1024)
    dev.output.configure(protocol='tcp', interface='127.0.0.1', transfertmode='plaindata')
    dev.input.connect(dev.output)
    dev.initialize()
    dev.start()
    
    def terminate():
        dev.stop()
        dev.close()
        app.quit()
    
    # start for a while
    timer = QtCore.QTimer(singleShot=True, interval=3000)
    timer.timeout.connect(terminate)
    timer.start()
    app.exec_()
# Create PyAudio device node
dev = PyAudio()

# Print a list of available input devices (but ultimately we will just use the
# default device).
default_input = dev.default_input_device()
print("\nAvaliable devices:")
for device in dev.list_device_specs():
    index = device['index']
    star = "*" if index == default_input else " "
    print("  %s %d: %s" % (star, index, device['name']))

# Configure PyAudio device with a single (default) input channel.
dev.configure(nb_channel=1,
              sample_rate=44100.,
              input_device_index=default_input,
              format='int16',
              chunksize=1024)
dev.output.configure(protocol='tcp',
                     interface='127.0.0.1',
                     transfertmode='plaindata')
dev.initialize()

# Create a triggered oscilloscope to display data.
viewer = QTriggeredOscilloscope()
viewer.configure(with_user_dialog=True)

# Connect audio stream to oscilloscope
viewer.input.connect(dev.output)

viewer.initialize()
Exemple #4
0

# Create PyAudio device node
dev = PyAudio()

# Print a list of available input devices (but ultimately we will just use the 
# default device).
default_input = dev.default_input_device()
print("\nAvaliable devices:")
for device in dev.list_device_specs():
    index = device['index']
    star = "*" if index == default_input else " "
    print("  %s %d: %s" % (star, index, device['name']))

# Configure PyAudio device with a single (default) input channel.
dev.configure(nb_channel=1, sampling_rate=44100., input_device_index=default_input,
              format='int16', chunksize=1024)
dev.output.configure(protocol='tcp', interface='127.0.0.1', transfertmode='plaindata')
dev.initialize()


# Create an oscilloscope to display data.
viewer = QOscilloscope()
viewer.configure(with_user_dialog = True)

# Connect audio stream to oscilloscope
viewer.input.connect(dev.output)

viewer.initialize()
viewer.show()
viewer.params['decimation_method'] = 'min_max'
viewer.by_channel_params['Signal0', 'gain'] = 0.001