Re: [whatwg] VIDEO and pitchAdjustment

On Wed, Mar 2, 2016 at 1:09 PM, Garrett Smith <dhtmlkitchen@gmail.com> wrote:
> On Wed, Mar 2, 2016 at 2:36 AM, Philip Jägenstedt <philipj@opera.com> wrote:
>> On Wed, Mar 2, 2016 at 5:08 PM, Paul Adenot <padenot@mozilla.com> wrote:
>>>
>>> Gecko uses code that can do arbitrary pitch adjustment, unrelated to time-stretching (which is speed change with pitch compensation).
>>
>> That's neat. If you're interested in exposing this as an API on
>> HTMLMediaElement, can you file a spec bug with a proposal of how it
>> might work?
>>
>
> Here is what I had in mind; hope it helps.
>
> Create a new property `pitchAdjustment` on HTMLMediaElement to adjust
> pitch in cents.
>
> Equally tempered semitones span 100 cents.
>
> The developer can use INPUT type="range" with an oninput, to allow the
> user to adjust the video's pitch, in cents.
>
> interface HTMLMediaElement : HTMLElement {
>  attribute unsigned short pitchAdjustment;
>  …
> }
>

Not unsigned, sorry.

interface HTMLMediaElement : HTMLElement {
  attribute short pitchAdjustment;
  …
 }

That should allow for pitch adjustment over 54 octaves. This is
withing human hearing range of 10 octaves. 1 having the value of one
cent, gives 1200 cents per octave.

let
 semitone = 100, // cents
 octave = 12 * semitone, // 1200
 sizeOfShort = 65535;
sizeOfShort / octave 54.6125

Signed short range is −32768 to 32767
-- 
Garrett
@xkit
ChordCycles.wordpress.com
garretts.github.io
personx.tumblr.com

Received on Wednesday, 2 March 2016 23:00:28 UTC