set buffer to 1 second
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 8 Jul 2022 00:05:20 +0000 (02:05 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 8 Jul 2022 00:05:20 +0000 (02:05 +0200)
music_assistant/controllers/streams.py
music_assistant/helpers/audio.py

index 987a3051708ef373869cfb957e3c6d9cb17880a4..5e7b3107ec80101df63785833b739534dcea9a81 100644 (file)
@@ -349,7 +349,6 @@ class QueueStream:
             self.pcm_sample_rate,
             self.pcm_bit_depth,
             self.pcm_channels,
-            0.1,
         )
         self._runner_task: Optional[asyncio.Task] = None
         self._prev_chunk: bytes = b""
@@ -603,7 +602,6 @@ class QueueStream:
                 self.pcm_sample_rate,
                 self.pcm_bit_depth,
                 self.pcm_channels,
-                1,
             )
             # buffer size is duration of crossfade + 3 seconds
             crossfade_duration = self.queue.settings.crossfade_duration or fade_in or 1
@@ -727,8 +725,8 @@ class QueueStream:
 
             if use_crossfade:
                 # crossfade is enabled, save fadeout part to pickup for next track
-                last_part = last_part[-buf_size:]
-                remaining_bytes = last_part[:-buf_size]
+                last_part = last_part[-crossfade_size:]
+                remaining_bytes = last_part[:-crossfade_size]
                 # yield remaining bytes
                 bytes_written += len(remaining_bytes)
                 yield remaining_bytes
index 1a6ad224c2637e9c8f48da69921722dc43263f7c..6bc9d76f59dc9a05fb8470ffe713ec1969905ba5 100644 (file)
@@ -673,7 +673,7 @@ def get_chunksize(
     sample_rate: int = 44100,
     bit_depth: int = 16,
     channels: int = 2,
-    seconds: float = 1.0,
+    seconds: int = 1,
 ) -> int:
     """Get a default chunksize for given contenttype."""
     pcm_size = int(sample_rate * (bit_depth / 8) * channels * seconds)