Closed Bug 1500238 Opened 5 years ago Closed 5 years ago

StereoPanner does not handle a pan value of zero for mono signals

Categories

(Core :: Web Audio, defect, P2)

62 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: chrisguttandin, Assigned: karlt)

References

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36

Steps to reproduce:

const offlineAudioContext = new OfflineAudioContext(1, 1, 44100);
const constantSourceNode = new ConstantSourceNode(offlineAudioContext, { channelCount: 1, offset: 1 });
const stereoPanner = new StereoPannerNode(offlineAudioContext, { channelCount: 1 });

constantSourceNode.start();

constantSourceNode
    .connect(stereoPanner)
    .connect(offlineAudioContext.destination);

offlineAudioContext
    .startRendering()
    .then((buffer) => {
        const channelData = buffer.getChannelData(0);

        console.log(channelData[0]);
    });


Actual results:

The output of the snippet above is 1. The code sends a constant signal through a StereoPanner. In this case it is a mono signal that gets fed into the StereoPanner. After the rendering is done the first value of the rendered buffer gets printed to the console.


Expected results:

The output should be close to 0.707 as the algorithm for the StereoPanner requires the signal to be modified when the channelCount is 1 and the value of pan is 0.

https://webaudio.github.io/web-audio-api/#stereopanner-algorithm

Please let me know if I should provide more detailed information. Many thanks.
Paul can you please help me triage this?
Flags: needinfo?(padenot)
Whiteboard: [need info padenot 2018-10-18]
Thank you for filing.  This is a discontinuity we don't want, and is reasonably easy to fix.
Assignee: nobody → karlt
Blocks: 1100349
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(padenot)
Priority: -- → P2
Whiteboard: [need info padenot 2018-10-18]
This is necessary for efficient processing of silence, and is consistent with
behavior of other nodes.

A null block current has a single channel of silence, which isn't aligned with
the current spec, but is consistent with the direction of
https://github.com/WebAudio/web-audio-api/issues/1471#issuecomment-405668690

Depends on D9210
and re-use input buffer instead of copying.

Depends on D9211
Pushed by ktomlinson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cc7ddb5861a8
correct expected result for monoPanningNoop tests r=padenot
https://hg.mozilla.org/integration/autoland/rev/17f777b16189
output null from StereoPannerNode when input is null r=padenot
https://hg.mozilla.org/integration/autoland/rev/01b1f806550b
correct mono-to-stereo panning at centre position r=padenot
https://hg.mozilla.org/mozilla-central/rev/cc7ddb5861a8
https://hg.mozilla.org/mozilla-central/rev/17f777b16189
https://hg.mozilla.org/mozilla-central/rev/01b1f806550b
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.