Skip to content

fuzzer web interface: play a little jingle when it finds a bug! #20995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andrewrk opened this issue Aug 8, 2024 · 3 comments
Open

fuzzer web interface: play a little jingle when it finds a bug! #20995

andrewrk opened this issue Aug 8, 2024 · 3 comments
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. fuzzing
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Aug 8, 2024

Extracted from #20958.

What if there was a setting in the web UI where you could get a little sound notification to play if the fuzzer found a bug? It would be like a little cherry on top of a big bowl of ice cream.

Of course, we're not going to commit any sampled audio to the zig source repository, so the jingle would need to be procedurally generated by some DSP golf zig code that runs in wasm populating a buffer that gets played with the browser's audio API 😎

And it should probably be disabled by default, but have a persistent setting so that someone could toggle it on and it would stay on. Or perhaps it could be on by default, but only plays if a long time has passed between starting fuzzing and finding the bug, and rate limited to 1 per hour or something like that.

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. fuzzing labels Aug 8, 2024
@andrewrk andrewrk added this to the unplanned milestone Aug 8, 2024
@geon
Copy link

geon commented Aug 20, 2024

You don't even need to generate a buffer. You can just use an oscillator.

Mario coin sound: https://mohayonao.github.io/web-audio-sound-examples/

function coin(destination, playbackTime, opts) {
  opts = opts || {};
  var t0 = playbackTime;
  var t1 = t0 + 0.075;
  var t2 = t1 + 0.825;
  var audioContext = destination.context;
  var oscillator = audioContext.createOscillator();
  var gain = audioContext.createGain();
  var volume = opts.volume || 0.25;

  oscillator.type = "square";
  oscillator.frequency.setValueAtTime(990, t0);
  oscillator.frequency.setValueAtTime(1320, t1);
  oscillator.start(t0);
  oscillator.stop(t2);
  oscillator.connect(gain);

  gain.gain.setValueAtTime(volume, t0);
  gain.gain.setValueAtTime(volume, t1);
  gain.gain.linearRampToValueAtTime(0, t2);
  gain.connect(destination);
}

function example01(audioContext, coin) {
  var destination = audioContext.destination;
  var t0 = audioContext.currentTime;

  coin(destination, t0);
}

@andrewrk
Copy link
Member Author

Mario coin sound is a great example! For this issue however, it is a chance to exercise a little creativity and produce a unique sound.

@Rexicon226
Copy link
Contributor

Moving my suggestion from the Discord, I thought it'd be cool if the sound was generated as a normalization of the bytes that were used to find the bug 😄 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. fuzzing
Projects
None yet
Development

No branches or pull requests

3 participants