From 7895fd772bc029c0edaa88ae64a30751d273aec9 Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Tue, 28 Dec 2021 00:25:10 -0500 Subject: [PATCH] Update: bot.py --- bot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 9d8a7fe..87b3556 100644 --- a/bot.py +++ b/bot.py @@ -1,9 +1,9 @@ import os -import subprocess import discord import sound from discord.ext import commands from main import write_config_file +from subprocess import Popen, PIPE class Bot(commands.Bot): @@ -21,6 +21,7 @@ class Bot(commands.Bot): self.sdr_process = None self.system_os_type = None + self.sdr_output_process = None # Set linux or windows self.check_os_type() @@ -126,5 +127,10 @@ class Bot(commands.Bot): # Single freq sent if self.sdr_process: self.sdr_process.terminate() + self.sdr_output_process.terminate() - self.sdr_process = subprocess.Popen(["rtl_fm", f"-M {mode} -f {freq} -g {gain} -l {squelch} -s {sample_rate} | play -t raw -r 32k -es -b 16 -c 1 -V1 -"], shell=True) + self.sdr_process = Popen(["rtl_fm", f"-M {mode} -f {freq} -g {gain} -l {squelch} -s {sample_rate}"], + stdout=PIPE) + self.sdr_output_process = Popen(["play", "-t raw -r 32k -es -b 16 -c 1 -V1 -", "rtl_fm", + f"-M {mode} -f {freq} -g {gain} -l {squelch} -s {sample_rate}"], + stdin=self.sdr_process.stdout)