示例#1
0
    def start_job(self, get_instrument_files):
        total_steps = 0

        old_files = glob.glob(self.files.get_ly_extra("*.wav"))
        #print old_files
        dirs.ViviDirs.delete_files(old_files)

        # mixing needs to happen after this finishes
        self.num_audio_files = len(self.files.notes_all)
        for i in range(self.num_audio_files):
            job = state.Job(vivi_defines.TASK_RENDER_AUDIO)
            self.files.set_notes_index(i)
            job.main_files = self.files

            # remove more old files
            old_files = glob.glob(self.files.get_notes_last("") + "*.actions")
            dirs.ViviDirs.delete_files(old_files)

            job.alterations_filename = job.main_files.get_notes_ext(
                ".alterations")
            if not os.path.exists(job.alterations_filename):
                pncs = get_pncs_from_notes(job.main_files.get_notes())
                generate_alterations(job.alterations_filename, pncs)

            job.notes_filename = self.files.get_notes()
            job.ly_basename = self.files.get_ly_extra("")
            inst_name, total_num, inst_num = instrument_numbers.instrument_name_from_filename(
                job.notes_filename)
            #print "performer feeder total_num:", total_num, inst_num
            if total_num >= 7:
                inst_type = 2
            elif total_num >= 5:
                inst_type = 1
            else:
                inst_type = 0
            #print "performer feeder:", inst_name, inst_type, inst_num
            job.inst_type = inst_type
            job.inst_num = inst_num
            inst_files = get_instrument_files(total_num)

            if inst_type == 0:
                job.reduced_inst_num = inst_num % 5
            elif inst_type == 1:
                job.reduced_inst_num = inst_num % 2
            elif inst_type == 2:
                job.reduced_inst_num = inst_num % 3
            #print inst_num, job.reduced_inst_num
            performer_prep = performer.Performer(inst_type,
                                                 job.reduced_inst_num,
                                                 inst_files)
            performer_prep.load_file(job.notes_filename)
            job.files = inst_files
            job.notes = list(performer_prep.style.notes)
            job.audio_filename = performer_prep.audio_filename
            job.mpl_filenames = []
            for st in range(4):
                mpl_filename = inst_files.get_mpl_filename(st)
                job.mpl_filenames.append(mpl_filename)
            total_steps += shared.thread_pool.add_task(job)
        return total_steps
示例#2
0
    def start_job(self, get_instrument_files):
        total_steps = 0

        old_files = glob.glob(self.files.get_ly_extra("*.wav"))
        #print old_files
        dirs.ViviDirs.delete_files(old_files)

        # mixing needs to happen after this finishes
        self.num_audio_files = len(self.files.notes_all)
        for i in range(self.num_audio_files):
            job = state.Job(vivi_defines.TASK_RENDER_AUDIO)
            self.files.set_notes_index(i)
            job.main_files = self.files

            # remove more old files
            old_files = glob.glob(self.files.get_notes_last("") + "*.actions")
            dirs.ViviDirs.delete_files(old_files)

            job.alterations_filename = job.main_files.get_notes_ext(
                ".alterations")
            if not os.path.exists(job.alterations_filename):
                pncs = get_pncs_from_notes(job.main_files.get_notes())
                generate_alterations(job.alterations_filename, pncs)

            job.notes_filename = self.files.get_notes()
            job.ly_basename = self.files.get_ly_extra("")
            inst_name, total_num, inst_num = instrument_numbers.instrument_name_from_filename(job.notes_filename)
            #print "performer feeder total_num:", total_num, inst_num
            if total_num >= 7:
                inst_type = 2
            elif total_num >= 5:
                inst_type = 1
            else:
                inst_type = 0
            #print "performer feeder:", inst_name, inst_type, inst_num
            job.inst_type = inst_type
            job.inst_num = inst_num
            inst_files = get_instrument_files(total_num)

            if inst_type == 0:
                job.reduced_inst_num = inst_num % 5
            elif inst_type == 1:
                job.reduced_inst_num = inst_num % 2
            elif inst_type == 2:
                job.reduced_inst_num = inst_num % 3
            #print inst_num, job.reduced_inst_num
            performer_prep = performer.Performer(inst_type,
                job.reduced_inst_num, inst_files)
            performer_prep.load_file(job.notes_filename)
            job.files = inst_files
            job.notes = list(performer_prep.style.notes)
            job.audio_filename = performer_prep.audio_filename
            job.mpl_filenames = []
            for st in range(4):
                mpl_filename = inst_files.get_mpl_filename(st)
                job.mpl_filenames.append(mpl_filename)
            total_steps += shared.thread_pool.add_task(job)
        return total_steps
