Chirp – data over sound

Chirp – sdk for direct inter-device communication via sound


We’ve all experienced headaches trying to get smart devices speaking to each other:

  • connecting a new smart device onto your Wi-Fi network with the cumbersome “hotspot dance”
  • trying and failing to pair two Bluetooth devices
  • wrestling with connectivity to meeting room displays

As we interact more and more with devices such as smart speakers, smart appliances, and network-enabled Industrial IoT machines, we need a way to instantaneously interact without prior pairing or password exchange.

What is Chirp

Chirp enables your apps to send and receive information using sound. A “chirp” encodes an array of bytes as an audio signal, which can be transmitted by any device with a speaker and received by any device with a microphone and Chirp SDK. It is designed to be robust over distances of several meters, and in noisy, everyday environments.
As the transmission takes place entirely via audio signals, no internet connection or prior pairing is required, and any device within hearing range can receive the data.

Comparison of data transfer implementations

Use Case

There are situations when data over sound is more viable than the standard solution over radio waves. Chirp is used for monitoring some of the devices inside one of UK’s nuclear power plants where electro magnetic signals could interfere and are as such prohibited. 
It can be used as replacement for NFC and Bluetooth technology, a company in India uses sound data as a protocol for bus ticket validation.
From a security perspective it can be used as authentication mechanism to login to websites or even physical devices, arguing that they are less likely hacked since physical presence of listening device or person is needed for sniffing data

How to start

Just pop off to, sign in and you are ready to go, they have introductory examples with accompanying SDK iOS, Android, C, Arduino, JavaScript, Python, macOS, Windows, and WebAssembly

Example app

In this example we made two scenarios:

1) sender selects a color and receiver based on a selected color changes his background
2)  sender types down url and sends it, receiver gets the url and opens a link externally

Sample code

Per developers website suggestions, we created singleton class that handles configuring, sending and listening to incoming sound data. First and third view controller class is responsible for sending data, while second and fourth receiving and responding to data.

protocol ChirpProtocol {
    func setColor(_ color:String)
    func openUrl(_ url:String)
    func errorHandling(_ error:String)

extension ChirpProtocol{
    func setColor(_ color:String){
    func openUrl(_ url:String){
    func errorHandling(_ error:String){

class ChirpManager{
    var chirp: ChirpSDK?
    var delegate: ChirpProtocol?
    init() {
        chirp = ChirpSDK(appKey: ChirpConstants.CHIRP_APP_KEY, andSecret: ChirpConstants.CHIRP_APP_SECRET)!
        if chirp!.setConfig(ChirpConstants.CHIRP_APP_CONFIG) != nil {
            chirp = nil
        } else {
            if chirp!.start() != nil {
                chirp = nil
        chirp!.receivedBlock = {
            (data : Data?, channel: UInt?) -> () in
            if data != nil {
                let identifier = String(data: data!, encoding: .ascii)
                print("Received \(identifier!)")
                if self.verifyUrl(urlString: identifier!){
            } else {
                print("ChirpError: Decode failed!")
    func send(_ string:String) -> Void {
        let payload: Data = .utf8)!
        if let err = chirp!.send(payload) {
            print("ChirpError (%@)", err.localizedDescription)
        } else {
            print("Sent (identifier)")
    func verifyUrl (urlString: String?) -> Bool {
        //Check for nil
        if let urlString = urlString {
            // create NSURL instance
            if let url = NSURL(string: urlString) {
                // check if your application can open the NSURL instance
                return UIApplication.shared.canOpenURL(url as URL)
        return false

Also, as mentioned on developers site in Best practices, keep in mind that you need to handle app going in background and coming forward again, to restart singleton and his listeners

How to build

If you already signed up on go to Applications and get your three part credentials Key, Secret,Config.
You can play with different configurations, observe how different sound patterns can transmit different sizes of data.
Go to git repo, clone, in ChirpConstants replace existing credentials with yours, build and you are ready to start chirping