Heilan X3D Browser

TransientDetector

Type

ParentNode, to be used with a child AudioClip.

Description

This node is mainly identical to Sound, but includes an envelope detector and transient detector, both of which output events using X3D's ROUTE method. In this way you can easily set up some basic audiovisual mappings based on the amplitude envelope of a sound file. The events output are named amplitudeEnvelope and transientDetected, where amplitudeEnvelope has a range 0->1, and transientDetected outputs a 1 followed by a 0 when it detects a transient. Note that amplitudeEnvelope events are sent every 0.01s, while transientDetected events are sent when the node detects them. The node has all the same attributes that the standard X3D Sound node has, in addition to those below.

Attributes

isMute SFBool (input) If true, the node will not output any sound, just send the envelope and transient information detected.

amplitudeEnvelope SFFloat (output) The current value of the AudioClip's amplitude (0-1).

transientDetected SFFloat (output) Set to 1 when a transient's detected, then 0.

Example Use

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE X3D>
<X3D profile="Full">
	<Scene>
		<NavigationInfo type="ANY"/>

		<GhostImage DEF="bob" scale="1">
			<Transform translation="0.0 0.0 -4.0 ">
				<TransientDetector DEF="trans">
					<AudioClip url="/home/niall/music/samples/thing.wav" loop="TRUE"/>
				</TransientDetector>
				<Shape>
					<Appearance>
						<Material diffuseColor="0.0 0.0 1.0 "/>
					</Appearance>
					<Box DEF="box" size="0.125 0.5 0.125"/>
				</Shape>
			</Transform>
		</GhostImage>

		<ROUTE fromNode="trans" fromField="transientDetected" toNode="bob" toField="trigger"/>
		<ROUTE fromNode="trans" fromField="amplitudeEnvelope" toNode="box" toField="size.y"/>
	</Scene>
</X3D>