اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
تحويل معدّل البيانات في الملف الصوتي
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
توضِّح هذه المقالة عملية تحويل معدل أخذ العينات، المعروفة أيضًا باسم إعادة أخذ العينات، في نظام التشغيل Android.
للاطّلاع على المصطلحات ذات الصلة بتحويل معدّل أخذ العينات، راجِع
المصطلحات.
تحويل معدّل أخذ العينات هو عملية تغيير بثّ عيّنات منفصلة
من معدّل أخذ عينات إلى بثّ آخر بمعدّل أخذ عينات مختلف.
محوِّل معدّل أخذ العينات أو أداة إعادة أخذ العينات هي وحدة تنفِّذ عملية
تحويل معدّل أخذ العينات. في ما يتعلّق بجهاز إعادة أخذ العينات، يُطلق على البث الأصلي اسم
إشارة المصدر، ويُطلق على البث الذي تم إعادة أخذ عيّنات منه اسم إشارة الوجهة.
يتم استخدام أدوات إعادة أخذ العينات في عدة مواضع في Android. على سبيل المثال، يمكن ترميز ملف MP3
بمعدّل بيانات في الملف الصوتي يبلغ 44.1 كيلوهرتز، ولكن يجب تشغيله على جهاز Android
يتوافق مع الصوت بمعدل 48 كيلوهرتز. في هذه الحالة، سيتم استخدام إعادة تحليل إشارة ملف صوتي
لزيادة معدل أخذ العينات في ملف MP3 الناتج من 44.1 كيلوهرتز إلى
48 كيلوهرتز في جهاز Android.
يمكن التعبير عن خصائص أداة إعادة أخذ العينات باستخدام المقاييس، بما في ذلك:
- درجة الحفاظ على السعة الإجمالية للإشارة
- درجة الحفاظ على عرض نطاق التردد للإشارة،
مع مراعاة القيود المفروضة على معدّل أخذ العينات في المصرف
- إجمالي وقت الاستجابة خلال عملية إعادة أخذ العينات
- مرحلة متّسقة وتأخُّر المجموعة بالنسبة إلى التردد
- التعقيد الحسابي، الذي يتم التعبير عنه بدورات وحدة المعالجة المركزية أو استهلاك الطاقة
- النسب المسموح بها لمعدّلات أخذ العينات في المصدر والوجهة
- إمكانية تغيير نسب معدّل أخذ العينات بشكل ديناميكي
- تنسيقات عيّنات الصوت الرقمية المتوافقة
يجب أن يحافظ مُعاد أخذ العينات المثالي على سعة تردد إشارة المصدر
وamplitude (وفقًا لقيود معدّل أخذ العينات
في جهاز الاستقبال)، وأن يحقّق تأخيرًا متسقًا بأقل قدر ممكن، وأن يحقّق كثافة حسابات منخفضة، وأن يسمح بنسب تحويل عشوائية وديناميكية،
وأن يتوافق مع جميع تنسيقات عيّنات الصوت الرقمية الشائعة. من الناحية العملية، لا تتوفّر أدوات إعادة تحليل مثالية، لأنّ أدوات إعادة التحليل الفعلية هي حل وسط بين هذه الخصائص. على سبيل المثال، تتعارض أهداف الجودة المثالية مع التأخير القصير
وانخفاض التعقيد.
يتضمّن Android مجموعة متنوعة من أدوات إعادة تحليل الصوت، بحيث يمكن إجراء التنازلات المناسبة
حسب حالة استخدام التطبيق وحمولته. يتم شرح
أدوات إعادة التحليل المتاحة في تنفيذ أدوات إعادة التحليل.
عمليات تنفيذ إعادة أخذ العينات
تتغيّر عمليات تنفيذ إعادة أخذ العينات المتاحة بشكل متكرّر،
وقد تُخصّصها المصنّعون الأصليون للأجهزة.
تشمل أدوات إعادة أخذ العينات التلقائية، بترتيب تنازلي حسب تشويه الإشارة وترتيب تصاعدي حسب الصعوبة الحسابية:
- خطي
- مكعّب
- دالة sinc مع المعاملات الأصلية
- sinc مع المعاملات المعدَّلة
بشكل عام، تكون أدوات إعادة التحليل sinc أكثر ملاءمةً لتشغيل الموسيقى بجودة أعلى، ويجب حجز أدوات إعادة التحليل الأخرى للحالات التي تكون فيها الجودة أقل أهمية (قد يكون أحد الأمثلة على ذلك "نقرات المفاتيح" أو ما شابه).
يعتمد التنفيذ المحدّد لمعدّل إعادة أخذ العينات الذي تم اختياره على
حالة الاستخدام والحمل وقيمة سمة النظام
af.resampler.quality
. لمعرفة التفاصيل،
يُرجى الرجوع إلى رمز المصدر الخاص بإعادة تحليل الصوت في
AudioFlinger.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-03-26 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-03-26 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Sample rate conversion\n\nThis article describes sample rate conversion, also known as *resampling* , within Android.\nFor terminology related to sample rate conversion, see\n[Terminology](/docs/core/audio/terminology#srcTerms).\n\n\nSample rate conversion is the process of changing a stream of discrete samples\nfrom one sample rate to another stream at a different sample rate.\nA sample rate converter, or resampler, is a module that implements sample rate\nconversion. With respect to the resampler, the original stream is called the\nsource signal, and the resampled stream is called the sink signal.\n\n\nResamplers are used in several places in Android. For example, an MP3 file may\nbe encoded at 44.1 kHz sample rate but needs to be played back on an Android\ndevice supporting 48 kHz audio internally. In that case, a resampler would be\nused to upsample the MP3 output audio from 44.1 kHz source sample rate to a\n48 kHz sink sample rate used within the Android device.\n\n\nThe characteristics of a resampler can be expressed using metrics, including:\n\n- degree of preservation of the overall amplitude of the signal\n- degree of preservation of the frequency bandwidth of the signal, subject to limitations of the sink sample rate\n- overall latency through the resampler\n- consistent phase and group delay with respect to frequency\n- computational complexity, expressed in CPU cycles or power draw\n- permitted ratios of source and sink sample rates\n- ability to dynamically change sample rate ratios\n- which digital audio sample formats are supported\n\n\nThe ideal resampler would exactly preserve the source signal's amplitude\nand frequency bandwidth (subject to limitations of the sink\nsample rate), have minimal and consistent delay, have minimal\ncomputational complexity, permit arbitrary and dynamic conversion ratios,\nand support all common digital audio sample formats. In practice, ideal\nresamplers do not exist as actual resamplers are a compromise among these\ncharacteristics. For example, goals of ideal quality conflict with short delay\nand low complexity.\n\n\nAndroid includes a variety of audio resamplers, so that appropriate\ncompromises can be made depending on the application use case and load. The\navailable resamplers are explained in [Resampler implementation.](#srcResamplers)\n\nResampler implementations\n-------------------------\n\n\nAvailable resampler implementations change frequently,\nand may be customized by OEMs.\nThe default resamplers, in descending order of signal distortion and ascending order of\ncomputational complexity, include:\n\n- linear\n- cubic\n- sinc with original coefficients\n- sinc with revised coefficients\n\n\nIn general, the sinc resamplers are more appropriate for higher-quality\nmusic playback, and the other resamplers should be reserved for cases\nwhere quality is less important (an example might be \"key clicks\" or similar).\n\n\nThe specific resampler implementation selected depends on\nthe use case, load, and the value of system property\n`af.resampler.quality`. For details,\nconsult the audio resampler source code in\n[AudioFlinger](https://android.googlesource.com/platform/frameworks/av/+/39ec5a7accf61d89a41908999bc789d5c8d0e3d3/services/audioflinger/)."]]