marl / pysox

Python wrapper around sox.
BSD 3-Clause "New" or "Revised" License
517 stars 80 forks source link

For this stretch factor, the stretch effect has better performance. #157

Open SeongYeonPark opened 1 year ago

SeongYeonPark commented 1 year ago

When running the below code,

from scipy.io.wavfile import read
import sox
import numpy as np

path = 'input.wav'
sr, wav = read(path)
tfm = sox.Transformer()
tfm.set_globals(verbosity=0)
stretch_ratio = np.random.normal(1.05,0.125)
tfm.tempo(stretch_ratio, audio_type='s')
wav = tfm.build_array(input_array=wav, sample_rate_in=sr)

I get a warning that says 'For this stretch factor, the stretch effect has better performance.'.

I want to turn this off, but it seems that tfm.set_globals(verbosity=0) does nothing.

What can I do to turn that warning off?

SeongYeonPark commented 1 year ago

To add on, the above code sometimes does and sometimes doesn't give the warning, depending on the sampled stretch ratio. However, I am not using that code itself, but rather using sox in a pytorch dataloader which loads audio and stretches it randomly. As a result, the warning is pretty much spamming the terminal output.