You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.2 KiB
97 lines
3.2 KiB
<!DOCTYPE html>
|
|
<html lang="ar">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<base href="../../../" />
|
|
<script src="page.js"></script>
|
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
|
</head>
|
|
<body class="rtl">
|
|
<h1>[name]</h1>
|
|
|
|
<p class="desc">
|
|
يقوم بإنشاء كائن AudioAnalyser ، والذي يستخدم [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode AnalyserNode] لتحليل البيانات الصوتية.<br /><br />
|
|
|
|
هذا يستخدم [link:https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API Web Audio API].
|
|
|
|
</p>
|
|
|
|
<h2>مثال التعليمة البرمجية</h2>
|
|
|
|
<code>
|
|
// create an AudioListener and add it to the camera
|
|
const listener = new THREE.AudioListener();
|
|
camera.add( listener );
|
|
|
|
// create an Audio source
|
|
const sound = new THREE.Audio( listener );
|
|
|
|
// load a sound and set it as the Audio object's buffer
|
|
const audioLoader = new THREE.AudioLoader();
|
|
audioLoader.load( 'sounds/ambient.ogg', function( buffer ) {
|
|
sound.setBuffer( buffer );
|
|
sound.setLoop(true);
|
|
sound.setVolume(0.5);
|
|
sound.play();
|
|
});
|
|
|
|
// create an AudioAnalyser, passing in the sound and desired fftSize
|
|
const analyser = new THREE.AudioAnalyser( sound, 32 );
|
|
|
|
// get the average frequency of the sound
|
|
const data = analyser.getAverageFrequency();
|
|
</code>
|
|
|
|
<h2>أمثلة (Examples)</h2>
|
|
|
|
<p>
|
|
[example:webaudio_sandbox webaudio / sandbox ]<br />
|
|
[example:webaudio_visualizer webaudio / visualizer ]
|
|
</p>
|
|
|
|
<h2>المنشئ (Constructor)</h2>
|
|
|
|
|
|
<h3>[name]( audio, [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/fftSize fftSize] )</h3>
|
|
<p>
|
|
يقوم بإنشاء [page:AudioAnalyser AudioAnalyser] جديد.
|
|
</p>
|
|
|
|
|
|
<h2>الخصائص (Properties)</h2>
|
|
|
|
<h3>[property:AnalyserNode analyser]</h3>
|
|
<p>[link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode AnalyserNode] يستخدم لتحليل الصوت.</p>
|
|
|
|
<h3>[property:Integer fftSize]</h3>
|
|
<p>
|
|
قدرة غير صفرية تصل إلى 2048 ، تمثل حجم FFT (Fast Fourier Transform) لاستخدامها لتحديد مجال التردد (frequency domain).
|
|
انظر [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/fftSize this page] للحصول على التفاصيل.
|
|
</p>
|
|
|
|
<h3>[property:Uint8Array data]</h3>
|
|
<p>
|
|
*Uint8Array* بالحجم المحدد بواسطة [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/frequencyBinCount analyser.frequencyBinCount] يستخدم للاحتفاظ ببيانات التحليل.
|
|
</p>
|
|
|
|
|
|
<h2>الوظائف (Methods)</h2>
|
|
|
|
|
|
<h3>[method:Uint8Array getFrequencyData]()</h3>
|
|
<p>
|
|
يستخدم طريقة [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData getByteFrequencyData] الخاصة بـ Web Audio. انظر تلك الصفحة.
|
|
</p>
|
|
|
|
<h3>[method:Number getAverageFrequency]()</h3>
|
|
<p>
|
|
تقوم بإرجاع متوسط الترددات المعادة بطريقة [page:AudioAnalyser.getFrequencyData getFrequencyData].
|
|
</p>
|
|
|
|
<h2>المصدر (Source)</h2>
|
|
|
|
<p>
|
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
|
</p>
|
|
</body>
|
|
</html>
|
|
|