Skip to content

Instantly share code, notes, and snippets.

@gerber4
gerber4 / sound_recorder.py
Created September 13, 2018 03:04 — forked from mabdrabo/sound_recorder.py
Simple script to record sound from the microphone, dependencies: easy_install pyaudio
import pyaudio
import wave
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
CHUNK = 1024
RECORD_SECONDS = 5
WAVE_OUTPUT_FILENAME = "file.wav"
@gerber4
gerber4 / alarmdetect.py
Created September 13, 2018 03:05 — forked from benjaminchodroff/alarmdetect.py
raspberry pi microphone alarm detection
#!/usr/bin/env python
import pyaudio
from numpy import zeros,linspace,short,fromstring,hstack,transpose,log
from scipy import fft
from time import sleep
#Volume Sensitivity, 0.05: Extremely Sensitive, may give false alarms
# 0.1: Probably Ideal volume
# 1: Poorly sensitive, will only go off for relatively loud
SENSITIVITY= 1.0