Live data from Hacker News

Frequency-shaped background noise generators

mynoise.net

101–110 of 114 posts

Re: Frequency-shaped background noise generators

#101
post #85

Earlier quoted context omitted.

Right, the EQ controls the volume of each of the 10 (each one corresponds to a slider) sounds. (Every sound has been previously decomposed into its frequency components.) The Web Audio API is used for browsers that have it present, else HTML5 audio elements are used. The slider just adjusts the volume of the sound (exponentially of course!), leading to an equalizer effect with no filtering required. (Garnered from lo…

You could filter it yourself with a bit of DSP knowledge. I've seen this approach working effectively in Firefox without Web Audio API. Impulse filters are easy to implement, e.g. an averaging low pass filter (or at least I think so, I'm no DSP expert): out(t) = 1/sum(a) * (a_1 * in(t) + a_2 * in(t-1) + ... + a_n * in(t-n+1)) Where "a" is a vector of constant coefficents. You could even use FFT to modulate the bands…

Sure, you could pre-calculate your filter coefficients and use a bandpass for each frequency band then do the math in Javascript however it's slower, and more involved. Also, unless you're going to be using WAVs, there's going to be some overhead for the decoding of the sound. Also, the filter won't be very high order since you're going to be doing at least n*44100 operations per second (at the standard sampling rate). (Web Audio API filter nodes are only 2nd order but you can cascade them.) Do you have examples of the above working in Firefox? I'd be curious to see the implementation.

Re: Frequency-shaped background noise generators

#102
post #98

Hi Guys! I am the developer of the myNoise website and just want to say that all your comments are a great source of inspiration today: many suggestions for further improvements will be taken into account! Although I did entirely code the website by my own using a simple text editor, I am not a programmer, in the sense that I never learned how to program efficiently and beautifully. Multiplatform issues, and mobile b…

Amazing work! I'll definitely visit more often, these are great. Minor quibble: the "Binaural Beat Machine" does not produce binaural beats. It plays two notes at the same time, to both ears, which produces an actual beat in each ear (pull off one headphone - you can still hear it). A nice example of how it should sound: http://en.wikipedia.org/wiki/Binaural_beats

It does combine both, as to work without headphones, but if you wear the headphones, you will have the binaural thing on top of the modulation. Two for the price of one ;-)

Re: Frequency-shaped background noise generators

#103
post #29
post #21

Earlier quoted context omitted.

An old Linux command line trick to generate the engine sound: > play -n -c1 synth whitenoise band -n 100 20 band -n 50 20 gain +25 fade h 1 864000 1 I used this as a background noise muting sound when I was a kid.

Here is a softer variant: play -c2 -n synth whitenoise band -n 100 24 band -n 300 100 gain +20

This is the warp core idling.

I'm trying to add a slow warp to it, and after some experiment I got something. That's the first time I've used sox to generate audio, didn't even know it could. I'll play with it some more.

play -c2 -n synth whitenoise band -n 100 24 band -n 300 100 gain +20 phaser 0.5 0.3 2 0.8 0.5 -t

Re: Frequency-shaped background noise generators

#104

Earlier quoted context omitted.

Thanks for doing this, I'm going to use this page a lot, I think. But have you thought about open sourcing some, if not all of the code? With the source code out on for instance github, a lot of people could help you out wherever you feel your own skills come to short.

If it were me, I'd not open source this. Common tools that are used to build other things generally are, such as a compiler or VCS, but an actual finished product, not so much. Open sourcing this would be like Github open sourcing github.com, rather than just a handful of common tools they built to create github that might be useful to others. Open source has a time and a place, but some things, like finished website…

Only if the goal of the site is to make money. If there's no profit involved there is no downside to open sourcing it.

Re: Frequency-shaped background noise generators

#105

Earlier quoted context omitted.

If it were me, I'd not open source this. Common tools that are used to build other things generally are, such as a compiler or VCS, but an actual finished product, not so much. Open sourcing this would be like Github open sourcing github.com, rather than just a handful of common tools they built to create github that might be useful to others. Open source has a time and a place, but some things, like finished website…

Only if the goal of the site is to make money. If there's no profit involved there is no downside to open sourcing it.

Not true. You might not want to make money yourself but you also might not want other people to rip your work off and profit from it.

People that open source things do so as a gift to the community at large, and sometimes people just don't want to give away their property (intellectual in this case), even if they don't intent to turn a profit. Plus, leading an open source project can be quite stressful and there's also the time cost of actually supporting a community of people, if they gather around a project.

There are tons of downsides to open sourcing something but occasionally there's a significant benefit (or other motive) that drives the decision to open source and outweighs the negatives.

Re: Frequency-shaped background noise generators

