<jupyter_start><jupyter_text>ResampleReample ShipsEar into 32000, so we can train with deep ship<jupyter_code>print(torch.__version__)
print(torchaudio.__version__)
# ShipsEar Dataset
path = Path('shipsEar_AUDIOS/')
dest = Path('shipsEarRe/')
fns = get_files(path,'.wav')
fns
### Pytorch transform kernel
sample_rate = 44100
resample_rate = 32000

krn  = Resample(
    sample_rate,
    resample_rate,
    lowpass_filter_width=64,
    rolloff=0.9475937167399596,
    resampling_method="kaiser_window",
    beta=14.769656459379492)
def convert(p: Path):
    waveform,sr = torchaudio.load(p)
    
    if sr != sample_rate: return
    print(p)
    ### kaiser_best
    resampled_waveform = krn(waveform)
    torchaudio.save(dest/p, resampled_waveform, resample_rate)

Path(PurePath(dest/fns[0]).parent).mkdir(exist_ok=True)
for p in fns: 
    convert(p)<jupyter_output>shipsEar_AUDIOS/38__19_07_13_Arroios_Sale_2entran.wav
shipsEar_AUDIOS/41__19_07_13_MiñoUno_Entra.wav
shipsEar_AUDIOS/39__19_07_13_lanchaMotora_Entra.wav
shipsEar_AUDIOS/43__19_07_13_PirataDeCies_Llega_Interf.wav
shipsEar_AUDIOS/42__19_07_13_PirataCies_Sale.wav
shipsEar_AUDIOS/45__19_07_13_yate_Sale.wav
shipsEar_AUDIOS/40__19_07_13_MarDeCangas_Llega_Interf.wav
{'fraction_non_alphanumeric': 0.09061224489795919, 'fraction_numerical': 0.08897959183673469, 'mean_word_length': 6.475609756097561, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, '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': '657145', 'license': 'MIT', 'n_tokens_mistral': 605, 'n_tokens_neox': 539, 'n_words': 64, 'path': 'Experiments/6. Resample noise.ipynb', 'repo_name': 'voibit/dat255', 'size': '1225'}