During the night (when I'm sleeping), it is mostly quiet. However, there are sometimes noises (e.g. noisy traffic). I want to record these noises.

One method I've previously employed is to simply set up recording for the entire night using any recording software (e.g. Audacity). However, this is highly inefficient because I then have to go through the entire 8+ hours long audio file. (Not to mention also that the file sizes are very large.)

I am thus looking for a more efficient way to record these noises.

Essential requirements:

  • Ability to set sound/decibel level threshold above which noises are recorded. (The rest of the time no recording is done.)
  • Timestamp with each noise recorded.
  • Works on Windows 10 (PC) or Android mobile.

(Perhaps there's some way to accomplish the above in Audacity or some other software that I am not aware of; in which case I would also be very grateful if someone could teach me how.)

Nice to have:

  • Free.
  • Lightweight.


Essential requirements:

  • You can set a trigger (decibel level) above which sounds are recorded.
  • MP3 files are then automatically saved as "YYYY-MM-dd hhmmss.mp3", where hhmmss is the time at which recording began.
  • Windows program (indeed it seems to be available only for Windows).

Nice to have:

  • Unfortunately, it is not free. Free 30-day trial, then US$24.95 or $34.95 for the Standard or Professional version.
  • Seems lightweight enough to me (for example, I'm running it right now and it's using 8.5MB memory).
| improve this answer | |

If you've been successful with Audacity, you can continue to use the program. According to this web page, there's a feature within Audacity to trigger recording when a specified level is reached.

Summary: In the recording section of Preferences, there is a Sound Activated Recording check box as well as a location to specify the trigger level.

Unfortunately, this is only a partial answer, as the timestamp portion is not resolved.

| improve this answer | |

You could use Python with PyAudio by adapting the accepted answer to this SO Question.

  • Python & PyAudio are both free, open source & cross platform so the following should work on most platforms.
  • I would suggest modifying the example code to start recording to a file named for the date and time when the sound level exceeds some limit and stop a second or longer after the last time that the sound level was exceeded.

Something like, (note that this is not production quality code):

import pyaudio
import wave
import audioop
import datetime

now = datetime.datetime.now()  # Get the time now
ENDTIME = now + datetime.timedelta(hours=8) # Record for 8 hours
OVERRUN = datetime.timedelta(seconds=5)  # How long to continue after last loud
THRESHOLD = 123  # Use some number determined experimentally

# The following are the pyAudio parameters from the original example
CHUNK = 1024
FORMAT = pyaudio.paInt16
RATE = 44100

p = pyaudio.PyAudio()

stream = p.open(format=FORMAT,

recording = False
outfile = None
last_over = datetime.datetime(0)
started_recording_at = None

while now < ENDTIME:  # Run till endtime
    data = stream.read(CHUNK)     # get the latest sound chunk
    now = datetime.datetime.now()  # Get the current time
    rms = audioop.rms(data, 2)    # here's where you calculate the volume

    if not recording and rms > THRESHOLD:  # Loud so start recording
        fname = now.strftime('%Y-%m-%d-%H-%M-%S.wav')  # Create the filename
        outfile = open(fname, 'wb')  # Open for binary write
        print("RMS = {}: Started recording to {}".format(rms, fname))
        recording = True
        started_recording_at = now

    if recording:  # We are recording
        outfile.write(data)  # Save the sound chunk
        if rms > THRESHOLD:  # Still loud?
            last_over = now  # Save time
        if now - last_over > OVERRUN:  # Quiet for long enough
            recording = False  # Stop recording
            outfile.close()   # Close the file
            print("Recording Length {}".format(now-started_recording_at))
# Tidy Up!

If you are unfamiliar with python placing the code above in a text file called nightwatch.py then running with:

python nightwatch

Should do more or less what you asked for.

| improve this answer | |

Your Answer

