Exemplo n.º 1
0
def multiple_tracks(tracks):
    """Mixes multiple tracks into single one

    Tracks will be mixed with either of these methods, chosen randomly:
    - mix_segments
    - overlay
    """
    slice_length = random.choice(config.MULTIPLE_TRACKS_LENGTH)
    return audio.mix_segments(tracks, slice_length)
Exemplo n.º 2
0
def panzerfaust(track):
    """Mixes track with one of the panzer tracks"""
    if not _PANZER_TRACKS:
        return track
    panzer_track = random.choice(_PANZER_TRACKS)
    # Cut panzer track to track's length
    track_length = len(track)
    # Fix: not all panzer tracks have proper length!
    while len(panzer_track) < track_length:
        panzer_track = panzer_track + panzer_track
    panzer_track = panzer_track[:track_length]
    # Lower volume of panzer track
    panzer_track -= config.PANZER_VOLUME_DECREASE
    slice_length = random.choice(config.SLICE_LENGTH)
    return audio.mix_segments([track, panzer_track], slice_length)