Giter Club home page Giter Club logo

quiet-js's Introduction

Quiet.js

Documentation

This is a javascript binding for libquiet, a library for sending and receiving data via sound card. It can function either via speaker or cable (e.g., 3.5mm). Quiet comes included with a few transmissions profiles which configure quiet's transmitter and receiver. For speaker transmission, there is a profile which transmits around the 19kHz range, which is essentially imperceptible to people (nearly ultrasonic). For transmission via cable, quiet.js has profiles which offer speeds of at least 40 kbps.

Try it out in this live example.

Compatibility

Browser Transmitter Receiver
Chrome Supported Supported1
Chrome (Android) Supported Partially Supported1,2
Edge Supported Supported
Firefox Supported Partially Supported3
Firefox (Android) Supported Partially Supported2,3
Internet Explorer Not Supported Not Supported
Safari Supported Not Supported4
Safari (iOS) Supported Not Supported4

[1]: For Chrome receivers, the page must be delivered via https. Chrome does not support microphone input without TLS.

[2]: GMSK profiles only

[3]: Firefox's WebAudio implementation resamples audio input to 32kHz, which limits all audio received to 16kHz and below. This means the ultrasonic profile cannot be used for Firefox receivers. Additionally, the resampler used by Firefox produces strong audio distortion, which makes reception by some profiles difficult. However, the audible profiles work well. For the most recent information on this limitation, refer to Bug 953265.

[4]: Safari does not support getUserMedia or microphone input in any capacity.

Usage

The full documentation is available here.

Quiet-js includes a blob of libquiet compiled by emscripten as well as a javascript binding for ease of use. The bindings must be loaded before the compiled portion. Below is the recommended way to include Quiet in your project.

    <script type="text/javascript" src="quiet.js"></script>
    <script type="text/javascript" src="your_project.js"></script>
    <script async type="text/javascript" src="quiet-emscripten.js"></script>

Additionally, the emscripten compiled portion requires a memory initializer, quiet-emscripten.js.mem. This is loaded asynchronously by quiet-emscripten.js.

It is strongly recommended to also include libfec.js. An emscripten-compiled version of libfec may be found here or with npm install libfec. If libfec is not included, then quiet.js will not be able to use any profiles which use convolutional codes or Reed-Solomon error correction.

For a complete example demonstrating ultrasonic text transmission and reception, see this example.

License

Quiet and Quiet-js are licensed under 3-clause BSD. Quiet-js's emscripten-compiled output includes a statically-linked copies of liquid dsp and libjansson, both of which are licensed under the MIT license. For more information on Quiet-js's 3rd party licenses, consult LICENSE-3RD-PARTY.

Additionally, it is strongly recommended to link libfec (npm install libfec). libfec is licensed under LGPL. It is the intention of this project to adhere to the provisions of LGPL by dynamically linking libfec. However, neither this statement nor any other statements in these projects may be construed as legal advice from the author. It is solely the user's responsibility to ensure their own compliance with all applicable licenses.

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

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)

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.

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...

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?

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.

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!

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.

"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 ¯_(ツ)_/¯

wasm

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

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.)

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.

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?

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?

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.)

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

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

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.

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.

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

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 :)

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

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)

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.

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

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!

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?

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.

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?

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

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.

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

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.