Python SDK for Windows

Joe Todd
Chirp
Published in
2 min readOct 30, 2018

In the latest release of the Chirp Python SDK [v3.4.2], we are proud to announce that it now comes with full support for Windows!

The Python SDK is one of the easiest ways to start experimenting with Chirp, with added command line tools that enable you to send and receive data over sound within minutes.

Installing the SDK is as simple as

pip install chirpsdk

Actually not quite — the SDK relies on having PortAudio installed. You could install this from source, but the preferred method is to install the precompiled sounddevice package from the awesome library maintained by Christoph Gohlke.

Download the appropriate sounddevice binary for your version of Python and Windows from here.

Now you should be able to start sending and receiving data over sound.

from chirpsdk import ChirpConnect, CallbackSetclass Callbacks(CallbackSet):
def on_received(self, payload, channel):
print(str(list(payload)))
sdk = ChirpConnect(app_key, app_secret)
sdk.set_callbacks(Callbacks())
sdk.start()
payload = sdk.new_payload([0, 1, 2, 3])
sdk.send(payload)

One thing to note is that Windows tends to have many different variants of audio drivers, so you may find that you have to set the input/output audio device like so.

sdk.audio.query_devices()sdk.audio.input_device = 2 
sdk.audio.output_device = 4

If you would like to get set up with Chirp on the command line, you will need to instruct Python to open the scripts with python.exe. There are a couple of ways to achieve this.

  1. Set the PATHEXT environment variable to include .py files. You can open cmd.exe as an administrator and run
setx PATHEXT %PATHEXT%;.PY

2. Alternatively, when you are prompted with the ‘How do you want to open this file’ popup, you can just select python.exe. On my machine this was located at

C:\Users\Chirp\AppData\Local\Programs\Python\Python37

For further documentation on the Python SDK and running Chirp on the command line, head over to developers.chirp.io.

joe@chirp.io

--

--