LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Generating a white noise audio file? (http://www.linuxquestions.org/questions/linux-general-1/generating-a-white-noise-audio-file-853903/)

wearetheborg 01-03-2011 08:43 AM

Generating a white noise audio file?
 
My apt gets noise from outside. I would like to generate a white noise audio file and play it to block outside noise. I would prefer something like the low frequency hum of a big fan. How can I generate this file in using linux tools?

tredegar 01-03-2011 08:57 AM

audacity can generate all sorts of noises, and then process them further.

SonnySee 01-03-2011 09:28 AM

Additionally, you could get a microphone and record a few minutes of the actual sound you want and play it on a loop.

jefro 01-03-2011 10:31 AM

I use audacity to capture the noise sample and then use the noise reduction to remove it. Just record a few seconds of your work before you begin. Then use that time as sample for noise reduction.


A better mic may help a lot too. It is difficult to get studio results in a home.

wearetheborg 01-03-2011 09:19 PM

Quote:

Originally Posted by tredegar (Post 4211482)
audacity can generate all sorts of noises, and then process them further.


Thanks, installed audacity and am playing with it (unfortunately, I dont have access to a decent microphone.

I also found the following command to generate brown noise:
play -n synth 60:00 brownnoise band -n 10 900 tremolo 20 .1 < /dev/zero

jefro 01-04-2011 12:37 PM

You don't need to generate noise. You select the noise you want to remove. There is a big difference between the two.

tredegar 01-04-2011 03:07 PM

Quote:

You don't need to generate noise. You select the noise you want to remove. There is a big difference between the two.
Like those "noise cancelling headphones"?

Good idea for the OP, but in my experience, they don't work that well. The Bose "noise cancelling headphones" I was given a couple of years ago were no better than ordinary headphones, though very comfortable on my head. Perhaps things have improved recently.

wearetheborg 01-04-2011 06:52 PM

Quote:

Originally Posted by jefro (Post 4212940)
You don't need to generate noise. You select the noise you want to remove. There is a big difference between the two.

Noise cancellation works only on predictable noise. Furntiture being moved upstairs, baby crying, father singing...noise cancellation wont work :P

masterclassic 01-05-2011 02:03 PM

As others already wrote, you have to sample the noise to remove, and apply this sample to the removing tool.
I use audacity myself. Its noise-removing tool works in 2 steps:

1. You select some of the noise in a part of the track that doesn't contain other sounds (at the beginning, at the end, at some "silent" point of the recording) and you select the sample command.

2. You select the part of the recording you want to process and you select the noise removing function. Then, you need to select the level of the processing. Be careful: don't select too much, because this will influence not only the noise but the entire sound content (big distorsion, bad result). I usually stay lower that the mid position of the slider, more often to the 25%. It is better to test the result on a series of copies, and listen to.

I am not really satisfied from this kind of noise removind. However it works for a low 50hz or 60Hz frequency, that comes from the power network. Cables and connectors we use for a personal computer aren't high quality ones in most of the cases. I think that better audio components and a better sound card eliminate in a significant degree noise problem. An old computer of mine had a noise level of approximately -40dB and -50dB for the 2 stereo channels; my new one had about -60dB for both channels. Long cables generate more problems, too.

I often prefer to not use noise removing at all. I know that noise removing isn't easy at all. Even with expensive professional software, it is sometimes better to leave a few noise instead of altering the recording.

jefro 01-05-2011 02:50 PM

Audacity does cancel similar to the headphone but the headphone is live state. I guess one could then record outside of the room to make a cancel loop. Match it to the recording and then subtract it from master to work like the live state of the headphones.

You will be unable to cancel random noise without a sample. You will find that audacity will be able to clean up your recording a lot if you simply take a sample of room noise. For a test just start recording and play a sample back. Turn up the volume. You'll hear a lot of noise that can be canceled.

I have used it many times to help clean up a song. They will never sound like a studio.

The only way to improve it would be to create a home studio and get better mics and recording equipment. Dolby made his money canceling noise.

wearetheborg 01-05-2011 05:47 PM

Sorry I was not clear, I am interested in blocking noise real time, to sleep etc.
I am not after removing noise from a recording.

tur third 01-06-2011 07:08 AM

Interesting idea. I think audacity could be your best bet. An alternative, that will be more complicated, maybe be to use some code to generate a sound file. I have just done a search and you should be able to find examples of how to do this in python.

e.g. http://www.daniweb.com/code/snippet217024.html

In audacity I think you can change frequency and speed of recordings. I.e. get hold of a recording of a fan and play around with it, until it becomes the white noise you are looking for.

As an aside, in reference to tredegar's comment about noise cancelling headphones. As sounds are waves, I understand these try to play the opposite wave (therefore cancelling it out). As this is done realtime, they work ok on low frequency, however are not really fast enough to work on high frequency noises, where waves are closer together. In my experience they work well on planes and trains, but not too much good elsewhere.

jefro 01-06-2011 11:00 AM

Oh cr@p.

You could go berserk and make a noise canceling system but they make tons of noise gizmos. Surf to air to bells to road noises and more. They'd use less energy than a computer would.

I use those cheap foam ear plugs. They work great. Get the 30 db ones.

H_TeXMeX_H 01-06-2011 01:28 PM

I've found that noise canceling headsets don't work as they should. If you think you can do better, try, but without a good mic, no way.

Get ear plugs like jefro suggests, make sure they are soft.

arizonagroovejet 01-06-2011 01:36 PM

I think you're over complicating it.
When I was after some sort of noise to try playing to block out misc irritating neighbourhood noise I hit Google and found a nice recording someone had made of a rain storm which I stuck on an mp3 player. I sleep with one ear against a pillow so I use just one earphone. Works well enough. (I can't remember where I found the recording and it's too large to send you.)
Also as jefro mentioned, ear plugs. I picked up a three pairs of re-usable foam ear plugs from Amazon for a few quid (around five US dollars). I find the rain works better at getting me off to sleep though.
Worth taking a look at http://www.simplynoise.com/ too. The Thunderstorm download is currently free but I quickly decided there was no way I'd be able to sleep with it going :)


All times are GMT -5. The time now is 04:45 PM.