made dec talk work again, fixed so pitch and tempo can work with random chosen, example playb, train
This commit is contained in:
parent
dc8b4badd0
commit
e29eb32a91
@ -303,8 +303,8 @@ class AudioClip():
|
||||
def __del__(self):
|
||||
self.Logger.info("~AudioClip()")
|
||||
|
||||
def Play(self, seconds = None, rubberband = None, *args):
|
||||
return self.AudioPlayer.PlayURI(self.URI, seconds, rubberband = rubberband, *args)
|
||||
def Play(self, seconds = None, rubberband = None, dec_params = None, *args):
|
||||
return self.AudioPlayer.PlayURI(self.URI, position = seconds, rubberband = rubberband, dec_params = dec_params, *args)
|
||||
|
||||
def Stop(self):
|
||||
return self.AudioPlayer.Stop()
|
||||
|
@ -561,8 +561,7 @@ class VoiceCommands(BaseCommand):
|
||||
if isinstance(Sounds, list):
|
||||
if Num and Num > 0 and Num <= len(Sounds):
|
||||
Sound = Sounds[Num - 1]
|
||||
|
||||
elif message[1]:
|
||||
elif message[1] and message[1][0].isdigit(): #first character is digit, so its not pitch or tempo
|
||||
searching = message[1].startswith('?')
|
||||
search = message[1][1:] if searching else message[1].split(" ")[0]
|
||||
Sound = None
|
||||
@ -752,7 +751,7 @@ class DECTalk(BaseCommand):
|
||||
os.unlink(TempFile.name)
|
||||
return 1
|
||||
|
||||
if AudioClip.Play(None, "-af", "volume=10dB"):
|
||||
if AudioClip.Play(dec_params = ["-af", "volume=10dB"]):
|
||||
AudioClip.AudioPlayer.AddCallback("Stop", lambda: os.unlink(TempFile.name))
|
||||
return 0
|
||||
else:
|
||||
|
@ -57,7 +57,7 @@ class FFmpegAudioPlayer():
|
||||
self.Master.Logger.debug("~FFmpegAudioPlayer()")
|
||||
self.Stop()
|
||||
|
||||
def PlayURI(self, uri, position, rubberband = None, *args):
|
||||
def PlayURI(self, uri, position, rubberband = None, dec_params = None, *args):
|
||||
if position:
|
||||
PosStr = str(datetime.timedelta(seconds = position))
|
||||
Command = ["/usr/bin/ffmpeg", "-ss", PosStr, "-i", uri, "-acodec", "pcm_s16le", "-ac", "1", "-ar", str(int(self.SampleRate)), "-f", "s16le", "-vn", *args]
|
||||
@ -65,6 +65,9 @@ class FFmpegAudioPlayer():
|
||||
Command = ["/usr/bin/ffmpeg", "-i", uri, "-acodec", "pcm_s16le", "-ac", "1", "-ar", str(int(self.SampleRate)), "-f", "s16le", "-vn", *args]
|
||||
|
||||
self.Playing = True
|
||||
if dec_params:
|
||||
Command += dec_params
|
||||
|
||||
if rubberband:
|
||||
Command += ["-filter:a"]
|
||||
rubberCommand = ""
|
||||
|
Loading…
Reference in New Issue
Block a user