示例#3
0
 def get_zoom(self):
     start, dur = self.get_zoom_seconds()
     st = self.examine_note.note_st
     dyn = int(round(self.examine_note.note_dyn))
     a, b, c = instrument_numbers.instrument_name_from_filename(
         self.filename)
     dist_inst_num = b
     filename = self.examine_note.make_zoom_file(start, dur, self.files)
     return st, dyn, filename, dist_inst_num
示例#4
0
def start_job(files, get_instrument_files):
    ### clear out old files
    basename = files.get_ly_basename()
    old_files = glob.glob(os.path.join(files.hills_dir, basename) + "*")
    files.delete_files(old_files)

    total_steps = 0
    num_audio_files = len(files.notes_all)
    for i in range(num_audio_files):
        job = state.Job(vivi_defines.TASK_HILL_CLIMBING)
        files.set_notes_index(i)
        job.main_files = files
        job.notes_filename = files.get_notes()
        inst_name, total_num, inst_num = instrument_numbers.instrument_name_from_filename(
            job.notes_filename)
        print inst_name, total_num, inst_num
        job.instrument_number = inst_num
        #job.distinct_instrument_number = dist_inst_num
        if total_num >= 7:
            inst_type = 2
        elif total_num >= 5:
            inst_type = 1
        else:
            inst_type = 0
        job.inst_type = inst_type
        job.inst_num = inst_num
        inst_files = get_instrument_files(total_num)

        if inst_type == 0:
            job.reduced_inst_num = inst_num % 5
        elif inst_type == 1:
            job.reduced_inst_num = inst_num % 2
        elif inst_type == 2:
            job.reduced_inst_num = inst_num % 3

        job.alterations_filename = job.main_files.get_notes_ext(".alterations")

        performer_prep = performer.Performer(inst_type, job.reduced_inst_num,
                                             inst_files)
        performer_prep.load_file(job.notes_filename)
        job.files = inst_files
        job.notes = list(performer_prep.style.notes)
        job.audio_filename = performer_prep.audio_filename

        job.mpl_filenames = []
        for st in range(4):
            mpl_filename = inst_files.get_mpl_filename(st)
            job.mpl_filenames.append(mpl_filename)
        total_steps += go(job)


#        total_steps += shared.thread_pool.add_task(job)
    return total_steps
示例#5
0
def start_job(files, get_instrument_files):
    ### clear out old files
    basename = files.get_ly_basename()
    old_files = glob.glob(os.path.join(files.hills_dir,
            basename) + "*")
    files.delete_files(old_files)

    total_steps = 0
    num_audio_files = len(files.notes_all)
    for i in range(num_audio_files):
        job = state.Job(vivi_defines.TASK_HILL_CLIMBING)
        files.set_notes_index(i)
        job.main_files = files
        job.notes_filename = files.get_notes()
        inst_name, total_num, inst_num = instrument_numbers.instrument_name_from_filename(job.notes_filename)
        print inst_name, total_num, inst_num
        job.instrument_number = inst_num
        #job.distinct_instrument_number = dist_inst_num
        if total_num >= 7:
            inst_type = 2
        elif total_num >= 5:
            inst_type = 1
        else:
            inst_type = 0
        job.inst_type = inst_type
        job.inst_num = inst_num
        inst_files = get_instrument_files(total_num)

        if inst_type == 0:
            job.reduced_inst_num = inst_num % 5
        elif inst_type == 1:
            job.reduced_inst_num = inst_num % 2
        elif inst_type == 2:
            job.reduced_inst_num = inst_num % 3

        job.alterations_filename = job.main_files.get_notes_ext(
            ".alterations")

        performer_prep = performer.Performer(inst_type,
            job.reduced_inst_num,
            inst_files)
        performer_prep.load_file(job.notes_filename)
        job.files = inst_files
        job.notes = list(performer_prep.style.notes)
        job.audio_filename = performer_prep.audio_filename

        job.mpl_filenames = []
        for st in range(4):
            mpl_filename = inst_files.get_mpl_filename(st)
            job.mpl_filenames.append(mpl_filename)
        total_steps += go(job)
