{"id":247624,"date":"2022-07-25T08:31:22","date_gmt":"2022-07-25T00:31:22","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=247624"},"modified":"2022-07-22T10:13:11","modified_gmt":"2022-07-22T02:13:11","slug":"arm-linux-audio","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/arm-linux-audio.html","title":{"rendered":"\u7b80\u5355\u7684ARM+Linux\u97f3\u9891\u65b9\u6848"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u5d4c\u5165\u5f0f\u4ea7\u54c1\u5f00\u53d1\u4e2d\u7ecf\u5e38\u9047\u5230\u97f3\u9891\u7684\u8f93\u5165\u8f93\u51fa\u95ee\u9898\uff0c\u5982\u4f55\u4e3a\u5176\u6dfb\u52a0\u201c\u5587\u53ed\u201d\u3001\u201c\u9ea6\u514b\u98ce\u201d\u8bbe\u5907\u5462\uff1f\u672c\u6587\u5c06\u7b80\u5355\u4ecb\u7ecdARM+Linux\u4ea7\u54c1\u4e2d\u7684\u97f3\u9891\u89e3\u51b3\u65b9\u6848\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u6211\u4eec\u5148\u8ba4\u8bc6\u4e0bI2S\uff08Inter-IC Sound\uff09\u603b\u7ebf\u3002I2S\u53c8\u79f0\u96c6\u6210\u7535\u8def\u5185\u7f6e\u97f3\u9891\u603b\u7ebf\uff0c\u8be5\u603b\u7ebf\u4e13\u95e8\u7528\u4e8e\u97f3\u9891\u8bbe\u5907\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5404\u79cd\u591a\u5a92\u4f53\u7cfb\u7edf\u3002\u5b83\u91c7\u7528\u4e86\u6cbf\u72ec\u7acb\u7684\u5bfc\u7ebf\u4f20\u8f93\u65f6\u949f\u4e0e\u6570\u636e\u4fe1\u53f7\u7684\u8bbe\u8ba1\uff0c\u901a\u8fc7\u5c06\u6570\u636e\u548c\u65f6\u949f\u4fe1\u53f7\u5206\u79bb\uff0c\u6709\u6548\u907f\u514d\u56e0\u65f6\u5dee\u8bf1\u53d1\u7684\u5931\u771f\u3002<\/p>\n \u4ee5HDG2L-IoT\u8bc4\u4f30\u5957\u4ef6\u4e3a\u4f8b\uff0cRZ\/G2L\u5904\u7406\u5668\u63d0\u4f9b\u81f3\u5c11\u4e00\u8defI2S\u603b\u7ebf\uff0c\u901a\u8fc7\u8be5\u603b\u7ebf\u4e0e\u97f3\u9891\u7f16\u89e3\u7801\u82af\u7247\uff08IC\u578b\u53f7WM8960\uff09\u8fde\u63a5\uff0c\u7528\u4e8e\u63d0\u4f9b\u9ad8\u8d28\u91cf\u7684\u5f55\u97f3\u64ad\u97f3\u529f\u80fd\u3002\u97f3\u9891\u6a21\u5757\u7684\u786c\u4ef6\u90e8\u7f72\u5982\u4e0b\u6240\u793a\u3002<\/p>\n <\/p>\n G2L\u6838\u5fc3\u677f\u4e0eWM8960\u7684\u97f3\u9891\u901a\u8baf\u5f15\u811a\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n <\/p>\n \u5728Linux\u7cfb\u7edf\u7684\u97f3\u9891\u7f16\u89e3\u7801\u9a71\u52a8\u4e2d\uff0c\u901a\u8fc7I2C\u901a\u8baf\u63a5\u53e3\u4e0e\u97f3\u9891IC\u901a\u8baf\uff0c\u628a\u97f3\u9891IC\u5185\u7684\u5404\u4e2a\u529f\u80fd\u5bc4\u5b58\u5668\u62bd\u8c61\u6210\u97f3\u9891\u63a7\u4ef6\uff0c\u8fd9\u6837\u7528\u6237\u5373\u53ef\u5728User\u7a7a\u95f4\u5185\u76f4\u63a5\u8c03\u6574IC\u5185\u7684\u53c2\u6570\u3002I2S\u97f3\u9891\u5f15\u811a\uff0c\u5219\u662f\u6570\u5b57\u4fe1\u53f7\u53d1\u9001\u3001\u63a5\u6536\u7684\u901a\u9053\u3002<\/p>\n \u64ad\u97f3\u65f6\uff0c\u97f3\u9891IC\u63a5\u6536\u5230\u6570\u5b57\u4fe1\u53f7\u540e\u5219\u8f6c\u6362\u4e3a\u6a21\u62df\u4fe1\u53f7\u53d1\u9001\u51fa\u53bb\uff0c\u5f55\u97f3\u65f6\uff0c\u97f3\u9891IC\u628a\u6536\u5230\u7684\u97f3\u9891\u6a21\u62df\u91cf\u8f6c\u6362\u4e3a\u6570\u5b57\u91cf\uff0c\u53d1\u9001\u7ed9\u5904\u7406\u5668\u3002<\/p>\n ALSA\u662flinux\u7684\u4e3b\u6d41\u97f3\u9891\u4f53\u7cfb\u7ed3\u6784\uff0c\u5b83\u5305\u542b\u5185\u6838\u9a71\u52a8\u96c6\u5408\uff0c API \u5e93\u548c\u5de5\u5177\u5bf9 Linux \u58f0\u97f3\u8fdb\u884c\u652f\u6301\uff0c\u5e94\u7528\u7a0b\u5e8f\u53ea\u8981\u8c03\u7528alsa-lib\u63d0\u4f9b\u7684API\uff0c\u5373\u53ef\u4ee5\u5b8c\u6210\u5bf9\u5e95\u5c42\u97f3\u9891\u786c\u4ef6\u7684\u63a7\u5236\u3002<\/p>\n Linux\u901a\u8fc7alsa\u5e93\u4ee5\u53caalsa\u5de5\u5177\u7ba1\u7406\u97f3\u9891IC\u7684\u63a7\u4ef6\uff0c\u901a\u8fc7\u201camixer controls\u201d\u5217\u51fa\u5f53\u524d\u7cfb\u7edf\u5185\u7684\u97f3\u9891\u63a7\u5236\u9879\uff1a<\/p>\n <\/p>\n \u97f3\u9891\u529f\u80fd\u7684\u5173\u952e\u63a7\u4ef6\u4fe1\u606f\u5982\u4e0b\u6240\u793a\u3002\uff08\u5f55\u97f3\u901a\u9053\u3001\u64ad\u97f3\u901a\u9053\u3001\u8033\u673a\u97f3\u91cf\u5927\u5c0f\u3001\u5587\u53ed\u97f3\u91cf\u5927\u5c0f\uff09\u3002<\/p>\n \u5728\u5f00\u53d1\u677f\u4e0b\uff0c\u8fd0\u884caplay\u7a0b\u5e8f\u53ef\u4ee5\u5bf9\u97f3\u9891\u64ad\u653e\u8fdb\u884c\u6d4b\u8bd5\u3002\u5728\u6d4b\u8bd5\u524d\uff0c\u9700\u8981\u5c06\u8033\u673a\u63d2\u5165\u5f00\u53d1\u677f\u7684\u8033\u673a\u63d2\u5b54\u4e2d\u3002<\/p>\n \u4e3a\u6d4b\u8bd5\u57fa\u4e8eI2S\u7684\u97f3\u9891\u8f93\u51fa\u63a5\u53e3\uff0c\u5728\u547d\u4ee4\u884c\u4e0b\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n <\/p>\n \u5176\u4e2d2.wav\u4e3a\u9700\u8981\u64ad\u653e\u7684\u97f3\u9891\u6587\u4ef6\uff0c\u4e14\u6b64\u5904\u5047\u5b9a2.wav\u4f4d\u4e8e\/home\/root\/audios\u76ee\u5f55\u4e0b\u3002<\/p>\n \u5728\u8fdb\u884c\u97f3\u9891\u64ad\u653e\u65f6\uff0c\u5bf9\u4e8e\u57fa\u4e8eI2S\u7684\u97f3\u9891\u8f93\u51fa\u63a5\u53e3\uff0c\u53ef\u4ee5\u4f7f\u7528amixer\u7a0b\u5e8f\u5bf9\u97f3\u91cf\u8fdb\u884c\u8c03\u8282\u3002\u4f7f\u7528amixer\u7a0b\u5e8f\u5bf9\u8033\u673a\u64ad\u653e\u97f3\u91cf\u8fdb\u884c\u8c03\u8282\u7684\u547d\u4ee4\u884c\u683c\u5f0f\u4e3a\uff1a<\/p>\n <\/p>\n \u5176\u97f3\u91cf\u503c\u53d6\u503c\u8303\u56f4\u57280~127\u4e4b\u95f4\uff0c127\u8868\u660e\u6700\u5927\u97f3\u91cf\u3002\u4f8b\u5982\u8981\u5c06\u97f3\u91cf\u8bbe\u7f6e\u4e3a100\uff0c\u53ef\u5728\u547d\u4ee4\u884c\u4e0b\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n <\/p>\n \u5c06\u626c\u58f0\u5668\u63a5\u5165HDG2L-IOT\u5f00\u53d1\u677f\u7684\u5de6\u53f3\u58f0\u9053\u63d2\u5ea7\u4e2d\uff0c\u5728\u64ad\u653e\u97f3\u9891\u524d\u53ef\u5148\u8bbe\u7f6e\u626c\u58f0\u5668\u64ad\u653e\u97f3\u91cf\u4ee5\u53ca\u603b\u97f3\u91cf\uff0c\u7136\u540e\u64ad\u653e\u97f3\u9891\u6587\u4ef6\uff1a<\/p>\n <\/p>\n \u5f55\u97f3\u529f\u80fd\u9700\u8bbe\u7f6e\u5f55\u97f3\u63a7\u4ef6\u7684\u53c2\u6570\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n <\/p>\n \u7528arecord\u547d\u4ee4\u5f55\u97f3\u5e76\u4fdd\u5b58\u4e3a\u201c\/tmp\/t.wav\u201d\uff0c\u7136\u540e\u7528aplay\u547d\u4ee4\u56de\u653e\u8fdb\u884c\u9a8c\u8bc1\u3002<\/p>\n <\/p>\n \u7531\u4e8e\u5f53\u524d\u7684\u9ea6\u514b\u98ce\u8f93\u51fa\u4fe1\u53f7\u4ec5\u63a5\u5230\u4e86\u97f3\u9891\u5904\u7406\u7684Left\u7aef\u4f5c\u4e3a\u8f93\u5165\uff0c\u6240\u4ee5\u64ad\u653e\u5f55\u97f3\u6587\u4ef6\u65f6\u4ec5\u5de6\u58f0\u9053\u6709\u8f93\u51fa\uff0c\u82e5\u5e0c\u671b\u5c06\u9ea6\u514b\u98ce\u8f93\u51fa\u4fe1\u53f7\u540c\u65f6\u8bb0\u5f55\u5728\u5de6\u53f3\u58f0\u9053\u53ef\u505a\u5982\u4e0b\u8bbe\u7f6e\uff1a<\/p>\n <\/p>\n \u5c06\u201cADC Data Output Select\u201d\u8bbe\u5b9a\u4e3a1\uff0c\u5176\u503c\u542b\u4e49\u4e3a\u201cLeft Data = Left ADC; Right Data = Left ADC\u201d\u3002<\/p>\n \u7531\u4e0a\u53ef\u77e5\uff0c\u97f3\u9891\u7f16\u89e3\u7801\u82af\u7247\u5728Linux\u7cfb\u7edf\u4e2d\u4ee5\u63a7\u4ef6\u7684\u5f62\u5f0f\u5b58\u5728\uff0c\u5185\u90e8\u7684\u53c2\u6570\u4e00\u822c\u53ea\u8bb0\u5f55\u5728\u5185\u5b58\u4e2d\uff0c\u5f53\u7cfb\u7edf\u6389\u7535\u65f6\uff0c\u4fee\u6539\u7684\u53c2\u6570\u5c31\u4f1a\u6d88\u5931\uff0c\u6240\u4ee5\u9700\u8981\u4fdd\u5b58\u548c\u6062\u590d\u6307\u4ee4\u5c06\u4e0a\u6b21\u7684\u53c2\u6570\u4fdd\u5b58\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u3002<\/p>\n alsa\u7684\u914d\u7f6e\u6587\u4ef6\u4e3a\uff1a\/var\/lib\/alsa\/asound.state<\/p>\n \u63a7\u4ef6\u4fee\u6539\u540e\u7684\u5199\u5165\u64cd\u4f5c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n alsactl store<\/pre>\n |