#133 Very loud white noise
Opened 9 months ago by lint838. Modified 8 months ago

Summary

When locally generated audio level is set to strict, the white noise generated is too loud. (therefore when JavaScript Shield is active and set to 'Strict' level)

After testing I can deduce that when I set both Locally generated audio to Strict and Multimedia playback to strict/block, the white noise plays.

Setup

Pages affected: e.g. https://en.wiktionary.org/wiki/File:En-us-delta.ogg
JShelter Version: 0.17

Popup information (open JShelter popup on affected pages:

  1. Navigate to a page that you are having trouble with: https://en.wiktionary.org/wiki/File:En-us-delta.ogg
  2. Click on the JShelter badge icon.
  3. Is JavaScript Shield active? ON
  4. Is Network Boundary Shield active? ON (but not relevant)
  5. Is Fingerprint Detector active? ON (but not relevant)
  6. What fingerprint likelihood does Fingerprint Detector report? None
  7. Did Fingerprint Detector produce any notifications, if so, what was the notification? No
  8. Click on the Modify button next to the JavaScript Shield label.
  9. What is the highlighted level button text? Default level (Strict)
  10. Click on the Detail tweaks of JS shield for this site button.
  11. What wrappers were triggered by the page, list them below:
    Multimedia playback

OS: Arch
Browser: Firefox 123.0
Other extensions that might affect JShelter behaviour: None

How to reproduce

See above

Expected result

The audio is either played or blocked correctly and doesn't make me jump and almost destroy my hearing.

Actual result

A white noise is played way too loudly.

Reproducibility

Have you tried another profile/browser/machine/OS?
No I'm already taking the time to file this bug report.

Workarounds

Setting Locally generated audio and Multimedia playback to lower levels won't play the white noise.

Have you tried other steps to solve the issue?

No

Additional information / notes

Probably there would be a way to implement some sort of limiter? I don't know.


Hello, lint838. First of all, you have a good point, right now, the algorithm creates random data data without any control on the loudness. So we should think about a way to control the loudness. I looked quickly for an algorithm that would yield more pleasant sounds but did not find anything. I will leave this issue open and hopefully get back to this.

Anyway, I tried the wiktionary example and I either was not able to play the sound at all, or I heard the original sound - "delta".

A quick way to hear what sound JShelter may produce is to go to https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer and, for example, copy the code into the console.

Metadata Update from @polcak:
- Issue tagged with: bug

8 months ago

That was loud. Out of precaution, I removed my headset and just copied the example into the console and let the noise scream. I'm on another machine and OS so I know it's not a "it doesn't work on my machine".

const audioCtx = new (window.AudioContext || window.webkitAudioContext)();

// Create an empty three-second stereo buffer at the sample rate of the AudioContext
const myArrayBuffer = audioCtx.createBuffer(
  2,
  audioCtx.sampleRate * 3,
  audioCtx.sampleRate,
);

// Fill the buffer with white noise;
// just random values between -1.0 and 1.0
for (let channel = 0; channel < myArrayBuffer.numberOfChannels; channel++) {
  // This gives us the actual array that contains the data
  const nowBuffering = myArrayBuffer.getChannelData(channel);
  for (let i = 0; i < myArrayBuffer.length; i++) {
    // Math.random() is in [0; 1.0]
    // audio needs to be in [-1.0; 1.0]
    nowBuffering[i] = Math.random() * 2 - 1;
  }
}

// Get an AudioBufferSourceNode.
// This is the AudioNode to use when we want to play an AudioBuffer
const source = audioCtx.createBufferSource();

// set the buffer in the AudioBufferSourceNode
source.buffer = myArrayBuffer;

// connect the AudioBufferSourceNode to the
// destination so we can hear the sound
source.connect(audioCtx.destination);

// start the source playing
source.start();

JS Shield Level: Recommended
Network Boundary Shield: On
Fingerprint detector: On

Hope it helps! And thanks for the amazing work.

AFAIU, the code in the prievious post is a copy of the code from MDN referenced in my previous post.

To clarify, I consider this to be a bug that needs to be solved. It is NOT cannot replicate. The bug is that the noise that JShelter creates does not control the loudness. Ideally, we should create a noise that is quiet. For the reason the the bug opener precisely described. A page that lets play the white noise should not hurt the user.

About the replicability. It should be quiet easy to create a demo page that reads the data modified by JShelter and plays it.

Log in to comment on this ticket.

Metadata