How to use the audiofile.AnalysedAudioFile function in audiofile

To help you get started, we’ve selected a few audiofile 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 Pezz89 / PySoundConcat / src / sppysound / database.py View on Github external
datapath = os.path.join(subdir_paths['data'], 'analysis_data.hdf5')
        try:
            self.data = h5py.File(datapath, 'a')
        except IOError:
            raise IOError("Unable to create/append to file: {0}\nThis may be "
                          "due to another instance of this program running or a "
                          "corrupted HDF5 file.\n Make sure this is the only "
                          "running instance and regenerate HDF5 if "
                          "neccesary.".format(datapath))
        self.analysed_audio = []

        for item in self.audio_file_list:
            filepath = os.path.join(subdir_paths['audio'], os.path.basename(item))
            # if there is no wav file then skip
            try:
                with AnalysedAudioFile(
                    filepath,
                    'r',
                    data_file=self.data,
                    analyses=self.analysis_list,
                    name=os.path.basename(item),
                    db_dir=self.db_dir,
                    reanalyse=reanalyse,
                    config=self.config
                ) as AAF:
                    AAF.create_analysis()
                    self.analysed_audio.append(AAF)
            except IOError as err:
                # Skip any audio file objects that can't be analysed
                self.logger.warning("File cannot be analysed: {0}\nReason: {1}\n"
                      "Skipping...".format(item, err))
                exc_type, exc_value, exc_traceback = sys.exc_info()

audiofile

Fast reading of all kind of audio files

MIT
Latest version published 2 months ago

Package Health Score

66 / 100
Full package analysis