def augment_note_sequence(ns, stretch_factor, transpose_amount):
    'Augment a NoteSequence by time stretch and pitch transposition.'
    augmented_ns = sequences_lib.stretch_note_sequence(ns, stretch_factor, in_place=False)
    try:
        (_, num_deleted_notes) = sequences_lib.transpose_note_sequence(augmented_ns, transpose_amount, min_allowed_pitch=MIN_PITCH, max_allowed_pitch=MAX_PITCH, in_place=True)
    except chord_symbols_lib.ChordSymbolError:
        raise datagen_beam.DataAugmentationError('Transposition of chord symbol(s) failed.')
    if num_deleted_notes:
        raise datagen_beam.DataAugmentationError('Transposition caused out-of-range pitch(es).')
    return augmented_ns
Augment a NoteSequence by time stretch and pitch transposition.
def augment_note_sequence(ns, stretch_factor, transpose_amount):
    
    augmented_ns = sequences_lib.stretch_note_sequence(ns, stretch_factor, in_place=False)
    try:
        (_, num_deleted_notes) = sequences_lib.transpose_note_sequence(augmented_ns, transpose_amount, min_allowed_pitch=MIN_PITCH, max_allowed_pitch=MAX_PITCH, in_place=True)
    except chord_symbols_lib.ChordSymbolError:
        raise datagen_beam.DataAugmentationError('Transposition of chord symbol(s) failed.')
    if num_deleted_notes:
        raise datagen_beam.DataAugmentationError('Transposition caused out-of-range pitch(es).')
    return augmented_ns