forked from CogWorksBWSI/Microphone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_input.py
More file actions
18 lines (14 loc) · 707 Bytes
/
Copy pathtest_input.py
File metadata and controls
18 lines (14 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from microphone.context_managers import open_input_device, open_output_device
from microphone.configure_input import load_ini
from microphone.__init__ import record_audio, play_audio
""" Running this script will test the configured microphone - it will record
audio using the device for RECORD_SECONDS amount of time, and then play back
the audio. """
RECORD_SECONDS = 5
print('Recording audio for {} seconds... (if this hangs, choose a different input device)'.format(RECORD_SECONDS))
frames, _RATE = record_audio(RECORD_SECONDS)
print('Finished recording')
# Playback the recorded digital signal
print('Playing back recording...')
play_audio(frames, RECORD_SECONDS)
print('Finished playback')