我正在尝试了解代码为 VGGish 所做的事情,但我遇到了一个我不太了解的部分。在 vggish_input.py 中有这样的:
def wavfile_to_examples(wav_file):
"""Convenience wrapper around waveform_to_examples() for a common WAV format.
Args:
wav_file: String path to a file, or a file-like object. The file
is assumed to contain WAV audio data with signed 16-bit PCM samples.
Returns:
See waveform_to_examples.
"""
wav_data, sr = wav_read(wav_file)
assert wav_data.dtype == np.int16, 'Bad sample type: %r' % wav_data.dtype
samples = wav_data / 32768.0 # Convert to [-1.0, +1.0]
return waveform_to_examples(samples, sr)
32768 的常数从何而来,如何除以将数据转换为样本?
我发现它可以转换为 -1 和 +1,但不确定如何将其与 32768 连接起来。
https://stats.stackexchange.com/questions/178626/how-to-normalize-data-between-1-and-1