Closed Bug 1118622 Opened 9 years ago Closed 9 years ago

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

Categories

(Core :: Web Audio, defect)

37 Branch
x86_64
Windows 8.1
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: gaito, Assigned: padenot)

References

Details

Attachments

(1 file)

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: nobody → padenot
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
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)
Attachment #8556533 - Flags: review?(ehsan) → review+
https://hg.mozilla.org/mozilla-central/rev/fef16c5295a0
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Depends on: 1184801
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: