تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
إنّ محرّكات الاهتزاز الأكثر شيوعًا على أجهزة Android هي محرّكات التردد التوافقي (LRA). تحاكي تقنية LRAs شعور النقر على زر
على سطح زجاجي لا يستجيب. تستمر إشارة ردّ فعل اللمس النابضة الواضحة عادةً بين 10 و20 ملي ثانية. ويمنح هذا الشعور المستخدمين تجربة تفاعل أكثر طبيعية. بالنسبة إلى لوحات المفاتيح الافتراضية، يمكن أن تؤدي هذه الميزة
إلى زيادة سرعة الكتابة والحد من الأخطاء.
تتضمّن خطوط النقل ذات الجهد المنخفض بعض الترددات الرنانة الشائعة:
كانت بعض وحدات LRA ذات ترددات رنين تتراوح بين 200 و300 هرتز، وهو تردد يتزامن مع التردد الذي يكون فيه الجلد البشري الأكثر حساسية للاهتزازات. وعادةً ما يُوصف شعور الاهتزازات في نطاق التردد هذا بأنّه شعور سلس وحاد وثاقبة.
تتميز الطُرز الأخرى من مكبّرات الصوت ذات الطاقة المنخفضة بمعدّلات رنين أقل، تبلغ 150 هرتز تقريبًا. ويُحسّ المستخدمون بأنّ الصوت أكثر ليونة وامتلاءً (من حيث الحجم).
مكونات المحرّك التوافقي الخطي (LRA).
في حال استخدام الجهد الكهربي نفسه عند ترددَين مختلفَين، يمكن أن تختلف amplitudes الناتجة عن الاهتزاز. وكلما ابتعد التردد عن التردّد المتوافق لملف اللفّ LRA، انخفضت شدة الاهتزاز.
تستخدم التأثيرات اللمسية لجهاز معيّن كلّ من محرّك الاهتزاز وسائقه.
يمكن أن تقلل وحدات التحكّم باللمس التي تتضمّن ميزتَي "التسريع الفائق" و"التفرامل النشطة" من
وقت الارتفاع والرنّان في محركات LRA، ما يؤدي إلى اهتزاز أكثر سرعة ووضوحًا.
تسريع ناتج أداة الاهتزاز
يصف ربط التردد بتسارع الإخراج (FOAM) الحد الأقصى
لتسارع الإخراج الذي يمكن تحقيقه (بوحدة G peak) عند تردد اهتزاز معيّن (بوحدة
هرتز). بدءًا من الإصدار 16 من Android (المستوى 36 من واجهة برمجة التطبيقات)، توفّر المنصة ميزة مدمجة ل
إتاحة هذا الربط من خلال VibratorFrequencyProfile. يمكنك استخدام
هذه الفئة، بالإضافة إلى واجهات برمجة تطبيقات الحِزم الأساسية والمتقدّمة، لإنشاء أثر
لمسي.
تُظهر معظم محركات LRA ذروة واحدة في سعة التحميل القصوى، وعادةً ما تكون قريبة من تردد التوافقي. ينخفض التسارع بشكل عام بشكلٍ كبير مع انحراف معدّل التكرار
عن هذا النطاق. قد لا يكون المنحنى متماثلاً وقد يعرض منصة
حول التردد الرنان لحماية المحرّك من التلف.
تعرِض الرسمة المجاورة مثالاً على مخطط FOAM لمحرّك LRA.
مثال على نموذج FOAM لمحرّك LRA
حدّ رصد الإدراك البشري
يشير حدّ رصد الإدراك البشري إلى الحدّ الأدنى لتسارع
الاهتزاز الذي يمكن لشخص رصده بشكل موثوق. يختلف هذا المستوى استنادًا إلى
وتيرة الاهتزاز.
يعرض الرسم البياني المجاور حدّ رصد الإدراك الحسي لللمس لدى الإنسان، والذي يُقاس بالانطلاق، وذلك بصفتها دالةً للتردد الزمني. يتم تحويل بيانات الحدّ الأدنى من
الإزاحة من الشكل 1 في Bolanowski Jr. S. مقالة J.، et
al. لعام 1988،
"تتوسّط أربع قنوات الجوانب الميكانيكية لللمس"
يعالج نظام التشغيل Android هذا الحدّ تلقائيًا في BasicEnvelopeBuilder،
الذي يتحقق من أنّ جميع التأثيرات تستخدم نطاق تردد ينتج عنه اهتزازات
بأحجام تتجاوز الحدّ الأدنى لرصد الإدراك البشري بنحو
10 ديسيبل.
إنّ إدراك الإنسان لمستوى الاهتزاز، وهو مقياس إدراكي، لا يزداد
بشكل خطي مع سعة الاهتزاز، وهي مَعلمة فيزيائية. تتميز الكثافة المتأثّرة
بمستوى الإحساس (SL)، والذي يتم تعريفه على أنّه مقدار ديسيبل أعلى
من حدّ الكشف عند التردد نفسه.
يمكن احتساب سعة تسارع الاهتزاز المقابلة (بوحدة ذروة G)
على النحو التالي:
$$
Amplitude(G) = 10^{Amplitude(db)/20}
$$
...حيث يكون مقدار الديسيبل هو مجموع SL وحدّ الكشف، أي القيمة
على طول المحور العمودي في الرسم المجاور، عند تردد معيّن.
يعرض الرسم البياني المجاور مستويات تسارع الاهتزاز عند 10 و20 و30 و40 و
50 ديسيبل SL، بالإضافة إلى الحدّ الأدنى لرصد الإدراك الحسي للاهتزاز لدى الإنسان (0 ديسيبل SL)،
باعتباره دالةً لمعدّل التكرار الزمني. تم تقدير البيانات من الشكل 8 في
Verrillo, R. مقالة "Sensation magnitude of vibrotactile
stimuli" التي نشرها "تي" وآخرون في عام 1969
مستويات تسارع الاهتزاز:
يعالج Android هذا التحويل تلقائيًا في BasicEnvelopeBuilder،
الذي يأخذ القيم على أنّها كثافات عادية في مساحة مستوى الإحساس (dB
SL) ويحوّلها إلى تسارع الإخراج. على صعيدٍ آخر، لا تطبِّق WaveformEnvelopeBuilder
هذه التحويلات وتأخذ القيم على أنّها ناتج إشارة تسارع موحَّدة
في مساحة التسارع (Gs) بدلاً من ذلك. تفترض واجهة برمجة التطبيقات
envelope API أنّ المصمّم أو المطوّر يتوقع أن تتّبع الكثافة المتأثّرة انحناءً خطيًا متقطعًا عند التفكير في التغييرات في
قوة الاهتزاز.
تمويه شكل الموجة التلقائي على الأجهزة
على سبيل المثال، نوضّح كيفية تصرف نمط موجي مخصّص على جهاز
عام:
تعرض الرسوم البيانية التالية شكل موجة الإدخال وتسريع الإخراج
المرتبطَين بمقتطفات الرموز البرمجية السابقة. يُرجى العلم أنّ التسارع
يزداد تدريجيًا وليس بشكل مفاجئ عند حدوث تغيير تدريجي في شدة التردد
في النمط، أي عند 0 مللي ثانية و150 مللي ثانية و200 مللي ثانية و250 مللي ثانية و700 مللي ثانية. هناك أيضًا
زيادة مفاجئة في كل خطوة من خطوات تغيير الشدة، وهناك رنين مرئي
يستمر لمدة 50 ملي ثانية على الأقل عندما ينخفض حجم الإدخال فجأة إلى 0.
رسم الشكل الموجي لإدخال الدالة الخطية
مخطّط للشكل الموجي المقاس الفعلي، يعرض المزيد من الانتقالات الطبيعية
بين المستويات
نمط لمسي محسَّن
لتجنُّب تجاوز الحد الأقصى وتقليل وقت الرنين، غيِّر النطاقات amplitude بشكلٍ
أكثر تدريجيًا. يعرض ما يلي الرسم البياني لموجة الصوت ورسم التسارع للملف
المعدَّل:
Kotlin
valtimings:LongArray=longArrayOf(25,25,50,25,25,25,25,25,25,25,75,25,25,300,25,25,150,25,25,25)valamplitudes:IntArray=intArrayOf(38,77,79,84,92,99,121,143,180,217,255,170,85,0,85,170,255,170,85,0)valrepeatIndex=-1// Do not repeat.vibrator.vibrate(VibrationEffect.createWaveform(timings,amplitudes,repeatIndex))
Java
long[]timings=newlong[]{25,25,50,25,25,25,25,25,25,25,75,25,25,300,25,25,150,25,25,25};int[]amplitudes=newint[]{38,77,79,84,92,99,121,143,180,217,255,170,85,0,85,170,255,170,85,0};intrepeatIndex=-1;// Do not repeat.vibrator.vibrate(VibrationEffect.createWaveform(timings,amplitudes,repeatIndex));
رسم الشكل الموجي للإدخال مع الخطوات الإضافية
رسم الشكل الموجي المقاس، الذي يعرض انتقالات أكثر سلاسة
إنشاء تأثيرات لمسية أكثر تعقيدًا
إنّ العناصر الأخرى في استجابة النقر المُرضية أكثر تعقيدًا، وتتطلّب بعض معرفة
بوحدة LRA المستخدَمة في الجهاز. للحصول على أفضل النتائج، استخدِم موجات الجهد المُعدّة مسبقًا والثوابت المقدَّمة من النظام الأساسي على الجهاز، ما يتيح لك تنفيذ ما يلي:
يمكن أن تسريع هذه العناصر الأساسية والثوابت المُحدَّدة مسبقًا لللمس عملك بشكل كبير
أثناء إنشاء تأثيرات لمسية عالية الجودة.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Analyze vibration waveforms\n\nThe most common vibration actuators on Android devices are [linear resonant\nactuators (LRAs)](https://medium.com/@SomaticLabs/what-is-a-linear-resonant-actuator-81cc25f85779). LRAs simulate the feeling of a button click\non what is otherwise an unresponsive glass surface. A clear and crisp click\nfeedback signal typically lasts between 10 and 20 milliseconds in duration. This\nsensation makes user interactions feel more natural. For virtual keyboards, this\nclick feedback can increase typing speed and reduce errors.\n\nLRAs have a few common [resonant frequencies](https://en.wikipedia.org/wiki/Resonance#Examples):\n\n- Some LRAs had resonant frequencies in the 200 to 300 Hz range, which coincides with the frequency at which human skin is most sensitive to vibration. The sensation of vibrations at this frequency range are usually described as smooth, sharp, and penetrating.\n- Other models of LRAs have lower resonance frequencies, at around 150 Hz. The sensation is qualitatively softer and fuller (in dimension). \nComponents of a linear resonant actuator (LRA).\n\n\u003cbr /\u003e\n\nGiven the same input voltage at two different frequencies, the vibration output\namplitudes can be different. The further away the frequency is from the LRA's\nresonant frequency, the lower its vibration amplitude.\n\nA given device's haptic effects use both the vibration actuator and its driver.\nHaptic drivers that include overdrive and active braking features can reduce the\nrise time and ringing of LRAs, leading to a more responsive and clear vibration.\n\nVibrator output acceleration\n----------------------------\n\n\nThe frequency-to-output-acceleration mapping (FOAM) describes the maximum\nachievable output acceleration (in G peak) at a given vibration frequency (in\nHertz). Starting in Android 16 (API level 36), the platform provides built-in\nsupport for this mapping through the `VibratorFrequencyProfile`. You can use\nthis class, along with the [basic](/reference/android/os/VibrationEffect.BasicEnvelopeBuilder) and [advanced](/reference/android/os/VibrationEffect.WaveformEnvelopeBuilder) envelope APIs, to create\nhaptic effects.\n\nMost LRA motors have a single peak in their FOAM, typically near their resonant\nfrequency. Acceleration generally decreases exponentially as frequency deviates\nfrom this range. The curve may not be symmetrical and might feature a plateau\naround the resonant frequency to protect the motor from damage.\n\nThe adjacent plot shows an example FOAM for an LRA motor. \nExample FOAM for an LRA motor.\n\n\u003cbr /\u003e\n\n### Human perception detection threshold\n\n\nThe *human perception detection threshold* refers to the minimum acceleration of\na vibration that a person can reliably detect. This level varies based on the\nvibration frequency.\n\nThe adjacent plot shows the human haptic perception detection threshold, in\nacceleration, as a function of temporal frequency. The threshold data is\nconverted from displacement threshold in Figure 1 of Bolanowski Jr., S. J., et\nal.'s 1988 article,\n[\"Four channels mediate the mechanical aspects of touch.\"](https://pubmed.ncbi.nlm.nih.gov/3209773/).\n\nAndroid automatically handles this threshold in the `BasicEnvelopeBuilder`,\nwhich verifies that all effects use a frequency range that prodcues vibration\namplitudes that exceed the human perception detection threshold by at least\n10 dB. \nHuman haptic perception detection threshold.\n\n\u003cbr /\u003e\n\nAn online tutorial further explains the [conversion between acceleration\namplitude and displacement amplitude](https://www.tangerinex.com/tutorial-1).\n\n### Vibration acceleration levels\n\n\nHuman perception of vibration intensity, a *perception* measure, doesn't grow\nlinearly with vibration amplitude, a *physical* parameter. Perceived intensity\nis characterized by sensation level (SL), which is defined as a dB amount above\nthe detection threshold at the same frequency.\n\nThe corresponding vibration acceleration amplitude (in G peak) can be calculated\nas follows: \n$$ Amplitude(G) = 10\\^{Amplitude(db)/20} $$\n\n...where the amplitude dB is the sum of SL and detection threshold---the value\nalong the vertical axis in the adjacent plot---at a particular frequency.\n\nThe adjacent plot shows the vibration acceleration levels at 10, 20, 30, 40 and\n50 dB SL, along with the human haptic perception detection threshold (0 dB SL),\nas a function of temporal frequency. The data is estimated from Figure 8 in\nVerrillo, R. T., et al.'s 1969 article, [\"Sensation magnitude of vibrotactile\nstimuli.\"](https://link.springer.com/article/10.3758/BF03212793). \nVibration acceleration levels.\n\n\u003cbr /\u003e\n\nAndroid automatically handles this conversion in the `BasicEnvelopeBuilder`,\nwhich takes values as normalized intensities in the sensation level space (dB\nSL) and converts them to output acceleration. The `WaveformEnvelopeBuilder`, on\nthe other hand, doesn't apply this conversion and takes values as normalized\noutput acceleration amplitudes in the acceleration space (Gs) instead. The\nenvelope API assumes that, when a designer or developer thinks about changes in\nvibration strength, they expect the perceived intensity to follow a piecewise\nlinear envelope.\n\nDefault waveform smoothing on devices\n-------------------------------------\n\nFor illustration, consider how a custom waveform pattern behaves on a generic\ndevice: \n\n### Kotlin\n\n val timings: LongArray = longArrayOf(50, 50, 50, 50, 50, 100, 350, 250)\n val amplitudes: IntArray = intArrayOf(77, 79, 84, 99, 143, 255, 0, 255)\n val repeatIndex = -1 // Don't repeat.\n\n vibrator.vibrate(VibrationEffect.createWaveform(timings, amplitudes, repeatIndex))\n\n### Java\n\n long[] timings = new long[] { 50, 50, 50, 50, 50, 100, 350, 250 };\n int[] amplitudes = new int[] { 77, 79, 84, 99, 143, 255, 0, 255 };\n int repeatIndex = -1 // Don't repeat.\n\n vibrator.vibrate(VibrationEffect.createWaveform(timings, amplitudes, repeatIndex));\n\nThe following plots show the input waveform and output acceleration\ncorresponding to the preceding code snippets. Note that the acceleration\nincreases gradually, not suddenly, whenever there is a step change of amplitude\nin the pattern---that is, at 0ms, 150ms, 200ms, 250ms, and 700ms. There is also an\novershoot at each step change of amplitude, and there is visible ringing that\nlasts at least 50ms when the input amplitude suddenly drops to 0.\n\n\nPlot of step function input waveform. \nPlot of actual measured waveform, showing more organic transitions between levels.\n\n\u003cbr /\u003e\n\nImproved haptic pattern\n-----------------------\n\nTo avoid overshoot and reduce ringing time, change the amplitudes more\ngradually. The following shows the waveform and acceleration plots of the\nrevised version: \n\n### Kotlin\n\n val timings: LongArray = longArrayOf(\n 25, 25, 50, 25, 25, 25, 25, 25, 25, 25, 75, 25, 25,\n 300, 25, 25, 150, 25, 25, 25\n )\n val amplitudes: IntArray = intArrayOf(\n 38, 77, 79, 84, 92, 99, 121, 143, 180, 217, 255, 170, 85,\n 0, 85, 170, 255, 170, 85, 0\n )\n val repeatIndex = -1 // Do not repeat.\n\n vibrator.vibrate(VibrationEffect.createWaveform(timings, amplitudes, repeatIndex))\n\n### Java\n\n long[] timings = new long[] {\n 25, 25, 50, 25, 25, 25, 25, 25, 25, 25, 75, 25, 25,\n 300, 25, 25, 150, 25, 25, 25\n };\n int[] amplitudes = new int[] {\n 38, 77, 79, 84, 92, 99, 121, 143, 180, 217, 255, 170, 85,\n 0, 85, 170, 255, 170, 85, 0\n };\n int repeatIndex = -1; // Do not repeat.\n\n vibrator.vibrate(VibrationEffect.createWaveform(timings, amplitudes, repeatIndex));\n\n\nPlot of input waveform with additional steps. \nPlot of measured waveform, showing smoother transitions.\n\n\u003cbr /\u003e\n\nCreate more complex haptic effects\n----------------------------------\n\nOther elements in a satisfying click response are more intricate, requiring some\nknowledge of the LRA used in a device. For best results, use the device's\npre-fabricated waveforms and platform-provided constants, which let you do the\nfollowing:\n\n- Perform clear effects and [primitives](/develop/ui/views/haptics/custom-haptic-effects#primitives).\n- Concatenate them to compose new haptic effects.\n\nThese predefined haptic constants and primitives can greatly speed up your work\nwhile creating high-quality haptic effects."]]