Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

34
LINES

< > BotCompany Repo | #1014013 // Volume Meter Test

HTML

1  
<!doctype html>
2  
<html>
3  
	<head>
4  
		<title>Volume Meter Sample</title>
5  
		<style>
6  
		</style>
7  
		<!-- Include the volume meter component -->
8  
		<script src="http://tinybrain.de:8080/getraw.php?id=1014015"></script>
9  
		<!-- Include the main app logic -->
10  
		<script src="http://tinybrain.de:8080/getraw.php?id=1014014"></script>
11  
	</head>
12  
	<body>
13  
		<p>This sample shows how to implement a clip-indicating volume meter in Web Audio, using a ScriptProcessor.  It's necessary to use a ScriptProcessor in order to not miss any clipping samples - otherwise you could implement this using a RealtimeAnalyser to only grab samples when necessary.</p>
14  
		<canvas id="meter" width="500" height="50" style="border: 1px solid black"></canvas>
15  
16  
		<p>Check out the <a href="http://github.com/cwilso/volume-meter/">source on Github</a>.</p>
17  
		<p>The usage is quite easy:
18  
		<pre>var meter = createAudioMeter(audioContext,clipLevel,averaging,clipLag);
19  
20  
audioContext: the AudioContext you're using.
21  
clipLevel: the level (0 to 1) that you would consider "clipping".  Defaults to 0.98.
22  
averaging: how "smoothed" you would like the meter to be over time.  Should be between 0 and less than 1.  Defaults to 0.95.
23  
clipLag: how long you would like the "clipping" indicator to show after clipping has occured, in milliseconds.  Defaults to 750ms.
24  
25  
meter.checkClipping();
26  
27  
returns true if the node has clipped in the last clipLag milliseconds.
28  
29  
meter.shutdown();
30  
31  
used to destroy the node (it's important to disconnect and remove the event handler for any ScriptProcessor).
32  
</pre>
33  
	</body>
34  
</html>

download  render html  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1014013
Snippet name: Volume Meter Test
Eternal ID of this version: #1014013/4
Text MD5: ead49c6d1d831f8600b08d3c2532a56a
Author: stefan
Category: javax / html / speech
Type: HTML
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-03-22 10:57:26
Source code size: 1594 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 283 / 224
Version history: 3 change(s)
Referenced in: [show references]