How to use the av.AudioFrame.from_ndarray function in av

To help you get started, we’ve selected a few av examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mikeboers / PyAV / tests / test_audioframe.py View on Github external
def test_ndarray_dbl(self):
        layouts = [
            ('dbl', 'mono', '
github mikeboers / PyAV / tests / test_audioframe.py View on Github external
def test_ndarray_s16(self):
        layouts = [
            ('s16', 'mono', '
github mikeboers / PyAV / tests / test_audioframe.py View on Github external
def test_ndarray_u8(self):
        layouts = [
            ('u8', 'mono', 'u1', (1, 160)),
            ('u8', 'stereo', 'u1', (1, 320)),
            ('u8p', 'mono', 'u1', (1, 160)),
            ('u8p', 'stereo', 'u1', (2, 160)),
        ]
        for format, layout, dtype, size in layouts:
            array = numpy.random.randint(0, 256, size=size, dtype=dtype)
            frame = AudioFrame.from_ndarray(array, format=format, layout=layout)
            self.assertEqual(frame.format.name, format)
            self.assertEqual(frame.layout.name, layout)
            self.assertEqual(frame.samples, 160)
            self.assertTrue((frame.to_ndarray() == array).all())
github mikeboers / PyAV / tests / test_audioframe.py View on Github external
def test_ndarray_flt(self):
        layouts = [
            ('flt', 'mono', '
github mikeboers / PyAV / tests / test_audioframe.py View on Github external
def test_ndarray_s32(self):
        layouts = [
            ('s32', 'mono', '