testaudiomixer.py
1 """ 2 AudioMixer module tests 3 """ 4 5 import unittest 6 7 import numpy as np 8 9 from txtai.pipeline import AudioMixer 10 11 12 class TestAudioStream(unittest.TestCase): 13 """ 14 AudioStream tests. 15 """ 16 17 def testAudioStream(self): 18 """ 19 Test mixing audio streams 20 """ 21 22 audio1 = np.random.rand(2, 5000), 100 23 audio2 = np.random.rand(2, 5000), 100 24 25 mixer = AudioMixer() 26 audio, rate = mixer((audio1, audio2)) 27 28 self.assertEqual(audio.shape, (2, 5000)) 29 self.assertEqual(rate, 100)