Skip to content
Related Articles

Related Articles

Web Audio API | AudioNode numberOfInputs Property
  • Last Updated : 19 Jul, 2019

The AudioNode.numberOfInputs property is used to return the number of inputs that are feeding the node. The Source node is used to define as nodes that contain a numberOfInputs property with a value zero.

Syntax:

var numInputs = audioNode.numberOfInputs;

Return Value: It returns an integer value greater than equal to zero.

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE HTML> 
<html
   
<head
    <title
        Web Audio API | AudioNode numberOfInputs property
    </title>
</head
   
<body
       
    <h1 style = "color:green;"
        GeeksforGeeks
    </h1>
       
    <h2>
        AudioNode numberOfInputs property
    </h2>
       
    <script>
       
        // Create new Audio context
        const audioContext = new AudioContext();
           
        // Create an OscillatorNode 
        const oscillator = audioContext.createOscillator();
          
        // Create a gainNode
        const gainNode = audioContext.createGain();
            
        oscillator.connect(gainNode).connect(audioContext.destination);
           
        // Display the numberOfOutputs in console view
        console.log(oscillator.numberOfInputs);
    </script>
</body>
   
</html>                   

chevron_right


Output:



Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE HTML> 
<html
   
<head
    <title
        Web Audio API | AudioNode numberOfInputs property
    </title>
</head
   
<body
       
    <h1 style = "color:green;"
        GeeksforGeeks
    </h1>
       
    <h2>
        AudioNode numberOfInputs property
    </h2>
       
    <script>
       
        // Create new Audio context
        const audioContext = new AudioContext();
           
        // Create an OscillatorNode 
        const oscillator = audioContext.createOscillator();
          
        // Create a gainNode
        const gainNode = audioContext.createGain();
            
        oscillator.connect(gainNode).connect(audioContext.destination);
           
        // Display the numberOfOutputs in console view
        console.log(gainNode.numberOfInputs);
    </script>
</body>
   
</html>                   

chevron_right


Output:

Example 3:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE HTML> 
<html
   
<head
    <title
        Web Audio API | AudioNode numberOfInputs property
    </title>
</head
   
<body
       
    <h1 style = "color:green;"
        GeeksforGeeks
    </h1>
       
    <h2>
        AudioNode numberOfInputs property
    </h2>
       
    <script>
       
        // Create new Audio context
        const audioContext = new AudioContext();
           
        // Create an OscillatorNode 
        const oscillator = audioContext.createOscillator();
          
        // Create a gainNode
        const gainNode = audioContext.createGain();
            
        oscillator.connect(gainNode).connect(audioContext.destination);
           
        // Display the numberOfOutputs in console view
        console.log(audioContext.destination.numberOfInputs);
    </script>
</body>
   
</html>                   

chevron_right


Output:

Supported Browsers: The browser supported by AudioNode.numberOfInputs property are listed below:

  • Google Chrome 14.0
  • Edge 12.0
  • Firefox 25.0
  • Safari 6.0
  • Opera 15.0

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :