Esempio n. 1
0
    def run(self, in_file):
        self.log(logging.INFO, "Starting %s" % (in_file))

        out_file = self.derive_new_file_path(in_file, self.ext)

        if file_utils.should_run(in_file, out_file):
            cmd = self.command.format(in_file=in_file, out_file=out_file)
            res = shell_run(cmd.split(" "))

            if res != 0:
                self.log(
                    logging.ERROR,
                    "Failed %s -> %s with error code %i. cmd: %s" %
                    (in_file, out_file, res, cmd))
                return

            self.log(logging.INFO, "Done %s -> %s" % (in_file, out_file))

        self.emit(out_file)
Esempio n. 2
0
    def run(self, mp3_file):
        self.log(logging.INFO, "Starting %s" % (mp3_file))

        if not mp3_file.endswith(".mp3"):
            self.log(logging.ERROR, "Failed %s. Not mp3 file" % (mp3_file))
            return

        wav_file = self.derive_new_file_path(mp3_file, "wav")

        if file_utils.should_run(mp3_file, wav_file):
            res = shell_run(["lame", "--decode", mp3_file, wav_file])

            if res != 0:
                self.log(
                    logging.ERROR, "Failed %s -> %s with lame error code %i" %
                    (mp3_file, wav_file, res))
                return

            self.log(logging.INFO, "Done %s -> %s" % (mp3_file, wav_file))

        self.emit(wav_file)
Esempio n. 3
0
    def run(self, in_file):
        self.log(logging.INFO, "Starting %s" % (in_file))

        out_file = self.derive_new_file_path(in_file, self.out_ext)

        if file_utils.should_run(in_file, out_file):
            cmd = [
                self.opensmile_exec, "-C", self.conf_file, "-I", in_file,
                self.out_flag, out_file
            ] + self.extra_flags
            res = shell_run(cmd)

            if res != 0:
                self.log(
                    logging.ERROR,
                    "Failed %s -> %s with SmileExtract error code %i. cmd: %s"
                    % (in_file, out_file, res, " ".join(cmd)))
                return

            self.log(logging.INFO, "Done %s -> %s" % (in_file, out_file))

        self.emit([out_file])
Esempio n. 4
0
    def run(self, in_file):
        self.log(logging.INFO, "Starting %s" % (in_file))

        out_file = self.derive_new_file_path(in_file, 'csv')

        if file_utils.should_run(in_file, out_file):
            cmd = [
                'praat', '--run', 'scripts/syllable_nuclei_v2.praat',
                os.path.abspath(in_file)
            ]
            res = shell_run(cmd, stdout=out_file)

            if res != 0:
                self.log(
                    logging.ERROR,
                    "Failed %s -> %s with error code %i. cmd: %s" %
                    (in_file, out_file, res, " ".join(cmd)))
                return

            self.log(logging.INFO, "Done %s -> %s" % (in_file, out_file))

        self.emit([out_file])
Esempio n. 5
0
    def run(self, wav_file):
        self.log(logging.INFO, "Starting %s" % (wav_file))

        if not wav_file.endswith(".wav"):
            self.log(logging.ERROR, "Failed %s. Not wav file" % (wav_file))
            return

        new_wav_file = self.derive_new_file_path(wav_file, "wav")

        if file_utils.should_run(wav_file, new_wav_file):
            res = shell_run(
                ["sox", wav_file, "--rate",
                 str(self.new_sr), new_wav_file])

            if res != 0:
                self.log(
                    logging.ERROR, "Failed %s -> %s with lame error code %i" %
                    (wav_file, new_wav_file, res))
                return

            self.log(logging.INFO, "Done %s -> %s" % (wav_file, new_wav_file))

        self.emit(new_wav_file)