KentoNishi / torch-time-stretch

Time-stretch audio clips quickly with PyTorch (CUDA supported)! Additional utilities for searching efficient transformations are included.
https://kentonishi.github.io/torch-time-stretch/
MIT License
36 stars 3 forks source link

Does it with mono-channel wav files? #3

Open ti3x opened 1 year ago

ti3x commented 1 year ago

my audio clip is in mono 16khz audio, [ 0 0 0 ... 63 100 127], so it will throw

---> 15 down = time_stretch(sample, Fraction(2, 1), SAMPLE_RATE)
     16 wavfile.write(
     17     "./stretched_down_2.wav",
     18     SAMPLE_RATE,
     19     np.swapaxes(down.cpu()[0].numpy(), 0, 0).astype(dtype),
     20 )

File /opt/conda/envs/classify-audio/lib/python3.9/site-packages/torch_time_stretch/main.py:108, in time_stretch(input, stretch, sample_rate, n_fft, hop_length)
    106 if not hop_length:
    107     hop_length = n_fft // 32
--> 108 batch_size, channels, samples = input.shape
    109 # resampler = T.Resample(sample_rate, int(sample_rate / stretch)).to(input.device)
    110 output = input

ValueError: not enough values to unpack (expected 3, got 2)
arnavmehta7 commented 1 year ago

idk same error