You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
415 B
Python

#!/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)