本文整理匯總了Python中pyworld.get_cheaptrick_fft_size方法的典型用法代碼示例。如果您正苦於以下問題:Python pyworld.get_cheaptrick_fft_size方法的具體用法?Python pyworld.get_cheaptrick_fft_size怎麽用?Python pyworld.get_cheaptrick_fft_size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyworld
的用法示例。
在下文中一共展示了pyworld.get_cheaptrick_fft_size方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_synthesizer
# 需要導入模塊: import pyworld [as 別名]
# 或者: from pyworld import get_cheaptrick_fft_size [as 別名]
def create_synthesizer(
self,
buffer_size: int,
number_of_pointers: int,
):
assert self._synthesizer is None
self._synthesizer = structures.WorldSynthesizer()
apidefinitions._InitializeSynthesizer(
self.out_sampling_rate, # sampling rate
self.acoustic_param.frame_period, # frame period
pyworld.get_cheaptrick_fft_size(self.out_sampling_rate), # fft size
buffer_size, # buffer size
number_of_pointers, # number of pointers
self._synthesizer,
)
示例2: __call__
# 需要導入模塊: import pyworld [as 別名]
# 或者: from pyworld import get_cheaptrick_fft_size [as 別名]
def __call__(self, data: Wave, test):
acoustic_feature = self._acoustic_feature_process(data, test=True).astype_only_float(self._dtype)
high_spectrogram = acoustic_feature.spectrogram
fftlen = pyworld.get_cheaptrick_fft_size(data.sampling_rate)
low_spectrogram = pysptk.mc2sp(
acoustic_feature.mfcc,
alpha=self._alpha,
fftlen=fftlen,
)
feature = LowHighSpectrogramFeature(
low=low_spectrogram,
high=high_spectrogram,
)
feature.validate()
return feature
示例3: __init__
# 需要導入模塊: import pyworld [as 別名]
# 或者: from pyworld import get_cheaptrick_fft_size [as 別名]
def __init__(
self,
acoustic_feature_param: AcousticFeatureParam,
out_sampling_rate: int,
buffer_size: int,
number_of_pointers: int,
):
from world4py.native import structures, apidefinitions
super().__init__(
acoustic_feature_param=acoustic_feature_param,
out_sampling_rate=out_sampling_rate,
)
self.buffer_size = buffer_size
self._synthesizer = structures.WorldSynthesizer()
apidefinitions._InitializeSynthesizer(
self.out_sampling_rate, # sampling rate
self.acoustic_feature_param.frame_period, # frame period
pyworld.get_cheaptrick_fft_size(out_sampling_rate), # fft size
buffer_size, # buffer size
number_of_pointers, # number of pointers
self._synthesizer,
)
self._before_buffer = [] # for holding memory
示例4: world_decode_spectral_envelop
# 需要導入模塊: import pyworld [as 別名]
# 或者: from pyworld import get_cheaptrick_fft_size [as 別名]
def world_decode_spectral_envelop(coded_sp, fs):
fftlen = pyworld.get_cheaptrick_fft_size(fs)
#coded_sp = coded_sp.astype(np.float32)
#coded_sp = np.ascontiguousarray(coded_sp)
decoded_sp = pyworld.decode_spectral_envelope(coded_sp, fs, fftlen)
return decoded_sp
示例5: get_sizes
# 需要導入模塊: import pyworld [as 別名]
# 或者: from pyworld import get_cheaptrick_fft_size [as 別名]
def get_sizes(sampling_rate: int, order: int):
fft_size = pyworld.get_cheaptrick_fft_size(fs=sampling_rate)
return dict(
f0=1,
spectrogram=fft_size // 2 + 1,
aperiodicity=fft_size // 2 + 1,
mfcc=order + 1,
voiced=1,
)
示例6: generate_file
# 需要導入模塊: import pyworld [as 別名]
# 或者: from pyworld import get_cheaptrick_fft_size [as 別名]
def generate_file(path):
out = Path(arguments.output_directory, path.stem + '.npy')
if out.exists() and not arguments.enable_overwrite:
return
# load wave and padding
wave_file_load_process = WaveFileLoadProcess(
sample_rate=arguments.sample_rate,
top_db=arguments.top_db,
pad_second=arguments.pad_second,
)
wave = wave_file_load_process(path, test=True)
# make acoustic feature
acoustic_feature_process = AcousticFeatureProcess(
frame_period=arguments.frame_period,
order=arguments.order,
alpha=arguments.alpha,
f0_estimating_method=arguments.f0_estimating_method,
)
feature = acoustic_feature_process(wave, test=True).astype_only_float(numpy.float32)
high_spectrogram = feature.spectrogram
fftlen = pyworld.get_cheaptrick_fft_size(arguments.sample_rate)
low_spectrogram = pysptk.mc2sp(
feature.mfcc,
alpha=arguments.alpha,
fftlen=fftlen,
)
# save
numpy.save(out.absolute(), {
'low': low_spectrogram,
'high': high_spectrogram,
})
示例7: world_decode_spectral_envelop
# 需要導入模塊: import pyworld [as 別名]
# 或者: from pyworld import get_cheaptrick_fft_size [as 別名]
def world_decode_spectral_envelop(coded_sp, fs):
fftlen = pyworld.get_cheaptrick_fft_size(fs)
# coded_sp = coded_sp.astype(np.float32)
# coded_sp = np.ascontiguousarray(coded_sp)
decoded_sp = pyworld.decode_spectral_envelope(coded_sp, fs, fftlen)
return decoded_sp
示例8: decode_spectrogram
# 需要導入模塊: import pyworld [as 別名]
# 或者: from pyworld import get_cheaptrick_fft_size [as 別名]
def decode_spectrogram(self, feature: AcousticFeature):
fftlen = pyworld.get_cheaptrick_fft_size(self.out_sampling_rate)
feature.sp = pysptk.mc2sp(
feature.mc.astype(numpy.float32),
alpha=pysptk.util.mcepalpha(self.out_sampling_rate),
fftlen=fftlen,
)
return feature
示例9: get_sizes
# 需要導入模塊: import pyworld [as 別名]
# 或者: from pyworld import get_cheaptrick_fft_size [as 別名]
def get_sizes(sampling_rate: int, order: int):
fft_size = pyworld.get_cheaptrick_fft_size(fs=sampling_rate)
return dict(
f0=1,
sp=fft_size // 2 + 1,
ap=fft_size // 2 + 1,
mc=order + 1,
mc_wop=order,
voiced=1,
)
示例10: mc2sp
# 需要導入模塊: import pyworld [as 別名]
# 或者: from pyworld import get_cheaptrick_fft_size [as 別名]
def mc2sp(mc: numpy.ndarray, sampling_rate: int, alpha: float):
return pysptk.mc2sp(
mc.astype(numpy.float64),
alpha=alpha,
fftlen=pyworld.get_cheaptrick_fft_size(sampling_rate),
)
示例11: decode_ap
# 需要導入模塊: import pyworld [as 別名]
# 或者: from pyworld import get_cheaptrick_fft_size [as 別名]
def decode_ap(ap: numpy.ndarray, sampling_rate: int):
return pyworld.decode_aperiodicity(
ap.astype(numpy.float64),
sampling_rate,
pyworld.get_cheaptrick_fft_size(sampling_rate),
)
示例12: convert_to_feature
# 需要導入模塊: import pyworld [as 別名]
# 或者: from pyworld import get_cheaptrick_fft_size [as 別名]
def convert_to_feature(self, input: AcousticFeature, out_sampling_rate: Optional[int] = None):
if out_sampling_rate is None:
out_sampling_rate = self.config.dataset.param.voice_param.sample_rate
input_feature = input
input = self._feature_normalize(input, test=True)
input = self._encode_feature(input, test=True)
pad = 128 - input.shape[1] % 128
input = numpy.pad(input, [(0, 0), (0, pad)], mode='minimum')
converter = partial(chainer.dataset.convert.concat_examples, device=self.gpu, padding=0)
inputs = converter([input])
with chainer.using_config('train', False):
out = self.model(inputs).data[0]
if self.gpu is not None:
out = chainer.cuda.to_cpu(out)
out = out[:, :-pad]
out = self._decode_feature(out, test=True)
out = AcousticFeature(
f0=out.f0,
spectrogram=out.spectrogram,
aperiodicity=out.aperiodicity,
mfcc=out.mfcc,
voiced=input_feature.voiced,
)
out = self._feature_denormalize(out, test=True)
out = AcousticFeature(
f0=out.f0,
spectrogram=out.spectrogram,
aperiodicity=input_feature.aperiodicity,
mfcc=out.mfcc,
voiced=out.voiced,
)
fftlen = pyworld.get_cheaptrick_fft_size(out_sampling_rate)
spectrogram = pysptk.mc2sp(
out.mfcc,
alpha=self._param.acoustic_feature_param.alpha,
fftlen=fftlen,
)
out = AcousticFeature(
f0=out.f0,
spectrogram=spectrogram,
aperiodicity=out.aperiodicity,
mfcc=out.mfcc,
voiced=out.voiced,
).astype(numpy.float64)
return out