Giter Site home page Giter Site logo

quiet / quiet-js Goto Github PK

View Code? Open in Web Editor NEW
2.2K 2.2K 148.0 4.59 MB

Transmit data with sound using Web Audio -- Javascript binding for libquiet

License: BSD 3-Clause "New" or "Revised" License

JavaScript 100.00%
data-transfer emscripten modem ultrasonic webaudio

quiet-js's Introduction

Quiet Modem Project logo

Build Status

Documentation

This library uses liquid SDR to transmit data through sound. This makes it suitable for sending data across a 3.5mm headphone jack or via speaker and mic. Quiet can build standalone binaries for encoding/decoding data via .wav files or for streaming through your soundcard via PortAudio. It can also be built as a library to be consumed by other C programs.

Build

With the dependencies installed, run ./bootstrap provided by this library, which will create a build directory and invoke cmake. If you would like to install it after building, do cd build && make install.

Profiles

The encoding and decoding processes are controlled by the profiles in quiet-profiles.json. Each profile contains a complete set of parameters such as modem type and error correction.

Cable

For cable transmission, use the cable- profiles. These will attempt to use nearly the full spectrum provided by your soundcard. As such, they contain many audible frequencies and should not be used on channels that could be heard by people.

Ultrasonic

The ultrasonic- profiles encode data through a very low bitrate, but the audio content lies above 16kHz, which should pass through audio equipment relatively well while being inaudible to the average person. This is a good option for sending data through a channel where you would prefer not to disrupt human listeners.

Dependencies

Acknowledgements

I'd like to thank the people who provided feedback and helped me with pull requests and advice on software

  • Joseph Gaeddert, for his excellent SDR library, encouragement, and feedback on all things DSP
  • Alon Zakai and @juj for advising me on emscripten and for taking my PRs
  • Jan-Ivar Bruaroey and Maire Reavy for helping me patch the echo cancellation behavior of Firefox's getUserMedia
  • Josh Gao for advising me on API design and C idioms.
  • Ryan Hitchman for extensive testing on Android Chrome
  • Fabrice Bellard for thoughtfully answering a stranger's question out of the blue about digital communications

quiet-js's People

Contributors

brian-armstrong avatar iameli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quiet-js's Issues

Instructions to use locally

I think it would be great to add instructions in the README on how to use quiet-js locally. It seems to me there are two ways:

I have tested the latter and it works very well.

Also the readme (or the live demo) could maybe be more explicit about the fact that ultrasound is way more reliable than sound transfer, and also that the volume should be quite low. At first, I thought it did not work because:

1- my computer had automatic noise filtering from microphone that I had to disable
2- Then, quiet-js (gh-pages branch) started to pick up the sound as evidenced by "1/1 packet lost" message, but all packets were lost,
3- Then I tried to lower down the sound to 20-50%, and the ultrasound send worked flawlessly from there on (even with music or other noises in the background!), whereas the sound transfer still did not work.

I know it's not your fault as the dev of this package that there are these roadblocks that may prevent users from effectively testing the app, but I think a few notes in the readme could save a lot of time (both for the users and for you since you'll get less questions about these issues!).

Thanks a lot for making this software, it works awesomely well!

AudioConstraints not well defined on chrome android

Hi,
I had some troubles transmitting data from my browser to my android phone, and it turned out it was a permission problem. The phone audio pre-processing wasn't turned-off which resulted in an effective cutoff frequency around 7500hz. Transmitting at 12000hz, it ruined my transmission!
My fix was to implement the adapter.js, and use only echoCancellation as constraints.
It now works!
My code is not very clean, I'll make it better then make a pull request! In the meantime, I wanted to keep anybody who runs into the problem up to date!
Incredible work by the way

Online demo not working.

Hello there,

I tried the online example here from two computers, mine and the one of my girlfriend. Both are on Windows 10. I used Chrome for the test. Both speakers and microphone were ON. No error on the console, but it was impossible to receive any data either from mine or her.

When I send with audible mode, I can hear something, not with ultrasounds, so hard to check if it works.

Did someone had a problem to make it work or do you know if there is an issue at the moment ?

All the best.

npm

This package should make its way onto npm. In order to get there, I'd like to do a bit of cleanup and make a proper exports.

Data rate and Encryption

Great library. A couple of questions:

What is the data transmission rate in quiet mode (bits/s)?

Also what would be a suitable encryption scheme to use without impacting the data rate?

Fully investigate GC issues

It seems that right now Firefox GC is likely collecting the receiver some short time after it is created. This is a regression. I'd like to fully solve these sorts of issues once and for all.

Demo text receiver doesn't work

image

I'm using edge 92.0.902.73.

And also not working on my iPhone, not muted, iOS 15. Can't see the console log, but apears the same message:
Sorry, it looks like this example is not supported by your browser. Please give permission to use the microphone or try again in Google Chrome or Microsoft Edge.

Uncaught TypeError: Quiet.setProfilesPrefix is not a function

Hello it's me again.

I copied the code from example/text folder from the repo and I can't run the javascript at all. Whenever I fire up /sendtext.html or /receivetext.html , Chrome developer tools will give the following error.

