1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-10 18:50:54 +00:00
psychojs/docs/module-sound.Microphone.html

1441 lines
19 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Microphone</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: Microphone</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>
<span class="ancestors"><a href="module-sound.html">sound</a>.</span>Microphone<span class="signature">(options, @param)</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="Microphone"><span class="type-signature"></span>new Microphone<span class="signature">(options, @param)</span><span class="type-signature"></span></h4>
<div class="description">
<p>This manager handles the recording of audio signal.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>psychoJS</code></td>
<td class="type">
<span class="param-type"><a href="module-core.PsychoJS.html">module:core.PsychoJS</a></span>
</td>
<td class="description last">the PsychoJS instance</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>@param</code></td>
<td class="type">
<span class="param-type"><a href="module-core.Window.html">module:core.Window</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">options.win - the associated Window</td>
</tr>
<tr>
<td class="name"><code>options.format</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
'audio/webm;codecs=opus'
</td>
<td class="description last">the format for the audio file</td>
</tr>
<tr>
<td class="name"><code>options.sampleRateHz</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
48000
</td>
<td class="description last">the audio sampling rate, in Hz</td>
</tr>
<tr>
<td class="name"><code>options.clock</code></td>
<td class="type">
<span class="param-type">Clock</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last">an optional clock</td>
</tr>
<tr>
<td class="name"><code>options.autoLog</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">whether or not to log</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="sound_Microphone.js.html">sound/Microphone.js</a>, <a href="sound_Microphone.js.html#line17">line 17</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="flush"><span class="type-signature"></span>flush<span class="type-signature"></span></h4>
<div class="description">
Submit a request to flush the recording.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="sound_Microphone.js.html">sound/Microphone.js</a>, <a href="sound_Microphone.js.html#line256">line 256</a>
</li></ul></dd>
</dl>
<h4 class="name" id="pause"><span class="type-signature"></span>pause<span class="type-signature"></span></h4>
<div class="description">
Submit a request to pause the recording.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="sound_Microphone.js.html">sound/Microphone.js</a>, <a href="sound_Microphone.js.html#line152">line 152</a>
</li></ul></dd>
</dl>
<h4 class="name" id="resume"><span class="type-signature"></span>resume<span class="type-signature"></span></h4>
<div class="description">
Submit a request to resume the recording.
<p>resume has no effect if the recording was not previously paused.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="sound_Microphone.js.html">sound/Microphone.js</a>, <a href="sound_Microphone.js.html#line199">line 199</a>
</li></ul></dd>
</dl>
<h4 class="name" id="start"><span class="type-signature"></span>start<span class="type-signature"></span></h4>
<div class="description">
Submit a request to start the recording.
<p>Note that it typically takes 50ms-200ms for the recording to actually starts once
a request to start has been submitted.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="sound_Microphone.js.html">sound/Microphone.js</a>, <a href="sound_Microphone.js.html#line55">line 55</a>
</li></ul></dd>
</dl>
<h4 class="name" id="stop"><span class="type-signature"></span>stop<span class="type-signature"></span></h4>
<div class="description">
Submit a request to stop the recording.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="sound_Microphone.js.html">sound/Microphone.js</a>, <a href="sound_Microphone.js.html#line114">line 114</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="_onChange"><span class="type-signature">(protected) </span>_onChange<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Callback for changes to the recording settings.
<p>Changes to the settings require the recording to stop and be re-started.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="sound_Microphone.js.html">sound/Microphone.js</a>, <a href="sound_Microphone.js.html#line371">line 371</a>
</li></ul></dd>
</dl>
<h4 class="name" id="_prepareRecording"><span class="type-signature">(protected) </span>_prepareRecording<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Prepare the recording.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="sound_Microphone.js.html">sound/Microphone.js</a>, <a href="sound_Microphone.js.html#line393">line 393</a>
</li></ul></dd>
</dl>
<h4 class="name" id="download"><span class="type-signature"></span>download<span class="signature">(filename)</span><span class="type-signature"></span></h4>
<div class="description">
Offer the audio recording to the participant as a sound file to download.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>filename</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the filename</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="sound_Microphone.js.html">sound/Microphone.js</a>, <a href="sound_Microphone.js.html#line285">line 285</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getRecording"><span class="type-signature"></span>getRecording<span class="signature">(tag, flush<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Get the current audio recording as an AudioClip in the given format.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>tag</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">an optional tag for the audio clip</td>
</tr>
<tr>
<td class="name"><code>flush</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">whether or not to first flush the recording</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="sound_Microphone.js.html">sound/Microphone.js</a>, <a href="sound_Microphone.js.html#line341">line 341</a>
</li></ul></dd>
</dl>
<h4 class="name" id="upload"><span class="type-signature"></span>upload<span class="signature">(tag)</span><span class="type-signature"></span></h4>
<div class="description">
Upload the audio recording to the pavlovia server.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>tag</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">an optional tag for the audio file</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="sound_Microphone.js.html">sound/Microphone.js</a>, <a href="sound_Microphone.js.html#line306">line 306</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-core.html">core</a></li><li><a href="module-data.html">data</a></li><li><a href="module-sound.html">sound</a></li><li><a href="module-util.html">util</a></li><li><a href="module-visual.html">visual</a></li></ul><h3>Classes</h3><ul><li><a href="module-core.BuilderKeyResponse.html">BuilderKeyResponse</a></li><li><a href="module-core.EventManager.html">EventManager</a></li><li><a href="module-core.GUI.html">GUI</a></li><li><a href="module-core.Keyboard.html">Keyboard</a></li><li><a href="module-core.KeyPress.html">KeyPress</a></li><li><a href="module-core.Logger.html">Logger</a></li><li><a href="module-core.MinimalStim.html">MinimalStim</a></li><li><a href="module-core.Mouse.html">Mouse</a></li><li><a href="module-core.PsychoJS.html">PsychoJS</a></li><li><a href="module-core.ServerManager.html">ServerManager</a></li><li><a href="module-core.Window.html">Window</a></li><li><a href="module-data.ExperimentHandler.html">ExperimentHandler</a></li><li><a href="module-data.TrialHandler.html">TrialHandler</a></li><li><a href="module-sound.AudioClip.html">AudioClip</a></li><li><a href="module-sound.AudioClipPlayer.html">AudioClipPlayer</a></li><li><a href="module-sound.Microphone.html">Microphone</a></li><li><a href="module-sound.Sound.html">Sound</a></li><li><a href="module-sound.TonePlayer.html">TonePlayer</a></li><li><a href="module-sound.TrackPlayer.html">TrackPlayer</a></li><li><a href="module-util.Clock.html">Clock</a></li><li><a href="module-util.Color.html">Color</a></li><li><a href="module-util.CountdownTimer.html">CountdownTimer</a></li><li><a href="module-util.EventEmitter.html">EventEmitter</a></li><li><a href="module-util.MixinBuilder.html">MixinBuilder</a></li><li><a href="module-util.MonotonicClock.html">MonotonicClock</a></li><li><a href="module-util.PsychObject.html">PsychObject</a></li><li><a href="module-util.Scheduler.html">Scheduler</a></li><li><a href="module-visual.ButtonStim.html">ButtonStim</a></li><li><a href="module-visual.Form.html">Form</a></li><li><a href="module-visual.ImageStim.html">ImageStim</a></li><li><a href="module-visual.MovieStim.html">MovieStim</a></li><li><a href="module-visual.Polygon.html">Polygon</a></li><li><a href="module-visual.Rect.html">Rect</a></li><li><a href="module-visual.ShapeStim.html">ShapeStim</a></li><li><a href="module-visual.Slider.html">Slider</a></li><li><a href="module-visual.TextBox.html">TextBox</a></li><li><a href="module-visual.TextStim.html">TextStim</a></li><li><a href="module-visual.VisualStim.html">VisualStim</a></li></ul><h3>Interfaces</h3><ul><li><a href="module-sound.SoundPlayer.html">SoundPlayer</a></li></ul><h3>Mixins</h3><ul><li><a href="module-core.WindowMixin.html">WindowMixin</a></li><li><a href="module-util.ColorMixin.html">ColorMixin</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Mon Jun 21 2021 07:34:20 GMT+0200 (Central European Summer Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>