How to use the av.container.open 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 haoxintong / gluon-audio / examples / speaker_recognition / deploy.py View on Github external
def load_audio(self, path):
        """This require an audio input longer than 2.24s."""
        fin = container.open(path)
        audio_frames = [frame for frame in fin.decode()]
        audios = list(map(lambda x: np.frombuffer(x.planes[0], self._format_dtypes[x.format.name],
                                                  x.samples), audio_frames))
        audio = np.concatenate(audios, axis=0)
        return nd.array(np.expand_dims(audio[:self._audio_length], axis=0))
github haoxintong / gluon-audio / gluonar / data / dataset.py View on Github external
def _load(path):
        fin = container.open(path)
        audio_frames = [frame for frame in fin.decode()]
        audios = list(map(lambda x: np.frombuffer(x.planes[0], format_dtypes[x.format.name],
                                                  x.samples), audio_frames))
        audio = np.concatenate(audios, axis=0)
        return nd.array(audio)