Esempio n. 1
0
 def __init__(self, AnalysedAudioFile, atkpath, config=None):
     self.logger = logging.getLogger(__name__ + '.AttackAnalysis')
     self.AnalysedAudioFile = AnalysedAudioFile
     self.attackpath = atkpath
     self.attack_start = None
     self.attack_end = None
     self.attack_size = None
     self.logattacktime = None
     # Check if analysis file already exists.
     # TODO: check if RMS has changed, if it has then new values will need
     # to be generated even if a file already exists.
     if not self.attackpath:
         if not self.AnalysedAudioFile.db_dir:
             raise IOError("Analysed Audio object must have an atk file"
                           " path or be part of a database")
         self.attackpath = os.path.join(
             self.AnalysedAudioFile.db_dir, "atk",
             self.AnalysedAudioFile.name + ".lab")
     if self.AnalysedAudioFile.force_analysis:
         pathops.delete_if_exists(self.attackpath)
         self.attackpath = self.create_attack_analysis()
     else:
         try:
             # If it does then get values from file
             self.get_attack_from_file()
         except IOError:
             # Otherwise, generate new values
             self.create_attack_analysis()
Esempio n. 2
0
 def __init__(self, AnalysedAudioFile, atkpath, config=None):
     self.logger = logging.getLogger(__name__ + '.AttackAnalysis')
     self.AnalysedAudioFile = AnalysedAudioFile
     self.attackpath = atkpath
     self.attack_start = None
     self.attack_end = None
     self.attack_size = None
     self.logattacktime = None
     # Check if analysis file already exists.
     # TODO: check if RMS has changed, if it has then new values will need
     # to be generated even if a file already exists.
     if not self.attackpath:
         if not self.AnalysedAudioFile.db_dir:
             raise IOError("Analysed Audio object must have an atk file"
                           " path or be part of a database")
         self.attackpath = os.path.join(
             self.AnalysedAudioFile.db_dir,
             "atk",
             self.AnalysedAudioFile.name +
             ".lab")
     if self.AnalysedAudioFile.force_analysis:
         pathops.delete_if_exists(self.attackpath)
         self.attackpath = self.create_attack_analysis()
     else:
         try:
             # If it does then get values from file
             self.get_attack_from_file()
         except IOError:
             # Otherwise, generate new values
             self.create_attack_analysis()
Esempio n. 3
0
    def tearDown(self):
        """
        Delete anything that is left over once tests are complete.

        For example, remove all temporary test audio files generated during the
        tests.
        """
        pathops.delete_if_exists("./.test_db")
Esempio n. 4
0
    def tearDown(self):
        """
        Delete anything that is left over once tests are complete.

        For example, remove all temporary test audio files generated during the
        tests.
        """
        pathops.delete_if_exists("./.test_db")
Esempio n. 5
0
    def tearDown(self):
        """
        Delete anything that is left over once tests are complete.

        For example: delete temporary test audio files generated during the
        tests.
        """
        del self.TestAudio
        pathops.delete_if_exists("./.TestAudio.wav")
Esempio n. 6
0
    def tearDown(self):
        """
        Delete anything that is left over once tests are complete.

        For example: delete temporary test audio files generated during the
        tests.
        """
        del self.TestAudio
        pathops.delete_if_exists("./.TestAudio.wav")