nnirror/facet

Horrible noisy crash :)

Closed this issue · 3 comments

This makes a horrible noise and becomes unresponsive after about thirty seconds:

$('rnd').randsamp().play(_.noise(4));
$('example').noise(1000).size(44100).play(_.noise(4));

Also: is there a command I can issue in the terminal to quit facet in npm rather than just closing the terminal?

I looked into this for a little while, and I think below there's hopefully a workaround - but it makes me wonder if I should be using SoX at all for resizing. (The .size() command seems to be where these clicks are coming from, and it's kinda special and actually runs after all other commands have run, in SoX, prior to saving the wav file.)

So I'm considering a bigger change to address this long-term, but here's how I would write your second command:

$('example').noise(44100).audio().play(_.noise(4));

Then for question re: closing the terminal, I'm on Mac but for me it's ctrl+c to quit the running process. However, I have found once in a blue moon the server gets locked up and actually stays open in the background until I run "htop", find the stuck process, and kill it via kill -9 {pid_here}.

So, I'm going to keep this issue open to address both these things:

  1. SoX is probably not necessary for wavetable resizing commands, especially since it's causing clicks in some contexts
  2. Needs to be better UX for killing/stopping/monitoring process

Issue 1 should be fixed now in v0.5.3: https://github.com/mjcella/facet/releases/tag/v0.5.3

Hopefully now this example works for you and isn't causing any crashes or horrible noises:

$('example').noise(1000).size(44100).play(_.noise(4));

Note: I would add a .audio() before the .play(), which will send the pattern through a HPF at 0Hz, helping to prevent clicks and DC offset, and moving the pattern into a bipolar range between -1 and 1.

Still gotta work on issue 2.

I made a new issue for the second part, just so it's easier for me to see at bird's eye view for what needs to be done 😄 : #29

With that, closing this one out