Last active
October 20, 2019 19:51
-
-
Save dgnsrekt/c6c9c48068a523df5700849f579c81d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import Popen, PIPE, STDOUT, run | |
from pathlib import Path | |
from shlex import split | |
from random import randint | |
import sys | |
frequency = 400 | |
seconds = 5 | |
channels = 2 | |
sequence_length = 100 | |
command = Path("/usr/bin/alsabat") | |
assert command.exists() | |
for _ in range(sequence_length): | |
if randint(0, 2): | |
continue | |
print(frequency, seconds) | |
cmd = f"{str(command)} -F {frequency} -n {seconds * 1000} -P plughw" | |
cmd = split(cmd) | |
process = run(cmd, shell=False, capture_output=True) | |
if randint(0, 1): | |
if frequency < 800: | |
frequency = frequency + 50 | |
elif randint(0, 1): | |
frequency += 200 | |
else: | |
if frequency > 300: | |
frequency -= 100 | |
else: | |
frequency = 200 | |
s = randint(0, 2) | |
if s: | |
if seconds < 8: | |
seconds += 2 | |
else: | |
if seconds > 4: | |
seconds -= 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment