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

34
LINES

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

HTML

<!doctype html>
<html>
	<head>
		<title>Volume Meter Sample</title>
		<style>
		</style>
		<!-- Include the volume meter component -->
		<script src="http://tinybrain.de:8080/getraw.php?id=1014015"></script>
		<!-- Include the main app logic -->
		<script src="http://tinybrain.de:8080/getraw.php?id=1014014"></script>
	</head>
	<body>
		<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>
		<canvas id="meter" width="500" height="50" style="border: 1px solid black"></canvas>

		<p>Check out the <a href="http://github.com/cwilso/volume-meter/">source on Github</a>.</p>
		<p>The usage is quite easy:
		<pre>var meter = createAudioMeter(audioContext,clipLevel,averaging,clipLag);

audioContext: the AudioContext you're using.
clipLevel: the level (0 to 1) that you would consider "clipping".  Defaults to 0.98.
averaging: how "smoothed" you would like the meter to be over time.  Should be between 0 and less than 1.  Defaults to 0.95.
clipLag: how long you would like the "clipping" indicator to show after clipping has occured, in milliseconds.  Defaults to 750ms.

meter.checkClipping();

returns true if the node has clipped in the last clipLag milliseconds.

meter.shutdown();

used to destroy the node (it's important to disconnect and remove the event handler for any ScriptProcessor).
</pre>
	</body>
</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: 278 / 222
Version history: 3 change(s)
Referenced in: [show references]