#106
post #29

Earlier quoted context omitted.

Here is a softer variant: play -c2 -n synth whitenoise band -n 100 24 band -n 300 100 gain +20

This is the warp core idling. I'm trying to add a slow warp to it, and after some experiment I got something. That's the first time I've used sox to generate audio, didn't even know it could. I'll play with it some more. play -c2 -n synth whitenoise band -n 100 24 band -n 300 100 gain +20 phaser 0.5 0.3 2 0.8 0.5 -t

Sox can be pretty handy. For example it's easy to use it for musical instruments tuning (instead of buying some expensive electrical device).

For example for mandolin layout:

4 (G):

    while true; do play -n synth pluck G3 fade 0 3 vol 0.4; sleep 1; done
3 (D):

    while true; do play -n synth pluck D4 fade 0 3 vol 0.4; sleep 1; done
2 (A):

    while true; do play -n synth pluck A4 fade 0 3 vol 0.4; sleep 1; done
1 (E):

    while true; do play -n synth pluck E5 fade 0 3 vol 0.4; sleep 1; done

Re: Frequency-shaped background noise generators

#108
post #70

First of all -- awesome concept and execution, and great sound samples. Well-done. > Mobile Safari iOS 6 on iPad 2+, iPhone 4GS+ But... not working on my 4S/iOS6. :( Anyone got it working to play in the background, even when your phone's screen is off? I also wonder about battery life as HTML5 audio, vs if it were an app. The creators clearly want to support HTML-only, according to the FAQ, but this calls for an app…

Agreed. And I would pay quite a bit of money (in the context of what apps cost ... i.e., $10 or so) for an app that did this with this level of quality.

Definitely! Unfortunate that the Web Audio API doesn't work with PhoneGap on Android due Android's built-in browser not supporting it.

Re: Frequency-shaped background noise generators

#109

Earlier quoted context omitted.

Only if the goal of the site is to make money. If there's no profit involved there is no downside to open sourcing it.

Not true. You might not want to make money yourself but you also might not want other people to rip your work off and profit from it. People that open source things do so as a gift to the community at large, and sometimes people just don't want to give away their property (intellectual in this case), even if they don't intent to turn a profit. Plus, leading an open source project can be quite stressful and there's al…

Very insightful and totally right. Thanks for sharing your opinion.

Re: Frequency-shaped background noise generators

#110
post #85

Earlier quoted context omitted.

You could filter it yourself with a bit of DSP knowledge. I've seen this approach working effectively in Firefox without Web Audio API. Impulse filters are easy to implement, e.g. an averaging low pass filter (or at least I think so, I'm no DSP expert): out(t) = 1/sum(a) * (a_1 * in(t) + a_2 * in(t-1) + ... + a_n * in(t-n+1)) Where "a" is a vector of constant coefficents. You could even use FFT to modulate the bands…

Sure, you could pre-calculate your filter coefficients and use a bandpass for each frequency band then do the math in Javascript however it's slower, and more involved. Also, unless you're going to be using WAVs, there's going to be some overhead for the decoding of the sound. Also, the filter won't be very high order since you're going to be doing at least n*44100 operations per second (at the standard sampling rate…

> it's slower

It's slower, but... does it matter if it's not just "slow"? Slower than "so fast" is still "fast".

> and more involved

That's right.

> Also, unless you're going to be using WAVs, there's going to be some overhead for the decoding of the sound.

If I recall correctly, Firefox's Audio Data API does the decoding for you and provides the final PCM samples even when loading non-WAV formats.

> Also, the filter won't be very high order since you're going to be doing at least n 44100 operations per second

If the effect computation is a problem, you can pre-render it in a buffer.

Anyways, n*44100 operations per second is not that much. You actually operate on buffers, which makes caching useful for the slow part (memory access). Summing, multiplying, etc. is a piece of cake for your CPU in JIT-compiled code.

Check this JSFiddle I threw in a couple minutes: http://jsfiddle.net/9LpKd/2/ (please mind the awful effect and the fact that it's not audio... I'm not very experienced with Audio Data API and that would take me a bit more to fiddle with!)

44000 pixel updates, up to 60 times a second, with pretty expensive operations (sines, cosines and even square roots!), updating DOM values... JavaScript is fast enough for this.

I can see the problem in mobile devices though, but I'm not even sure Firefox provides Audio Data API in mobile devices.

>Do you have examples of the above working in Firefox? I'd be curious to see the implementation.

The only web implementing it that I can remember is http://websdr.ewi.utwente.nl:8901/ (you have to check the HTML5 audio radio button).

Unfortunately the code is minified and it takes a bit to make sense of it after Beautifying.

Post reply on HN