[Web Audio API] data from analyser getByteTimeDomainData is always full-scaled

RESOLVED FIXED in Firefox 39

Status

()

Core
Web Audio
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: gaito, Assigned: padenot)

Tracking

37 Branch
mozilla39
x86_64
Windows 8.1
Points:
---

Firefox Tracking Flags

(firefox39 fixed)

Details

Attachments

(1 attachment)

(Reporter)

Description

4 years ago
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36

Steps to reproduce:

data retrieved with analyser getByteTimeDomainData() always has full-scaled amplitude (0-255).
test code is here :
---
<script>
var data=new Uint8Array(256);
var actx=new AudioContext();
var osc=actx.createOscillator();
var gain=actx.createGain();
var analyser=actx.createAnalyser();
osc.connect(gain);
gain.connect(analyser);
analyser.connect(actx.destination);
osc.start(0);
setInterval(function(){
	analyser.getByteTimeDomainData(data);
	var ctx=document.getElementById("canvas").getContext("2d");
	ctx.clearRect(0,0,256,256);
	for(var i=0;i<256;++i)
		ctx.fillRect(i,255,1,-data[i]);
},500);
</script>
<button onclick="gain.gain.value=0">vol=0</button>
<button onclick="gain.gain.value=0.1">vol=0.1</button>
<button onclick="gain.gain.value=1">vol=1</button><br/>
<canvas id="canvas" width="256" height="256"></canvas>
---
1) access to
http://www.g200kg.com/demo/test/test-analysertimedomain.html
2) press 'vol' buttons and check the waveform amplitude


Actual results:

waveform amplitude is always full-scaled even switch volume, and it is not updated if vol=0


Expected results:

waveform amplitude should be changed according to current vol setting.
(Assignee)

Comment 1

3 years ago
Created attachment 8556533 [details] [diff] [review]
Apply the gain to AnalyserNode data prior to sending on the main thread. r=
(Assignee)

Updated

3 years ago
Assignee: nobody → padenot
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
(Assignee)

Comment 2

3 years ago
Comment on attachment 8556533 [details] [diff] [review]
Apply the gain to AnalyserNode data prior to sending on the main thread. r=

I chose to do most of the work on the audio thread, the main thread is busy enough!
Attachment #8556533 - Flags: review?(ehsan)

Updated

3 years ago
Attachment #8556533 - Flags: review?(ehsan) → review+
https://hg.mozilla.org/mozilla-central/rev/fef16c5295a0
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox39: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Depends on: 1184801
You need to log in before you can comment on or make changes to this bug.