Re: [whatwg] VIDEO and pitchAdjustment

2016-03-02 Thread Garrett Smith
On Wed, Mar 2, 2016 at 1:09 PM, Garrett Smith  wrote:
> On Wed, Mar 2, 2016 at 2:36 AM, Philip Jägenstedt  wrote:
>> On Wed, Mar 2, 2016 at 5:08 PM, Paul Adenot  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


Re: [whatwg] VIDEO and pitchAdjustment

2016-03-02 Thread Garrett Smith
On Wed, Mar 2, 2016 at 2:36 AM, Philip Jägenstedt  wrote:
> On Wed, Mar 2, 2016 at 5:08 PM, Paul Adenot  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:

http://example.net/; id="vv"">




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

Thank you,
-- 
Garrett
@xkit


Re: [whatwg] VIDEO and pitchAdjustment

2016-03-02 Thread Philip Jägenstedt
On Wed, Mar 2, 2016 at 5:08 PM, Paul Adenot  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?

Philip


Re: [whatwg] VIDEO and pitchAdjustment

2016-03-02 Thread Paul Adenot
Gecko uses code that can do arbitrary pitch adjustment, unrelated to
time-stretching (which is speed change with pitch compensation).

Paul.

On Wed, Mar 2, 2016 at 5:00 AM, Philip Jägenstedt  wrote:

> On Wed, Mar 2, 2016 at 9:19 AM, Garrett Smith 
> wrote:
> > On Thu, Nov 12, 2015 at 11:32 AM, Philip Jägenstedt 
> wrote:
> >> On Thu, Nov 12, 2015 at 10:55 AM, Garrett Smith  >
> >> wrote:
> >>> On 11/12/15, Philip Jägenstedt  wrote:
>  On Thu, Nov 12, 2015 at 9:07 AM, Garrett Smith <
> dhtmlkitc...@gmail.com>
>  wrote:
> >
> > On 10/19/15, Philip Jägenstedt  wrote:
> > > On Tue, Sep 1, 2015 at 11:21 AM, Philip Jägenstedt <
> phil...@opera.com>
> > > wrote:
> > >> On Mon, Aug 31, 2015 at 9:48 PM, Domenic Denicola 
> > >> wrote:
> > >>> From: Eric Carlson [mailto:eric.carl...@apple.com]
> >
> >> Two things.
> >>
> >> 1. Do the underlying media frameworks that browsers are using support
> >> arbitrary pitch changes, or do they also only have the limited
> >> preservesPitch-style API?
> >
> > Are there any problems getting in the way of pitch adjustment (without
> > depending on playbackRate)?
>
> I don't know, that was basically my question too. If the underlying
> APIs don't support it, that's a problem that needs to be fixed first.
>
> Philip
>