Ejemplo n.º 1
0
 def test_encode_large_ogg(self):
     sr = SR11025()
     synth = SilenceSynthesizer(sr)
     samples = synth.synthesize(Seconds(190))
     raw = samples.encode(fmt='OGG', subtype='VORBIS')
     # prior to this test, the line above caused a segfault, so the assertion
     # below is fairly worthless, and mostly a formality
     self.assertIsNotNone(raw)
Ejemplo n.º 2
0
 def test_encode_large_ogg(self):
     sr = SR11025()
     synth = SilenceSynthesizer(sr)
     samples = synth.synthesize(Seconds(190))
     raw = samples.encode(fmt='OGG', subtype='VORBIS')
     # prior to this test, the line above caused a segfault, so the assertion
     # below is fairly worthless, and mostly a formality
     self.assertIsNotNone(raw)
Ejemplo n.º 3
0
    def test_can_do_multithreaded_resampling(self):
        synth = SilenceSynthesizer(SR44100())
        audio = [synth.synthesize(Seconds(5)) for _ in xrange(10)]
        pool = ThreadPool(4)

        def x(samples):
            rs = Resample(int(SR44100()), int(SR11025()))
            return rs(samples, end_of_input=True)

        resampled = pool.map(x, audio)
        self.assertEqual(10, len(resampled))
Ejemplo n.º 4
0
    def test_can_do_multithreaded_resampling(self):
        synth = SilenceSynthesizer(SR44100())
        audio = [synth.synthesize(Seconds(5)) for _ in range(10)]
        pool = ThreadPool(4)

        def x(samples):
            rs = Resample(int(SR44100()), int(SR11025()))
            return rs(samples, end_of_input=True)

        resampled = pool.map(x, audio)
        self.assertEqual(10, len(resampled))
Ejemplo n.º 5
0
 def test_correct_output_with_stereo(self):
     synth = SilenceSynthesizer(SR44100())
     samples = synth.synthesize(Seconds(1)).stereo
     rs = Resample(int(samples.samplerate), int(SR11025()), nchannels=2)
     resampled = rs(samples, end_of_input=True)
     self.assertEqual((11025, 2), resampled.shape)
Ejemplo n.º 6
0
 def test_correct_output_with_stereo(self):
     synth = SilenceSynthesizer(SR44100())
     samples = synth.synthesize(Seconds(1)).stereo
     rs = Resample(int(samples.samplerate), int(SR11025()), nchannels=2)
     resampled = rs(samples, end_of_input=True)
     self.assertEqual((11025, 2), resampled.shape)