登录
本论坛汇聚了来自世界各地的人们,因此大家使用英文交流。

sample tuning is wrong in wave file import/export

分类:错误与安装
  • SC 69 0
    消息来自 S. Christian Collins,发表于
    In the WAV file "smpl" sub-chunk, there are two fields that store sample tuning information:
    • dwMIDIUnityNote - This is the MIDI note number or "root key" for the sample.
    • dwMIDIPitchFraction - Specifies the fraction of a semitone up from the sample's MIDI note. Only positive values can be stored in this field, so the note can only be tuned sharp. If you want to represent a negative fine tuning, you must add 1 to the root key (which lowers the sample playback pitch by 1 semitone) and add 100 to the negative tuning value to achieve the correct positive value. This conversion can be reversed on WAV import for any fine tuning value larger than 50, effectively providing a fine tune range of -49 to 50 cents for each sample.

    Polyphone reads and writes these fields when importing and exporting WAV files. However, Polyphone appears to be doing this in a somewhat inverted manner, assuming I am not misunderstanding how this is supposed to work.

    Steps to reproduce:
    1. Choose or edit a sample in Polyphone to specify a root key and fine tune amount. Make sure this is done at the sample level, not instrument level. For this example, I have chosen MIDI note 70 and a fine tune of +24 cents.
    2. Export the WAV file.
    3. Open the exported WAV file in a hex editor.

    Result: the sampler metadata in the WAV file shows MIDI note 69 and fine tune 76, but it should be MIDI note 70 and fine tune 24. The value of 76 appears to be the result of adding 100 to -24, which should not happen in this case.

    Note: in the hex editor, the MIDI note is stored at offset 003A (hex value: 45, converted to decimal: 69), and the fine tuning is a little endian int at 003E (hex value: C28F5C29, converted to decimal: 3264175145). So to convert to cents: 3264175145 / 2147483648 * 50 = 76.

    If I repeat the same steps above, but change the tuning to -24 cents, the exported WAV file shows MIDI note 70 and fine tune 24, but it should be MIDI note 71 and fine tune 76 (adding 100 to -24 is correct here).
  • 429 1
    消息来自 Davy,发表于
    The value displayed at the sample level is the correction that will be applied to the sample so that it matches exactly the root key.
    This is thus the opposite of what is written in a wav file. If a sample is a bit sharp, the description in the wav file shows a positive value but we need to apply a negative correction to compensate.

    Your description is thus correct and everything is fine

登录或注册后即可参与讨论。

Polyphone 需要您!

Polyphone 是免费的,但其网站和开发都会产生费用。一笔小小的捐赠就能帮上大忙。

捐赠
学习基础知识 试试教程
返回
顶部