You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/audioin.js
+13-6Lines changed: 13 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -50,40 +50,47 @@ p5sound.inputSources = [];
50
50
*/
51
51
classAudioIn{
52
52
constructor(errorCallback){
53
-
// set up audio input
54
53
/**
54
+
* Set up audio input
55
55
* @property {GainNode} input
56
56
*/
57
57
this.input=p5sound.audiocontext.createGain();
58
58
/**
59
+
* Send audio as an output, i.e. your computer's speaker.
59
60
* @property {GainNode} output
60
61
*/
61
62
this.output=p5sound.audiocontext.createGain();
62
-
63
63
/**
64
+
* Used to store the MediaStream object that is returned from the getUserMedia() API,
65
+
* which allows access to the user's microphone. The stream is used to create a MediaStreamAudioSourceNode,
66
+
* which is used as the audio source for the input and output gain nodes.
67
+
* The stream is also used to check if the browser supports the MediaStreamTrack and mediaDevices API,
68
+
* and if not, an errorCallback function is called or an alert is displayed.
64
69
* @property {MediaStream|null} stream
65
70
*/
66
71
this.stream=null;
67
72
/**
73
+
* Used to access the "audio input" from the user's microphone.
74
+
* It creates a MediaStream object that can be used to start and stop the mic and measure its volume using the getLevel() method or by connecting it to an FFT object.
75
+
* MediaStream object can also be use to check if the browser supports MediaStreamTrack and mediaDevices and to add the AudioIn object to the soundArray for disposal on close.
0 commit comments