#        total_steps += shared.thread_pool.add_task(job)
    return total_steps 
示例#6
0
def start_job(files, get_instrument_files):
    total_steps = 0
    num_audio_files = len(files.notes_all)
    for i in range(num_audio_files):
        job = state.Job(vivi_defines.TASK_MIX_HILL)
        files.set_notes_index(i)
        job.main_files = files
        job.notes_filename = files.get_notes()

        # get alterations
        basename = files.notes  # TODO: fix bad integration
        old_files = glob.glob(os.path.join(files.hills_dir, basename) + "*")
        old_files = filter(lambda x: "forces.wav" not in x, old_files)
        old_files = filter(lambda x: "-s0.wav" not in x, old_files)
        old_files = filter(lambda x: "-s1.wav" not in x, old_files)
        old_files = filter(lambda x: "-s2.wav" not in x, old_files)
        old_files = filter(lambda x: "-s3.wav" not in x, old_files)
        job.alterations = set()
        job.count = 0
        for filename in old_files:
            if "alterations" in filename:
                continue
            relevant = filename.split("alter_")[1]
            split = relevant.split("_hill_")
            alter_text = split[0]
            job.alterations.add(float(alter_text))
            number = int(split[1].split(".")[0])
            if job.count < number:
                job.count = number

        inst_name, dist_inst_num, inst_num = instrument_numbers.instrument_name_from_filename(
            job.notes_filename)
        job.instrument_number = inst_num
        job.distinct_instrument_number = dist_inst_num
        inst_files = get_instrument_files(dist_inst_num)

        job.alterations_filename = job.main_files.get_notes_ext(".alterations")

        job.files = inst_files
        job.audio_filename = job.main_files.get_notes_ext("")

        total_steps += shared.thread_pool.add_task(job)
    return total_steps
示例#7
0
def start_job(files, get_instrument_files):
    total_steps = 0
    num_audio_files = len(files.notes_all)
    for i in range(num_audio_files):
        job = state.Job(vivi_defines.TASK_MIX_HILL)
        files.set_notes_index(i)
        job.main_files = files
        job.notes_filename = files.get_notes()

        # get alterations
        basename = files.notes  # TODO: fix bad integration
        old_files = glob.glob(os.path.join(files.hills_dir, basename) + "*")
        old_files = filter(lambda x: "forces.wav" not in x, old_files)
        old_files = filter(lambda x: "-s0.wav" not in x, old_files)
        old_files = filter(lambda x: "-s1.wav" not in x, old_files)
        old_files = filter(lambda x: "-s2.wav" not in x, old_files)
        old_files = filter(lambda x: "-s3.wav" not in x, old_files)
        job.alterations = set()
        job.count = 0
        for filename in old_files:
            if "alterations" in filename:
                continue
            relevant = filename.split("alter_")[1]
            split = relevant.split("_hill_")
            alter_text = split[0]
            job.alterations.add(float(alter_text))
            number = int(split[1].split(".")[0])
            if job.count < number:
                job.count = number

        inst_name, dist_inst_num, inst_num = instrument_numbers.instrument_name_from_filename(job.notes_filename)
        job.instrument_number = inst_num
        job.distinct_instrument_number = dist_inst_num
        inst_files = get_instrument_files(dist_inst_num)

        job.alterations_filename = job.main_files.get_notes_ext(".alterations")

        job.files = inst_files
        job.audio_filename = job.main_files.get_notes_ext("")

        total_steps += shared.thread_pool.add_task(job)
    return total_steps