<jupyter_start><jupyter_text>[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](http://colab.research.google.com/github/asteroid-team/asteroid/blob/master/notebooks/04_ProcessLargeAudioFiles.ipynb)  Process large audio filesWhen running inference with a separation/enhancement model, long wav files cancause CPU freeze/GPU OOM. Asteroid provides the `LambdaOverlapAdd` module thatdecomposes the input signal in overlapping chunks, apply the desired lambda functionand re-combines the segment using overlap-add.Pair it with a pretrained model to enhance your long files !<jupyter_code>import torch

from asteroid import ConvTasNet
from asteroid.dsp.overlap_add import LambdaOverlapAdd


nnet = ConvTasNet(n_src=2)
continuous_nnet = LambdaOverlapAdd(
		nnet=nnet,  # function to apply to each segment.
		n_src=2,  # number of sources in the output of nnet
		window_size=64000,  # Size of segmenting window
		hop_size=None,  # segmentation hop size
		window="hanning",  # Type of the window (see scipy.signal.get_window
		reorder_chunks=True,  # Whether to reorder each consecutive segment.
		enable_grad=False,  # Set gradient calculation on of off (see torch.set_grad_enabled)
)

# Instantiate long wav (1min) that would OOM
wav = torch.randn(1, 1, 500000)
out_wavs = continuous_nnet.forward(wav)
# Or on GPU
continuous_nnet.cuda()
wav = wav.cuda()
out_wavs_gpu = continuous_nnet.forward(wav)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.082930200414651, 'fraction_numerical': 0.01243953006219765, 'mean_word_length': 5.6422018348623855, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '272010', 'license': 'MIT', 'n_tokens_mistral': 504, 'n_tokens_neox': 467, 'n_words': 135, 'path': 'notebooks/04_ProcessLargeAudioFiles.ipynb', 'repo_name': 'ishine/asteroid', 'size': '1447'}