Uncaught TypeError: Quiet.setProfilesPrefix is not a function
at sendtext.js:2
at sendtext.js:53
(anonymous) @ sendtext.js:2
(anonymous) @ sendtext.js:53

I do have a LAMP stack and nodejs installed, but I am unsure what is wrong. Thanks for any help.

Safari mobile support

Found this super cool library from a newsletter, this is the sort of thing that really feels like magic 😍
I immediatelly had a bunch of ideas on how to use this, but the browser support was a bit lacking.
I noticed Quiet.js is using navigator.getUserMedia which is deprecated and navigator.mediaDevices.getUserMedia has much better support, even Safari on mobile!

I did a quick test tomasmcm@6b8bbd6 and it does work on my iPhone!!!
I can make a simple PR with that change, is that something you'd want? (I saw the last update was May 2021)

demo image receiver not working

https://quiet.github.io/quiet-js/ gives me this error in Chrome whenever I click on Receive Image/Start Receiver:

quiet-emscripten.js:16 Uncaught abort() at Error
    at jsStackTrace (https://quiet.github.io/quiet-js/javascripts/quiet-emscripten.js:1:18181)
    at stackTrace (https://quiet.github.io/quiet-js/javascripts/quiet-emscripten.js:1:18364)
    at abort (https://quiet.github.io/quiet-js/javascripts/quiet-emscripten.js:16:17777)
    at ze (https://quiet.github.io/quiet-js/javascripts/quiet-emscripten.js:6:74856)
    at pc (https://quiet.github.io/quiet-js/javascripts/quiet-emscripten.js:6:23930)
    at Ib (https://quiet.github.io/quiet-js/javascripts/quiet-emscripten.js:6:1450)
    at asm._quiet_decoder_create (https://quiet.github.io/quiet-js/javascripts/quiet-emscripten.js:16:3354)
    at Object.ccallFunc [as ccall] (https://quiet.github.io/quiet-js/javascripts/quiet-emscripten.js:1:8963)
    at Object.receiver (https://quiet.github.io/quiet-js/javascripts/quiet.js:744:30)
    at startReceiver (https://quiet.github.io/quiet-js/javascripts/receiveimage.js:43:48)

Otherwise it's a great project, thanks!

Btw if you want to support local usage in Chrome you could allow status 0 in line 108 of quiet.js as Chrome returns status 0 for local xhr:
if (this.status >= 200 && this.status < 300) {
(allow 0 there as well)

React Native

Is it possible to use quiet in a react native app?!
I just want to create the audio in the react native app and listen to it in a web application

could the examples run locally?

Is there any way to run locally (for example by double click the html from my hdd)

I am getting some errors when trying to do that.

Thank you and great and impressive work you have here.

Dimitrios

Big problem: all mobile browsers do not support (i.e. are blocking) ultrasonic frequencies

This is really a big problem.

I have tested different mobile-version browsers on mobile phones, and found that they could not support ultrasonic frequencies, but audible sound can work.

For example, using https://quiet.github.io/quiet-js/lab.html, when I chose an audible sound option from the profile, data sent out via audible sound could be received. However, when I chose any ultrasonic options from the profile, data sent out via inaudible sound could not be received.

By contrast, desktop-version browsers (e.g. Chrome, Firefox, etc.) on my laptop computer can support receiving data via both audible and ultrasonic (inaudible) sound.

So what matter does cause this problem?

I just doubt that mobile browsers might have blocked or filtered out all ultrasonic frequencies intentionally in order to prevent ultrasonic tracking by malicious web applications. If this is the case, so the Quiet.js cannot receive data via ultrasonic signals.

Can anybody please help give an explanation on this problem?

An early reply will be highly appreciated.

Thanks in advance

Is it possible to use npm mic?

Hey,

i would like to use the npm package mic (or something else) to receive the data.
It should run on a Raspberry without browser, so it will listen to the attached microphone and do Things without Display or something else.

I forked the quietjs-bundle and got it work to send data over Speaker and receiving it on my cell phone.
But i dont get the mic to work :/

Maybe my solution is completle wrong (i get the mic stream and slice it to the size of samplebuffsize).

Does any one know how i can make this work?

Thanks :)

Examples not working

When I try to setup and run your examples, I get the following error:
Uncaught TypeError: Quiet.setProfilesPrefix is not a function

Please help. I've spent half a day troubleshooting to no avail.

Usage with React

Hi!

Is there a way of using this library with React?

I try to integrate this library in my React project, and I have some issues with that,
I've included all scripts in my index.html, and I try to initialize quiet-js like this:

useEffect(() => {
  // some code...
  
  window.Quiet.init({
    profilesPrefix: "/",
    memoryInitializerPrefix: "/",
    libfecPrefix: "/",
  });
  
  function onTransmitFinish() {
    textbox.focus();
    btn.addEventListener('click', onClick, false);
    btn.disabled = false;
    var originalText = btn.innerText;
    btn.innerText = btn.getAttribute('data-quiet-sending-text');
    btn.setAttribute('data-quiet-sending-text', originalText);
  }

  function onQuietReady() {
    var profilename = document.querySelector('[data-quiet-profile-name]').getAttribute('data-quiet-profile-name');

    transmit = window.Quiet.transmitter({ profile: profilename, onFinish: onTransmitFinish });

    btn.addEventListener('click', onClick, false);
  }

  window.Quiet.addReadyCallback(onQuietReady, onQuietFail);
}, []);

And I get the next error:

Screenshot 2021-02-16 at 18 08 37

I tried to debug this and it seems that the error occurs on this line:

Screenshot 2021-02-16 at 18 16 18

Does anyone have any ideas on how to fix this issue or provide some minimal example of integration with React?

Ultrasound more powerful

Hello Brian, is there any configuration on ultrasound profile that can be made to extend the range transmission for ultrasound communication? I tryed more gain, and other variables and I could not get better results. Can you give me some tips on how transmit better at 1 meter distance? Thanks

Add support for file suffixes

To simplify cache busting, it would be great if there were an option to add e.g. a profilesSuffix, analogous to the profilesPrefix option (and the same for memoryInitializerPrefix and libfecPrefix).

In my project I set HTTP caching to 1 year for all static resources and use a ?v=123 parameter that is incremented on each release.

wasm

Have you considered compiling this project to wasm? I imagine it wouldn't be too difficult since you're already using emscripten.

Will it work in headless browser?

I want to make a demonstration of sending data through sound. The transmitter will be my react native app and receiver will react web application. I can receive the sound in the react web application but not sure how will transmit the sound using react native app.

One possible solution is work but headless browser, Does this package works with headless browser?

The demo doesn´t work

Hello Guys, sorry for creating this issue but I´m having problems with the demo.

I tryed with Safari on Iphone, Chrome and Edge on Windows 10 but it doesn´t work. Can you guys fix it?

Thank you very much.

Sample/demo of FSK

Hi,

Great library, I am working through the demos of FSK, but facing the following issue on decode. (Displayed in console)

warning: fskframesync_decode_header(), packetizer_decode failed

tested with ultrasonic-fsk-robust, however all the FSK options seem to show same issue.

Would you have any working demos of the FSK library?

Cheers

don`t work?

I try with latest chrome, but he don`t receive any data (text or image).
Just eat all of memory and CPU...

Saving the generated audio for WAV or MP3

Dear Brian, it's me again, needing your assistance. I would like to generate the sound and be able to export it to wav or any other format with the JS version.

Can you give me directions on how to do it?

Thank you very much as always!

"sendtext" example doesn't work

Hi. I am hosting the example locally. When I click on "Send" button, its label changes to "Sending" and then nothing happens.
JS console output is the same as in the demo, but the demo works okay.
Am I doing something wrong?

UPD. Downloaded and ran the demo. It works ¯_(ツ)_/¯

Unable to run the example send text code on server

I am using a linux shared webhosting with no access to terminal. I have extracted the zip file. But when i try to run the example file it gives an error "Sorry, it looks like there was a problem with this example (fetch of quiet-profiles.json failed: )"
I have copied the entire content of the code into the server. Can you help me in getting up the code running.
The URL of the sample file is
image

too quiet :D

Hi, I am playing with the normal "audible" profile.
I have noticed that the produced audio volume is very low.
Expecially on phone.
How can I maximize the volume without "clipping"?
I should use the "gain" value or the "attenuation" value? Or both?

Empty text + click Send makes the button permanently disabled

There is a small bug when clicking on the Send buttons with no text, the button gets disabled forever, since there is no text to send at all.

This bug happens on the live demo, in the gh-pages branch.

BTW, I think this should be added as an example inside the quiet-js package, because the one provided in the examples folder is quite lacking in terms of functionality.

Do you want this published on npm?

I forked and added a package.json here so that I could install with npm and experiment with using it to sync audio feeds in Stream Kitchen.

If you like I could throw in a couple scripts to automatically pull down the latest version of quiet and push it to npm.

(Thanks a ton for the project, by the way. FWIW I'd like to eventually write node bindings to the C code, but for now I'm just using the emscripten module server-side and it works fine.)

Online demo doesn't work on mobiles

Hello there,

I've tried the online example and it works well on my laptop, but it doesn't work on my mobile, for testing, I used iPhone 11 and different browsers (Chrome and Safari) when I try to send text, my mobile doesn't produce any sound (I've tried both audible and ultrasonic option).

Is this example supposed to work on mobiles?

best audio profile for short messages from the iphone speaker?

Hey there... first, let me say that this is a really neat project. Great examples really help sell its utility, so I really appreciate that. Thanks for all your hard work!

Here's my issue - I'm having a fair amount of trouble transmitting simple messages from the iPhone to my computer. It does work sometimes, but what's the best way to help that happen reliably?

Tuning Quiet for Reliable Low Bitrate Whisper

I want to broadcast a very low bitrate of 16-32 bits per second for source identification (as opposed to large data transmission), ideally continually, while staying as inaudible as possible. Which settings should I be tuning?

Have you explored lower-end bass frequencies for this purpose, perhaps infrasonic? And could I consider stretching a symbol over a much wider bandwidth at a low energy to ensure delivery?

(My background is systems & signals, but haven't done much modulation in a while.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.