示例#1
0
 def __init__(self, track_info_dict, id):
     self.length = float(track_info_dict['end'])
     self.id = id
     if self.id == '0':
         self.name = set_a_names[file_number]
     else:
         self.name = set_b_names[file_number]
     pipe.do_command(f'SelectTracks: Mode=Set Track={self.id} TrackCount=1')
     pipe.do_command(f'SetTrackStatus: Name={self.name}')
     self.data = [self.name, self.id, self.length]
示例#2
0
def add_white_noise():
    # Needs cleaing up
    if track1.length < track2.length:
        l_track = track2
    else:
        l_track = track1

    import_track(white_noise_path)
    white_noise = Track(get_track_data(2), '2')
    trim = white_noise.length - (l_track.length + 2)
    pipe.do_command(
        f'Select: Start="0" End="{trim}" Track={white_noise.id} Mode="Set" RelativeTo="ProjectEnd"'
    )
    pipe.do_command('Delete:')
示例#3
0
def get_track_data(track_number):
    track_info = json.loads(
        pipe.do_command("GetInfo: Type=Tracks").replace(
            "BatchCommand finished: OK", ''))
    try:
        t_info = track_info.pop(track_number)
    except IndexError():
        print("ERROR: That track does not exist.")
    return t_info
示例#4
0
def export_files():
    pipe.do_command(
        f'SaveProject2: Filename="{cwd}\\exported_projects\\{track1.name}_&_{track2.name}_project.aup"'
    )
    pipe.do_command('SelectAll:')
    pipe.do_command(
        f'Export2: Filename="{cwd}\\exported_files\\{track1.name}_&_{track2.name}.wav"'
    )
    print(f"File {track1.name}_&_{track2.name} exported successfully.")
示例#5
0
def cleanup():
    pipe.do_command('SelectAll:')
    pipe.do_command('RemoveTracks')
示例#6
0
def add_silence(seconds, tracks_list):
    for track in tracks_list:
        # Adds silence at start and end by copy/repeat/silence a slice of audio.
        pipe.do_command(
            f'Select: Start="0" End="{seconds}" Track={track.id} Mode="Set" RelativeTo="ProjectStart"'
        )
        pipe.do_command('Repeat:Count="1"')
        pipe.do_command(
            f'SelectTime: Start="0" End="{seconds}" RelativeTo="SelectionStart"'
        )
        pipe.do_command('Silence:')

        pipe.do_command(
            f'Select: Start="0" End="{seconds}" Track={track.id} Mode="Set" RelativeTo="ProjectEnd"'
        )
        pipe.do_command('Repeat:Count="1"')
        pipe.do_command(
            f'SelectTime: Start="0" End="{seconds}" RelativeTo="ProjectEnd"')
        pipe.do_command('Silence:')
示例#7
0
def trunc_silence():
    pipe.do_command('SelectAll:')
    pipe.do_command(
        'TruncateSilence: Minimum=0.2 Truncate=0.0 Independent=True')
示例#8
0
def import_track(file):
    pipe.do_command(f'Import2: Filename="{file}"')