adding support for pitch and tempo commands on torchlight through rubberband

This commit is contained in:
2024-08-05 16:28:51 +02:00
parent f420bfc7ed
commit dc8b4badd0
3 changed files with 697 additions and 670 deletions
@@ -57,18 +57,24 @@ class FFmpegAudioPlayer():
self.Master.Logger.debug("~FFmpegAudioPlayer()")
self.Stop()
def PlayURI(self, uri, position, *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, "-"]
else:
Command = ["/usr/bin/ffmpeg", "-i", uri, "-acodec", "pcm_s16le", "-ac", "1", "-ar", str(int(self.SampleRate)), "-f", "s16le", "-vn", *args, "-"]
def PlayURI(self, uri, position, rubberband = 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]
else:
Command = ["/usr/bin/ffmpeg", "-i", uri, "-acodec", "pcm_s16le", "-ac", "1", "-ar", str(int(self.SampleRate)), "-f", "s16le", "-vn", *args]
print(Command)
self.Playing = True
asyncio.ensure_future(self._stream_subprocess(Command))
return True
self.Playing = True
if rubberband:
Command += ["-filter:a"]
rubberCommand = ""
for rubber in rubberband:
rubberCommand += rubber + ", "
rubberCommand = rubberCommand[:-2]
Command += [rubberCommand]
Command += ["-"]
asyncio.ensure_future(self._stream_subprocess(Command))
return True
def Stop(self, force = True):
if not self.Playing: