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.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.