แนวทางปฏิบัติแนะนำสำหรับเสียง
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หน้านี้มีคำแนะนำเกี่ยวกับวิธีการส่งข้อมูลเสียงพูดให้กับ Google Assistant API หลักเกณฑ์เหล่านี้ออกแบบมาเพื่อประสิทธิภาพและความถูกต้องมากขึ้น รวมถึงเวลาในการตอบสนองที่สมเหตุสมผลจากบริการ
การประมวลผลเสียงล่วงหน้า
วิธีที่ดีที่สุดคือการนำเสนอเสียงที่สะอาดที่สุดโดยใช้ไมโครโฟนที่มีคุณภาพดีและอยู่ในตำแหน่งที่เหมาะสม อย่างไรก็ตาม การใช้การประมวลผลสัญญาณการลดเสียงรบกวนกับเสียงก่อนที่จะส่งไปยังบริการมักจะลดความแม่นยำในการจดจำ บริการนี้ออกแบบมาให้รองรับเสียงที่มีเสียงดัง
เพื่อให้ได้ภาพที่ดีที่สุด ให้ทำดังนี้
- วางไมโครโฟนให้ใกล้กับผู้ใช้มากที่สุดเท่าที่จะทำได้ โดยเฉพาะเมื่อมีเสียงรบกวนรอบข้าง
- หลีกเลี่ยงการคลิปเสียง
- อย่าใช้การควบคุมค่าเกนอัตโนมัติ (AGC)
- ควรปิดใช้การประมวลผลการลดเสียงรบกวนทั้งหมด
หากเป็นไปได้
- คุณควรปรับเทียบระดับเสียงเพื่อให้สัญญาณอินพุตไม่ตัดออก และระดับเสียงพูดสูงสุดจะอยู่ที่ประมาณ -20 ถึง -10 dBFS
- อุปกรณ์ควรแสดงลักษณะของแอมพลิจูด "แฟลต" เทียบกับความถี่โดยประมาณ (+- 3 dB 100 Hz ถึง 8000 Hz)
- ความผิดเพี้ยนของฮาร์มอนิกทั้งหมดควรน้อยกว่า 1% ตั้งแต่ 100 Hz ถึง 8000 Hz ที่ระดับอินพุต SPL 90 dB
อัตราการสุ่มตัวอย่าง
หากเป็นไปได้ ให้ตั้งค่าอัตราการสุ่มตัวอย่างของแหล่งที่มาของเสียงเป็น 16000 Hz มิเช่นนั้นให้ตั้งค่า sample_rate_hertz
ให้ตรงกับอัตราการสุ่มตัวอย่างแบบดั้งเดิมของแหล่งที่มาของเสียง (แทนการสุ่มตัวอย่างซ้ำ)
ขนาดเฟรม
Google Assistant จะจดจำเสียงแบบสดเมื่อบันทึกจากไมโครโฟน
สตรีมเสียงต้องแยกเป็นเฟรมและส่งเป็นข้อความ AssistRequest
ข้อความติดต่อกัน เฟรมทุกขนาดยอมรับได้ เฟรมขนาดใหญ่จะมีประสิทธิภาพมากกว่า
แต่เพิ่มเวลาในการตอบสนอง แนะนำให้ใช้เฟรมขนาด 100 มิลลิวินาทีเพื่อแลกกับความคุ้มค่าระหว่างเวลาในการตอบสนองและประสิทธิภาพได้เป็นอย่างดี
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eThis page provides recommendations for submitting speech data to the Google Assistant API for optimal performance.\u003c/p\u003e\n"],["\u003cp\u003eFor best results, use a high-quality microphone, position it close to the user, avoid audio clipping and noise reduction processing, and disable automatic gain control.\u003c/p\u003e\n"],["\u003cp\u003eIdeally, calibrate audio levels to prevent clipping, maintain a flat frequency response, and minimize harmonic distortion.\u003c/p\u003e\n"],["\u003cp\u003eSet the audio source sampling rate to 16000 Hz if possible, or match the native rate, and use a frame size of around 100 milliseconds for a balance between latency and efficiency.\u003c/p\u003e\n"]]],[],null,["# Best Practices for Audio\n\nThis page contains recommendations on how to provide speech data to the\nGoogle Assistant API. These guidelines are designed for greater efficiency\nand accuracy as well as reasonable response times from the service.\n\nAudio pre-processing\n--------------------\n\nIt's best to provide audio that is as clean as possible by using a good quality\nand well-positioned microphone. However, applying noise-reduction signal\nprocessing to the audio before sending it to the service typically reduces\nrecognition accuracy. The service is designed to handle noisy audio.\n\nFor best results:\n\n- Position the microphone as close to the user as possible, particularly when background noise is present.\n- Avoid audio clipping.\n- Do not use automatic gain control (AGC).\n- All noise reduction processing should be disabled.\n\nIdeally:\n\n- The audio level should be calibrated so that the input signal does not clip, and peak speech audio levels reach approximately -20 to -10 dBFS.\n- The device should exhibit approximately \"flat\" amplitude versus frequency characteristics (+- 3 dB 100 Hz to 8000 Hz).\n- Total harmonic distortion should be less than 1% from 100 Hz to 8000 Hz at 90 dB SPL input level.\n\nSampling rate\n-------------\n\nIf possible, set the sampling rate of the audio source to 16000 Hz. Otherwise,\nset the [`sample_rate_hertz`](/assistant/sdk/reference/rpc/google.assistant.embedded.v1alpha2#google.assistant.embedded.v1alpha2.AudioInConfig) to match the native sample rate of the audio source (instead\nof re-sampling).\n\nFrame size\n----------\n\nThe Google Assistant recognizes live audio as it is captured from a microphone.\nThe audio stream must be split into frames and sent in consecutive\n`AssistRequest` messages. Any frame size is acceptable. Larger frames are more\nefficient, but add latency. A 100-millisecond frame size is recommended as a\ngood tradeoff between latency and efficiency."]]