added scripts

master
Angeliki 6 years ago
commit 000499142a

Binary file not shown.

@ -0,0 +1,8 @@
from pynput.keyboard import Key, Controller
keyboard = Controller()
while True:
if keyboard.press('space'):
print ('You Pressed A Key!')

@ -0,0 +1,20 @@
import subprocess
from subprocess import Popen
import mouse
import time
is_recording=False
while True:
if mouse.is_pressed(button='left') and not is_recording:
is_recording=True
subprocess.Popen('espeak recording',shell=True)
p=subprocess.Popen('./record.py',shell=True)
#p.wait()
time.sleep(2)
elif mouse.is_pressed(button='left') and is_recording:
is_recording=False
subprocess.Popen('espeak stop recording',shell=True)
p.kill()
#p.wait()
time.sleep(2)

@ -0,0 +1,19 @@
#!/usr/bin/env python3
import os, subprocess, shlex
import glob
from random import choice
home_path = os.path.abspath(__file__)
#recordings_path = home_path + '/audios/*'
recordings_path = 'audios/*'
while True:
soundfiles=glob.glob(recordings_path)
print(soundfiles)
sound = choice(soundfiles)
cmd = "aplay -f cd -D hw:1,0 {}".format(sound)
cmd = shlex.split(cmd)
subprocess.call(cmd)

@ -0,0 +1,30 @@
#!/usr/bin/env python3
import subprocess
import shlex
import os
from datetime import datetime
from time import sleep
now = datetime.now().strftime('%Y%m%d-%H%M%S')
home_path = os.path.abspath(__file__)
#recordings_path = home_path + '/audios/'
recordings_path ='audios/'
recording_file = recordings_path + now + '.wav'
print(recording_file)
cmd = "arecord -f cd -D hw:1,0 {}".format(recording_file)
cmd = shlex.split(cmd)
# start recording
rec = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=False)
sleep(5)
# stop recording
rec.kill()
Loading…
Cancel
Save