polymath icon indicating copy to clipboard operation
polymath copied to clipboard

Quantized files are mono

Open eljeff opened this issue 2 years ago • 1 comments

  1. Add file to library python3.9 polymath.py -a btQYekwDU0U
  2. Quantize all files to bpm python3.9 polymath.py -q all -t 80
  3. Look at files in ./processed - all are mono

I'm on m1 macOS Monterey

I tried changing lines 338/339

# load audio file
    y, sr = librosa.load(vid.audio, sr=None)

to...

# load audio file
    y, sr = librosa.load(vid.audio, sr=None, mono=False)

...but then I get the following error TypeError: type numpy.ndarray doesn't define __round__ method

Thanks

eljeff avatar Feb 21 '23 14:02 eljeff

I think soundfile.write() expects the axes to be swapped:

            y, sr = librosa.load(path=vid, sr=44100, mono=False)
            path = os.path.join(os.getcwd(), 'library', audioid+'.wav')
            sf.write(path, np.swapaxes(y,0,1), 44100)

I see you can pass in the target sample rate to librosa.load so you may not need the additional resample step.

sehugg avatar Feb 28 '23 19:02 sehugg