- Notifications
You must be signed in to change notification settings - Fork51
iOS framework for the Quiet Modem (data over sound)
License
quiet/QuietModemKit
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is the iOS framework forhttps://github.com/quiet/quiet
With this library, you can send data through sound.
Live demo:https://quiet.github.io/quiet-js/
Other platforms:
- #"https://github.com/quiet/quiet-js">https://github.com/quiet/quiet-js
If you are old enough, you may remember using dial-up modems to connect to the internet. In a sense, this package brings that back. While it's true that this is somewhat of a retro approach, consider the advantages of using sound.
Highly cross-platform. Any device with speakers and a microphone and sufficient computational power can use this medium to communicate.
No pairing. Unlike Bluetooth, sound can be used instantly without the need to pair devices. This reduces the friction and improves the user experience.
Embeddable content. Similar to a QR code, short packets of data can be encoded into streaming or recorded audio and can then be later decoded by this package.
The answer to this depends on which operating mode you choose. Quiet provides audible and near-ultrasonic modes. Audible modes sound something like a puff of air. The near-ultrasonic modes run at 17+kHz and are virtually inaudible to adults. Either mode can operate at relatively low volumes as long as there isn't too much background noise.
Quiet's provided audible mode transfers at approximately 7kbps. In cases where two devices are connected over a cable (via 3.5mm jack) it can run in cable mode, which transfers at approximately 64kbps.
CMake is required to build QuietModemKit. If you aren't sure if you have CMake installed, runbrew install cmake
.
It is recommended that you use Carthage to build QuietModemKit. Simply runbrew install cmake
and then addgithub "Quiet/QuietModemKit"
to your Cartfile and runcarthage update
.
Transmitter:
#import<QuietModemKit/QuietModemKit.h>intmain(int argc,char * argv[]) { QMTransmitterConfig *txConf = [[QMTransmitterConfigalloc]initWithKey:@"ultrasonic-experimental"]; QMFrameTransmitter *tx = [[QMFrameTransmitteralloc]initWithConfig:txConf];NSString *frame_str =@"Hello, World!";NSData *frame = [frame_strdataUsingEncoding:NSUTF8StringEncoding]; [txsend:frame];CFRunLoopRun(); [txclose];return0;}
Receiver:
#import<QuietModemKit/QuietModemKit.h>static QMFrameReceiver *rx;void (^recv_callback)(NSData*) = ^(NSData *frame){printf("%s\n", [framebytes]);};void (^request_callback)(BOOL) = ^(BOOL granted){ QMReceiverConfig *rxConf = [[QMReceiverConfigalloc]initWithKey:@"ultrasonic-experimental"]; rx = [[QMFrameReceiveralloc]initWithConfig:rxConf]; [rxsetReceiveCallback:recv_callback];};intmain(int argc,char * argv[]) { [[AVAudioSessionsharedInstance]requestRecordPermission:request_callback];CFRunLoopRun();if (rx !=nil) { [rxclose]; }return0;}
Note that we ask for the Record permission. This is required to use the receiver.
The modem can be used audibly or via ultrasonic sound.QMTransmitterConfig
andQMReceiverConfig
are used to select modem configuration. For a full list of valid keys, refer to the top-level keys ofquiet-profiles.json.
3-Claused BSD, plus third-party licenses (mix of MIT and BSD, see licenses/)
About
iOS framework for the Quiet Modem (data over sound)