Re: [whatwg] VIDEO and pitchAdjustment

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;
 …
}

pitchAdjustment adjusts the target HTMLMediaElement's audio pitch
relative to its original pitch, in cents. A value of 0 represents no
pitch adjustment.

Getting gets the last set value; 0 if unset. Setting sets the value
and changes the pitch in cents (relative to the media element's
original pitch).

Example:

<video src="mediasource:http://example.net/" id="vv""></video>

<!-- transpose video up a 4th or down a 5th -->
<input type="range" min="-500" max="500" value="0"
 onchange="updateMoviePitch()">

function updateMoviePitch(ev) {
  var vv = document.getElementById("vv");
  vv.pitchAdjustment = +this.value;
  showPitchUI(vv, this.value);
}

Thank you,
-- 
Garrett
@xkit

Received on Wednesday, 2 March 2016 21:12:06 UTC