{"_id":"576d42354bcd290e00428962","category":{"_id":"576d42354bcd290e00428945","__v":0,"version":"576d42354bcd290e00428941","project":"56a526d4e7a1622b0024fae4","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-02-15T12:30:41.336Z","from_sync":false,"order":2,"slug":"components","title":"Concepts"},"parentDoc":null,"user":"56703859e10ecb0d0004eebb","__v":6,"version":{"_id":"576d42354bcd290e00428941","project":"56a526d4e7a1622b0024fae4","__v":1,"createdAt":"2016-06-24T14:22:45.076Z","releaseDate":"2016-06-24T14:22:45.076Z","categories":["576d42354bcd290e00428942","576d42354bcd290e00428943","576d42354bcd290e00428944","576d42354bcd290e00428945","576d42354bcd290e00428946","576d42354bcd290e00428947"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"project":"56a526d4e7a1622b0024fae4","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-15T12:27:53.387Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"A chirp encodes an array of numerical data, \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The identifier\"\n}\n[/block]\nEach chirp is uniquely identified by an alphanumeric string known as its *identifier* -- for example, \"e6hn81aan7\". In our standard product, this comprises of 10 characters drawn from our 32-character alphabet. Every valid chirp object has an identifier, and the characters of this code are mapped to audio frequencies to generate the Chirp tone.\n\nThe standard alphabet is the character class `[0-9a-v]`.\n\n    0123456789abcdefghijklmnopqrstuv\n\nThis gives 5 bits of data per character, making 50 bits of data in total.\n\nEach of the Chirp SDKs include convenience methods for the creation and validation of identifiers.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[ChirpSDK randomShortcode]; // n3a67aai1o\\n\\n[ChirpSDK isValidShortcode::::at:::\\\"n3a67aai1o\\\"]; \\t// YES\\n\\n[ChirpSDK isValidShortcode:@\\\"n3a67\\\"]; \\t\\t\\t// NO\\n[ChirpSDK isValidShortcode:@\\\"n3a67xxxxx\\\"]; \\t// NO\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The encoded identifier\"\n}\n[/block]\nTo prepare a chirp from being broadcast as audio, error correction symbols are appended to the identifier to create the *encoded identifier*. This helps make the transmission resilient to noise, by correcting parts of the received code that are misheard or missed altogether. \n\nFor an example identifier of `n3a67aai1o`, the resultant encoded identifier would be `n3a67aai1o1miprkd8`.\n\nThere are several ways of adding encoding to a given identifier.\n\n* by using the [/chirps/encode/:identifier](https://dash.readme.io/project/chirp/v1/docs/api-encode) API call\n* by creating a `Chirp` object based on the identifier within the iOS SDK, and examining the `encodedIdentifier` property of the resultant object\n* by calling the `chirpsdk.encode()` function of the Chirp Python SDK (currently only available to beta users)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Sending larger payloads\"\n}\n[/block]\nFor many applications, you will want to send more than 50 bits of data via Chirp. There are two ways to do this.\n\nIf the data must be entirely embedded within the audio stream, we can work with you to devise a custom audio protocol that is capable of carrying larger payloads. [Contact us](doc:contact) to discuss this further. \n\nIf an internet connection is available, or your payload is very large, an alternative approach is to use the Chirp API to attach associated data to the chirp.\n\n## Associated data\n\nWith the Chirp network API, a chirp may have additional information associated with it by using the identifier to point to a larger structured data object. This process is handled seamlessly by the Chirp SDKs, so that the creation, association and querying of this additional data is invisible to the developer - simply pass the data object to the SDK.\n\nThis will then:\n\n * pass the structured data object to the Chirp API, as `json`\n * extract the returned `identifier` that uniquely identifies the data\n * chirp the identifier over the device's speaker (or store it for later use)\n\nFor more information, see the [Chirp API Overview](doc:chirp-api-overview).","excerpt":"","slug":"chirps-shortcodes","type":"basic","title":"Anatomy of a Chirp"}

Anatomy of a Chirp


A chirp encodes an array of numerical data, [block:api-header] { "type": "basic", "title": "The identifier" } [/block] Each chirp is uniquely identified by an alphanumeric string known as its *identifier* -- for example, "e6hn81aan7". In our standard product, this comprises of 10 characters drawn from our 32-character alphabet. Every valid chirp object has an identifier, and the characters of this code are mapped to audio frequencies to generate the Chirp tone. The standard alphabet is the character class `[0-9a-v]`. 0123456789abcdefghijklmnopqrstuv This gives 5 bits of data per character, making 50 bits of data in total. Each of the Chirp SDKs include convenience methods for the creation and validation of identifiers. [block:code] { "codes": [ { "code": "[ChirpSDK randomShortcode]; // n3a67aai1o\n\n[ChirpSDK isValidShortcode:@\"n3a67aai1o\"]; \t// YES\n\n[ChirpSDK isValidShortcode:@\"n3a67\"]; \t\t\t// NO\n[ChirpSDK isValidShortcode:@\"n3a67xxxxx\"]; \t// NO", "language": "objectivec" } ] } [/block] [block:api-header] { "type": "basic", "title": "The encoded identifier" } [/block] To prepare a chirp from being broadcast as audio, error correction symbols are appended to the identifier to create the *encoded identifier*. This helps make the transmission resilient to noise, by correcting parts of the received code that are misheard or missed altogether. For an example identifier of `n3a67aai1o`, the resultant encoded identifier would be `n3a67aai1o1miprkd8`. There are several ways of adding encoding to a given identifier. * by using the [/chirps/encode/:identifier](https://dash.readme.io/project/chirp/v1/docs/api-encode) API call * by creating a `Chirp` object based on the identifier within the iOS SDK, and examining the `encodedIdentifier` property of the resultant object * by calling the `chirpsdk.encode()` function of the Chirp Python SDK (currently only available to beta users) [block:api-header] { "type": "basic", "title": "Sending larger payloads" } [/block] For many applications, you will want to send more than 50 bits of data via Chirp. There are two ways to do this. If the data must be entirely embedded within the audio stream, we can work with you to devise a custom audio protocol that is capable of carrying larger payloads. [Contact us](doc:contact) to discuss this further. If an internet connection is available, or your payload is very large, an alternative approach is to use the Chirp API to attach associated data to the chirp. ## Associated data With the Chirp network API, a chirp may have additional information associated with it by using the identifier to point to a larger structured data object. This process is handled seamlessly by the Chirp SDKs, so that the creation, association and querying of this additional data is invisible to the developer - simply pass the data object to the SDK. This will then: * pass the structured data object to the Chirp API, as `json` * extract the returned `identifier` that uniquely identifies the data * chirp the identifier over the device's speaker (or store it for later use) For more information, see the [Chirp API Overview](doc:chirp-api-overview).