ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
วัดเวลาในการตอบสนองของเสียง
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เนื่องจากความยากในการวัดเวลาในการตอบสนองของอินพุตหรือเอาต์พุตแยกกันด้วยฮาร์ดแวร์ที่กำหนดเอง เวลาในการตอบสนองของเสียงจึงวัดเป็นเวลาในการตอบสนองแบบไปกลับ ซึ่งแสดงถึงเวลาในการตอบสนองของอินพุตและเอาต์พุตรวมกัน
เทคนิค
ซอฟต์แวร์ทดสอบจะดำเนินการตามขั้นตอนต่อไปนี้โดยอัตโนมัติ
- ซอฟต์แวร์จะสร้างเสียงที่ซับซ้อนโดยใช้เสียงไวท์นอยส์สั้นๆ ที่มีความยาวแตกต่างกัน
เพื่อสร้างโครงสร้างที่จดจำได้ง่าย
- เส้นทางเอาต์พุตเสียงของอุปกรณ์จะเล่นเสียง
- การทดสอบจะวนเอาต์พุตเสียงกลับไปเป็นอินพุตเสียง
- สำหรับเส้นทางของลำโพงและไมโครโฟน ไม่จำเป็นต้องใช้ฮาร์ดแวร์เพิ่มเติมเนื่องจากไมโครโฟนในตัวจะบันทึกเสียงที่เล่นจากลำโพงในตัว
- แจ็คแอนะล็อก 3.5 มม. ใช้ Audio loopback dongle ที่กำหนดเอง
- พอร์ต USB จะใช้อะแดปเตอร์ USB เป็น 3.5 มม. ร่วมกับดองเกิลลูปแบ็ก หรือใช้อินเทอร์เฟซเสียง USB
พร้อมสายที่เชื่อมต่อเอาต์พุตกับอินพุต
- ซอฟต์แวร์ทดสอบจะบันทึกเสียงที่วนกลับ
- ซอฟต์แวร์ทดสอบใช้สตรีมแบบฟูลดูเพล็กซ์เพื่อซิงค์และบันทึกทั้ง
สตรีมเสียงเอาต์พุตและอินพุตพร้อมกัน
รูปต่อไปนี้แสดงการตั้งค่าการทดสอบ
รูปที่ 1 วัดเวลาในการตอบสนองของเสียง
ความหน่วงแบบไปกลับจะพิจารณาโดยการวัดออฟเซ็ตเวลาของเอาต์พุตและอินพุต
โดยใช้อัลกอริทึมสหสัมพันธ์ที่ปรับให้เป็นมาตรฐานเพื่อค้นหาโทนเอาต์พุตภายในสตรีมอินพุต
รูปต่อไปนี้แสดงวิธีคำนวณเวลาในการรับส่ง
รูปที่ 2 คำนวณเวลาในการตอบสนองแบบไปกลับ
ดูข้อมูลเพิ่มเติมเกี่ยวกับฮาร์ดแวร์ลูปแบ็กได้ที่อุปกรณ์ต่อพ่วงเสียงของ CTS Verifier
แอปทดสอบ
ส่วนนี้อธิบายแอปหลัก 2 แอปสำหรับการวัดเวลาในการตอบสนอง ทั้งสองใช้เทคนิคเดียวกัน
และคาดว่าจะให้ผลลัพธ์ที่เทียบเคียงกันได้
OboeTester
OboeTester ซึ่งเป็นชุดทดสอบที่ออกแบบมาสำหรับไลบรารี Oboe มีการทดสอบที่มีประโยชน์ รวมถึงการวัดเวลาในการรับส่ง
คุณรับ OboeTester ได้ 2 วิธี ดังนี้
ทำตามขั้นตอนต่อไปนี้เพื่อวัดเวลาในการตอบสนองในแอป OboeTester
- เปิด OboeTester
- แตะเวลาในการรับส่ง
- แตะวัด
- ตรวจสอบค่า
latency.msec
สำหรับเวลาในการตอบสนองแบบไปกลับ
คุณเรียกใช้การทดสอบนี้ได้โดยใช้Intent สำหรับการผสานรวมอย่างต่อเนื่อง
โปรแกรมตรวจสอบ CTS
ดูการทดสอบเวลาในการตอบสนองแบบวนรอบของเสียง ใน CTS Verifier
เพื่อดูว่าเวลาในการตอบสนองแบบวนรอบเป็นไปตามข้อกำหนดของ CDD หรือไม่
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-10 UTC
[[["เข้าใจง่าย","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-08-10 UTC"],[],[],null,["# Measure audio latency\n\nGiven the difficulty of measuring input or output latency in isolation with custom hardware, audio\nlatency is measured as *round-trip latency*, which represents the combined input and output\nlatency.\n\nTechnique\n---------\n\n\nThe following steps are automated by the test software:\n\n1. The software generates a complex tone using short bursts of white noise of varying lengths, creating an easily recognizable structure.\n2. The device's audio output path plays the tone.\n3. The test loops back the audio output to an audio input.\n - For speaker and microphone paths, no additional hardware is needed as the built-in microphone records the sound played from the built-in speaker.\n - Analog 3.5 mm jacks use a custom [Audio loopback dongle](/docs/core/audio/latency/loopback).\n - USB ports use either a USB to 3.5 mm adapter combined with the loopback dongle or a USB audio interface with cables connecting the output to the input.\n4. The test software records the looped-back audio.\n5. The test software employs a full-duplex stream to synchronize and simultaneously record both the output and input audio streams.\n\nThe following figure shows the test setup:\n\n\n**Figure 1.** Measure audio latency.\n\nRound-trip latency is determined by measuring the time offset between the output and input,\nusing a normalized correlation algorithm to locate the output tone within the input stream.\n\nThe following figure shows how the round-trip latency is calculated:\n\n\n**Figure 2.** Calculate round-trip latency.\n\nSee [CTS Verifier audio peripherals](/docs/compatibility/cts/audio-peripherals) for\nmore information about the loopback hardware.\n\nTest apps\n---------\n\n\nThis section describes two main apps for measuring latency. Both use identical techniques\nand are expected to yield comparable results.\n\n### OboeTester\n\n\nOboeTester, a test suite designed for the Oboe library, offers valuable tests, including round-trip\nlatency measurement.\n\n\nYou can get OboeTester in one of two ways:\n\n- Build the app from source, which can be found on [GitHub](https://github.com/google/oboe/tree/main/apps/OboeTester/docs).\n- Install the app from [Google Play Store](https://play.google.com/store/apps/details?id=com.mobileer.oboetester).\n\n\nFollow these steps to measure the latency on the OboeTester app:\n\n1. Launch OboeTester.\n2. Tap **ROUND TRIP LATENCY**.\n3. Tap **MEASURE**.\n4. Check the `latency.msec` value for the round-trip latency.\n\n\nYou can run this test using an [Intent for Continuous Integration](https://github.com/google/oboe/blob/main/apps/OboeTester/docs/AutomatedTesting.md).\n\n### CTS Verifier\n\n\nSee the CTS Verifier [Audio loopback latency test](/docs/compatibility/cts/audio-loopback-latency)\nto determine if round-trip latency meets CDD requirements."]]