Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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?
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.
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.
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.
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.
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.
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