LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 01-03-2011, 08:43 AM   #1
wearetheborg
Member
 
Registered: Sep 2004
Distribution: Mint 19.1
Posts: 298

Rep: Reputation: 41
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?
 
Old 01-03-2011, 08:57 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
audacity can generate all sorts of noises, and then process them further.
 
Old 01-03-2011, 09:28 AM   #3
SonnySee
Member
 
Registered: Aug 2010
Distribution: Unbuntu 11.10 beta
Posts: 78

Rep: Reputation: 10
Additionally, you could get a microphone and record a few minutes of the actual sound you want and play it on a loop.
 
Old 01-03-2011, 10:31 AM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,921

Rep: Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618
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.
 
Old 01-03-2011, 09:19 PM   #5
wearetheborg
Member
 
Registered: Sep 2004
Distribution: Mint 19.1
Posts: 298

Original Poster
Rep: Reputation: 41
Quote:
Originally Posted by tredegar View Post
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

Last edited by wearetheborg; 01-03-2011 at 09:21 PM.
 
Old 01-04-2011, 12:37 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,921

Rep: Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618
You don't need to generate noise. You select the noise you want to remove. There is a big difference between the two.
 
Old 01-04-2011, 03:07 PM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
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.
 
Old 01-04-2011, 06:52 PM   #8
wearetheborg
Member
 
Registered: Sep 2004
Distribution: Mint 19.1
Posts: 298

Original Poster
Rep: Reputation: 41
Quote:
Originally Posted by jefro View Post
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
 
Old 01-05-2011, 02:03 PM   #9
masterclassic
Member
 
Registered: Jun 2007
Distribution: Knoppix, antiX
Posts: 252

Rep: Reputation: 73
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.
 
Old 01-05-2011, 02:50 PM   #10
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,921

Rep: Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618
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.
 
Old 01-05-2011, 05:47 PM   #11
wearetheborg
Member
 
Registered: Sep 2004
Distribution: Mint 19.1
Posts: 298

Original Poster
Rep: Reputation: 41
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.
 
Old 01-06-2011, 07:08 AM   #12
tur third
Member
 
Registered: Jun 2005
Location: Surrey, UK
Distribution: Ubuntu 10.04, 10.10
Posts: 187

Rep: Reputation: 24
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.
 
Old 01-06-2011, 11:00 AM   #13
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,921

Rep: Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618Reputation: 3618
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.

Last edited by jefro; 01-06-2011 at 11:03 AM.
 
Old 01-06-2011, 01:28 PM   #14
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
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.
 
Old 01-06-2011, 01:36 PM   #15
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
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
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to removing white noise from a wav file? MikeyCarter Linux - Software 2 10-22-2009 10:54 AM
Audio output white noise rmcellig Linux - Newbie 1 10-02-2009 05:39 PM
cracking noise when I audio file nikhilhandigol Fedora 3 01-16-2006 11:23 PM
Sound has background white noise. SUSE 9.1 Ralph Fant Linux - Software 1 08-19-2005 03:55 PM
Alsa makes ¨white noise¨ A Cow Linux - Software 3 05-06-2004 09:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration