{"id":1139935,"date":"2025-01-08T22:15:11","date_gmt":"2025-01-08T14:15:11","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1139935.html"},"modified":"2025-01-08T22:15:13","modified_gmt":"2025-01-08T14:15:13","slug":"%e5%a6%82%e4%bd%95%e5%b0%86%e5%a3%b0%e9%9f%b3%e8%bd%ac%e5%8c%96%e6%88%90%e9%9f%b3%e8%b0%b1%e5%9b%bepython","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1139935.html","title":{"rendered":"\u5982\u4f55\u5c06\u58f0\u97f3\u8f6c\u5316\u6210\u97f3\u8c31\u56fePython"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25103056\/71b67e6d-005a-46cd-8bde-3e249ad33fbc.webp\" alt=\"\u5982\u4f55\u5c06\u58f0\u97f3\u8f6c\u5316\u6210\u97f3\u8c31\u56fePython\" \/><\/p>\n<p><p> <strong>\u5c06\u58f0\u97f3\u8f6c\u5316\u6210\u97f3\u8c31\u56fe\u7684\u6838\u5fc3\u6b65\u9aa4\u662f\uff1a\u52a0\u8f7d\u97f3\u9891\u6570\u636e\u3001\u8fdb\u884c\u77ed\u65f6\u5085\u91cc\u53f6\u53d8\u6362\u3001\u751f\u6210\u97f3\u8c31\u56fe\u3001\u53ef\u89c6\u5316\u97f3\u8c31\u56fe\u3002<\/strong>\u4e0b\u9762\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Python\u548c\u76f8\u5173\u5e93\u6765\u5b9e\u73b0\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u52a0\u8f7d\u97f3\u9891\u6570\u636e<\/h3>\n<\/p>\n<p><p>\u52a0\u8f7d\u97f3\u9891\u6570\u636e\u662f\u6574\u4e2a\u8fc7\u7a0b\u7684\u7b2c\u4e00\u6b65\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<code>librosa<\/code>\u5e93\u6765\u52a0\u8f7d\u97f3\u9891\u6570\u636e\u3002<code>librosa<\/code>\u662f\u4e00\u4e2a\u4e13\u95e8\u7528\u4e8e\u97f3\u9891\u548c\u97f3\u4e50\u5206\u6790\u7684Python\u5e93\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\u6765\u5904\u7406\u97f3\u9891\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import librosa<\/p>\n<h2><strong>\u52a0\u8f7d\u97f3\u9891\u6587\u4ef6<\/strong><\/h2>\n<p>file_path = &#39;path_to_audio_file.wav&#39;<\/p>\n<p>y, sr = librosa.load(file_path)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c<code>y<\/code>\u662f\u97f3\u9891\u65f6\u95f4\u5e8f\u5217\uff0c<code>sr<\/code>\u662f\u91c7\u6837\u7387\u3002<strong>\u91c7\u6837\u7387\u8868\u793a\u6bcf\u79d2\u949f\u91c7\u96c6\u7684\u6837\u672c\u6570<\/strong>\uff0c\u901a\u5e38\u4e3a22050 Hz\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u77ed\u65f6\u5085\u91cc\u53f6\u53d8\u6362\uff08STFT\uff09<\/h3>\n<\/p>\n<p><p>\u77ed\u65f6\u5085\u91cc\u53f6\u53d8\u6362\uff08STFT\uff09\u662f\u5c06\u65f6\u95f4\u57df\u4fe1\u53f7\u8f6c\u6362\u5230\u9891\u57df\u7684\u6807\u51c6\u65b9\u6cd5\u3002<strong>\u901a\u8fc7STFT\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u97f3\u9891\u4fe1\u53f7\u5206\u89e3\u6210\u591a\u4e2a\u9891\u7387\u6210\u5206\uff0c\u751f\u6210\u97f3\u8c31\u56fe<\/strong>\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<h2><strong>\u8ba1\u7b97STFT<\/strong><\/h2>\n<p>D = np.abs(librosa.stft(y))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>librosa.stft<\/code>\u51fd\u6570\u8ba1\u7b97\u97f3\u9891\u4fe1\u53f7\u7684STFT\uff0c\u8fd4\u56de\u4e00\u4e2a\u590d\u6570\u6570\u7ec4\u3002\u6211\u4eec\u4f7f\u7528<code>np.abs<\/code>\u51fd\u6570\u53d6\u5176\u7edd\u5bf9\u503c\uff0c\u5f97\u5230\u5e45\u5ea6\u8c31\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u751f\u6210\u97f3\u8c31\u56fe<\/h3>\n<\/p>\n<p><p>\u751f\u6210\u97f3\u8c31\u56fe\u662f\u5c06\u5e45\u5ea6\u8c31\u8f6c\u6362\u4e3adB\uff08\u5206\u8d1d\uff09\u5355\u4f4d\uff0c\u5e76\u8fdb\u884c\u53ef\u89c6\u5316\u3002dB\u5355\u4f4d\u66f4\u7b26\u5408\u4eba\u8033\u5bf9\u58f0\u97f3\u5f3a\u5ea6\u7684\u611f\u77e5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import librosa.display<\/p>\n<p>import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u8f6c\u6362\u4e3adB\u5355\u4f4d<\/strong><\/h2>\n<p>DB = librosa.amplitude_to_db(D, ref=np.max)<\/p>\n<h2><strong>\u751f\u6210\u97f3\u8c31\u56fe<\/strong><\/h2>\n<p>plt.figure(figsize=(10, 4))<\/p>\n<p>librosa.display.specshow(DB, sr=sr, x_axis=&#39;time&#39;, y_axis=&#39;log&#39;)<\/p>\n<p>plt.colorbar(format=&#39;%+2.0f dB&#39;)<\/p>\n<p>plt.title(&#39;Spectrogram&#39;)<\/p>\n<p>plt.tight_layout()<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c<code>librosa.display.specshow<\/code>\u51fd\u6570\u7528\u4e8e\u663e\u793a\u97f3\u8c31\u56fe\uff0c\u5e76\u4f7f\u7528<code>plt.colorbar<\/code>\u6dfb\u52a0\u989c\u8272\u6761\u3002<strong>x\u8f74\u8868\u793a\u65f6\u95f4\uff0cy\u8f74\u8868\u793a\u9891\u7387\uff0c\u989c\u8272\u8868\u793a\u5f3a\u5ea6\uff08dB\uff09<\/strong>\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u53ef\u89c6\u5316\u97f3\u8c31\u56fe<\/h3>\n<\/p>\n<p><p>\u53ef\u89c6\u5316\u97f3\u8c31\u56fe\u5bf9\u4e8e\u5206\u6790\u97f3\u9891\u4fe1\u53f7\u975e\u5e38\u91cd\u8981\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<code>matplotlib<\/code>\u5e93\u6765\u5b9e\u73b0\u53ef\u89c6\u5316\u3002\u6211\u4eec\u5df2\u7ecf\u5728\u4e0a\u4e00\u6b65\u4e2d\u5c55\u793a\u4e86\u5982\u4f55\u751f\u6210\u97f3\u8c31\u56fe\uff0c\u4f46\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6211\u4eec\u53ef\u80fd\u9700\u8981\u8fdb\u4e00\u6b65\u8c03\u6574\u548c\u4f18\u5316\u53ef\u89c6\u5316\u6548\u679c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8fdb\u4e00\u6b65\u4f18\u5316\u53ef\u89c6\u5316\u6548\u679c<\/p>\n<p>plt.figure(figsize=(10, 4))<\/p>\n<p>librosa.display.specshow(DB, sr=sr, x_axis=&#39;time&#39;, y_axis=&#39;log&#39;, cmap=&#39;coolwarm&#39;)<\/p>\n<p>plt.colorbar(format=&#39;%+2.0f dB&#39;)<\/p>\n<p>plt.title(&#39;Optimized Spectrogram&#39;)<\/p>\n<p>plt.tight_layout()<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u4e0d\u540c\u7684\u989c\u8272\u6620\u5c04\uff08<code>cmap=&#39;coolwarm&#39;<\/code>\uff09\u6765\u66f4\u597d\u5730\u5c55\u793a\u97f3\u8c31\u56fe\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u4fdd\u5b58\u97f3\u8c31\u56fe<\/h3>\n<\/p>\n<p><p>\u6709\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u5c06\u751f\u6210\u7684\u97f3\u8c31\u56fe\u4fdd\u5b58\u4e3a\u56fe\u50cf\u6587\u4ef6\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<code>matplotlib<\/code>\u5e93\u7684<code>savefig<\/code>\u51fd\u6570\u6765\u5b9e\u73b0\u8fd9\u4e00\u70b9\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u4fdd\u5b58\u97f3\u8c31\u56fe<\/p>\n<p>plt.figure(figsize=(10, 4))<\/p>\n<p>librosa.display.specshow(DB, sr=sr, x_axis=&#39;time&#39;, y_axis=&#39;log&#39;)<\/p>\n<p>plt.colorbar(format=&#39;%+2.0f dB&#39;)<\/p>\n<p>plt.title(&#39;Spectrogram&#39;)<\/p>\n<p>plt.tight_layout()<\/p>\n<p>plt.savefig(&#39;spectrogram.png&#39;)<\/p>\n<p>plt.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>plt.savefig<\/code>\u51fd\u6570\u5c06\u97f3\u8c31\u56fe\u4fdd\u5b58\u4e3aPNG\u683c\u5f0f\u7684\u56fe\u50cf\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u8be6\u7ec6\u6848\u4f8b\u5206\u6790<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u8fdb\u4e00\u6b65\u7406\u89e3\u5982\u4f55\u5c06\u58f0\u97f3\u8f6c\u5316\u6210\u97f3\u8c31\u56fe\uff0c\u6211\u4eec\u6765\u770b\u4e00\u4e2a\u8be6\u7ec6\u7684\u6848\u4f8b\u3002\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a\u5305\u542b\u9e1f\u53eb\u58f0\u7684\u97f3\u9891\u6587\u4ef6\uff0c\u6211\u4eec\u5e0c\u671b\u901a\u8fc7\u751f\u6210\u97f3\u8c31\u56fe\u6765\u5206\u6790\u9e1f\u53eb\u58f0\u7684\u9891\u7387\u7279\u5f81\u3002<\/p>\n<\/p>\n<p><h4>1. \u52a0\u8f7d\u97f3\u9891\u6570\u636e<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6211\u4eec\u4f7f\u7528<code>librosa<\/code>\u5e93\u52a0\u8f7d\u97f3\u9891\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import librosa<\/p>\n<h2><strong>\u52a0\u8f7d\u9e1f\u53eb\u58f0\u97f3\u9891\u6587\u4ef6<\/strong><\/h2>\n<p>file_path = &#39;bird_song.wav&#39;<\/p>\n<p>y, sr = librosa.load(file_path)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u8ba1\u7b97STFT<\/h4>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u8ba1\u7b97\u97f3\u9891\u4fe1\u53f7\u7684STFT\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<h2><strong>\u8ba1\u7b97STFT<\/strong><\/h2>\n<p>D = np.abs(librosa.stft(y))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u8f6c\u6362\u4e3adB\u5355\u4f4d<\/h4>\n<\/p>\n<p><p>\u6211\u4eec\u5c06\u5e45\u5ea6\u8c31\u8f6c\u6362\u4e3adB\u5355\u4f4d\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8f6c\u6362\u4e3adB\u5355\u4f4d<\/p>\n<p>DB = librosa.amplitude_to_db(D, ref=np.max)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4. \u751f\u6210\u548c\u4f18\u5316\u97f3\u8c31\u56fe<\/h4>\n<\/p>\n<p><p>\u6211\u4eec\u751f\u6210\u5e76\u4f18\u5316\u97f3\u8c31\u56fe\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u5206\u6790\u9e1f\u53eb\u58f0\u7684\u9891\u7387\u7279\u5f81\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import librosa.display<\/p>\n<p>import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u751f\u6210\u548c\u4f18\u5316\u97f3\u8c31\u56fe<\/strong><\/h2>\n<p>plt.figure(figsize=(10, 4))<\/p>\n<p>librosa.display.specshow(DB, sr=sr, x_axis=&#39;time&#39;, y_axis=&#39;log&#39;, cmap=&#39;coolwarm&#39;)<\/p>\n<p>plt.colorbar(format=&#39;%+2.0f dB&#39;)<\/p>\n<p>plt.title(&#39;Bird Song Spectrogram&#39;)<\/p>\n<p>plt.tight_layout()<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>5. \u4fdd\u5b58\u97f3\u8c31\u56fe<\/h4>\n<\/p>\n<p><p>\u6700\u540e\uff0c\u6211\u4eec\u5c06\u751f\u6210\u7684\u97f3\u8c31\u56fe\u4fdd\u5b58\u4e3a\u56fe\u50cf\u6587\u4ef6\uff0c\u4ee5\u4fbf\u540e\u7eed\u5206\u6790\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u4fdd\u5b58\u97f3\u8c31\u56fe<\/p>\n<p>plt.figure(figsize=(10, 4))<\/p>\n<p>librosa.display.specshow(DB, sr=sr, x_axis=&#39;time&#39;, y_axis=&#39;log&#39;)<\/p>\n<p>plt.colorbar(format=&#39;%+2.0f dB&#39;)<\/p>\n<p>plt.title(&#39;Bird Song Spectrogram&#39;)<\/p>\n<p>plt.tight_layout()<\/p>\n<p>plt.savefig(&#39;bird_song_spectrogram.png&#39;)<\/p>\n<p>plt.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u6211\u4eec\u6210\u529f\u5730\u5c06\u9e1f\u53eb\u58f0\u97f3\u9891\u6587\u4ef6\u8f6c\u6362\u6210\u4e86\u97f3\u8c31\u56fe\uff0c\u5e76\u4fdd\u5b58\u4e3a\u56fe\u50cf\u6587\u4ef6\u3002\u901a\u8fc7\u5206\u6790\u97f3\u8c31\u56fe\uff0c\u6211\u4eec\u53ef\u4ee5\u89c2\u5bdf\u5230\u4e0d\u540c\u9891\u7387\u6210\u5206\u7684\u5f3a\u5ea6\u53d8\u5316\uff0c\u4ece\u800c\u8fdb\u4e00\u6b65\u4e86\u89e3\u9e1f\u53eb\u58f0\u7684\u9891\u7387\u7279\u5f81\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u6269\u5c55\u5e94\u7528<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u9e1f\u53eb\u58f0\uff0c\u97f3\u8c31\u56fe\u5728\u8bb8\u591a\u5176\u4ed6\u9886\u57df\u4e5f\u6709\u5e7f\u6cdb\u5e94\u7528\uff0c\u5982\u97f3\u4e50\u5206\u6790\u3001\u8bed\u97f3\u8bc6\u522b\u3001\u73af\u5883\u58f0\u97f3\u76d1\u6d4b\u7b49\u3002\u4e0b\u9762\uff0c\u6211\u4eec\u7b80\u8981\u4ecb\u7ecd\u51e0\u4e2a\u6269\u5c55\u5e94\u7528\u3002<\/p>\n<\/p>\n<p><h4>1. \u97f3\u4e50\u5206\u6790<\/h4>\n<\/p>\n<p><p>\u97f3\u8c31\u56fe\u5728\u97f3\u4e50\u5206\u6790\u4e2d\u975e\u5e38\u6709\u7528\u3002\u901a\u8fc7\u751f\u6210\u97f3\u8c31\u56fe\uff0c\u6211\u4eec\u53ef\u4ee5\u5206\u6790\u4e50\u66f2\u7684\u9891\u7387\u6210\u5206\u3001\u8282\u594f\u548c\u548c\u58f0\u7b49\u7279\u5f81\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u97f3\u8c31\u56fe\u8bc6\u522b\u6b4c\u66f2\u4e2d\u7684\u4e0d\u540c\u4e50\u5668\u548c\u4eba\u58f0\u90e8\u5206\u3002<\/p>\n<\/p>\n<p><h4>2. \u8bed\u97f3\u8bc6\u522b<\/h4>\n<\/p>\n<p><p>\u5728\u8bed\u97f3\u8bc6\u522b\u7cfb\u7edf\u4e2d\uff0c\u97f3\u8c31\u56fe\u662f\u5e38\u7528\u7684\u7279\u5f81\u8868\u793a\u65b9\u6cd5\u3002\u901a\u8fc7\u751f\u6210\u8bed\u97f3\u4fe1\u53f7\u7684\u97f3\u8c31\u56fe\uff0c\u6211\u4eec\u53ef\u4ee5\u63d0\u53d6\u8bed\u97f3\u7684\u9891\u7387\u7279\u5f81\uff0c\u5e76\u8f93\u5165\u5230<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u6a21\u578b\u4e2d\u8fdb\u884c\u8bc6\u522b\u548c\u5206\u7c7b\u3002<\/p>\n<\/p>\n<p><h4>3. \u73af\u5883\u58f0\u97f3\u76d1\u6d4b<\/h4>\n<\/p>\n<p><p>\u97f3\u8c31\u56fe\u5728\u73af\u5883\u58f0\u97f3\u76d1\u6d4b\u4e2d\u4e5f\u6709\u91cd\u8981\u5e94\u7528\u3002\u901a\u8fc7\u751f\u6210\u73af\u5883\u58f0\u97f3\u7684\u97f3\u8c31\u56fe\uff0c\u6211\u4eec\u53ef\u4ee5\u68c0\u6d4b\u548c\u8bc6\u522b\u4e0d\u540c\u7684\u73af\u5883\u58f0\u97f3\uff0c\u5982\u4ea4\u901a\u566a\u97f3\u3001\u81ea\u7136\u58f0\u97f3\u548c\u5de5\u4e1a\u566a\u97f3\u7b49\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5c06\u58f0\u97f3\u8f6c\u5316\u6210\u97f3\u8c31\u56fe\u662f\u97f3\u9891\u4fe1\u53f7\u5904\u7406\u4e2d\u7684\u91cd\u8981\u6b65\u9aa4\u3002\u901a\u8fc7\u52a0\u8f7d\u97f3\u9891\u6570\u636e\u3001\u8ba1\u7b97STFT\u3001\u751f\u6210\u548c\u53ef\u89c6\u5316\u97f3\u8c31\u56fe\uff0c\u6211\u4eec\u53ef\u4ee5\u5206\u6790\u97f3\u9891\u4fe1\u53f7\u7684\u9891\u7387\u7279\u5f81\uff0c\u5e76\u5e94\u7528\u4e8e\u97f3\u4e50\u5206\u6790\u3001\u8bed\u97f3\u8bc6\u522b\u548c\u73af\u5883\u58f0\u97f3\u76d1\u6d4b\u7b49\u9886\u57df\u3002Python\u548c<code>librosa<\/code>\u5e93\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u4f7f\u5f97\u8fd9\u4e00\u8fc7\u7a0b\u53d8\u5f97\u7b80\u5355\u800c\u9ad8\u6548\u3002\u5e0c\u671b\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u60a8\u80fd\u591f\u6df1\u5165\u7406\u89e3\u548c\u638c\u63e1\u5c06\u58f0\u97f3\u8f6c\u5316\u6210\u97f3\u8c31\u56fe\u7684\u65b9\u6cd5\u548c\u6280\u5de7\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u5c06\u97f3\u9891\u6587\u4ef6\u8f6c\u6362\u6210\u97f3\u8c31\u56fe\uff1f<\/strong><br \/>\u8981\u5c06\u97f3\u9891\u6587\u4ef6\u8f6c\u6362\u4e3a\u97f3\u8c31\u56fe\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u4e2d\u7684\u4e00\u4e9b\u6d41\u884c\u5e93\uff0c\u5982Librosa\u548cMatplotlib\u3002\u9996\u5148\uff0c\u5b89\u88c5Librosa\u5e93\u5e76\u52a0\u8f7d\u97f3\u9891\u6587\u4ef6\u3002\u63a5\u7740\uff0c\u4f7f\u7528Librosa\u7684<code>stft()<\/code>\u51fd\u6570\u8ba1\u7b97\u77ed\u65f6\u5085\u91cc\u53f6\u53d8\u6362\uff0c\u6700\u540e\u5c06\u7ed3\u679c\u53ef\u89c6\u5316\u4e3a\u97f3\u8c31\u56fe\u3002\u5177\u4f53\u4ee3\u7801\u793a\u4f8b\u53ef\u4ee5\u5728\u76f8\u5173\u6587\u6863\u548c\u793e\u533a\u4e2d\u627e\u5230\u3002<\/p>\n<p><strong>\u6709\u54ea\u4e9b\u5e38\u89c1\u7684Python\u5e93\u53ef\u4ee5\u5e2e\u52a9\u751f\u6210\u97f3\u8c31\u56fe\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u751f\u6210\u97f3\u8c31\u56fe\u7684\u5e38\u7528\u5e93\u5305\u62ecLibrosa\u3001Matplotlib\u3001NumPy\u548cSciPy\u3002Librosa\u4e13\u6ce8\u4e8e\u97f3\u9891\u5206\u6790\uff0c\u63d0\u4f9b\u4e86\u97f3\u9891\u52a0\u8f7d\u3001\u5904\u7406\u548c\u97f3\u8c31\u56fe\u751f\u6210\u7684\u529f\u80fd\u3002Matplotlib\u5219\u7528\u4e8e\u53ef\u89c6\u5316\u97f3\u9891\u6570\u636e\u3002\u7ed3\u5408\u4f7f\u7528\u8fd9\u4e9b\u5e93\u53ef\u4ee5\u5b9e\u73b0\u9ad8\u8d28\u91cf\u7684\u97f3\u8c31\u56fe\u751f\u6210\u3002<\/p>\n<p><strong>\u97f3\u8c31\u56fe\u7684\u5e94\u7528\u573a\u666f\u6709\u54ea\u4e9b\uff1f<\/strong><br \/>\u97f3\u8c31\u56fe\u5e7f\u6cdb\u5e94\u7528\u4e8e\u97f3\u4e50\u5206\u6790\u3001\u8bed\u97f3\u8bc6\u522b\u3001\u97f3\u9891\u5206\u7c7b\u548c\u4fe1\u53f7\u5904\u7406\u7b49\u9886\u57df\u3002\u5728\u97f3\u4e50\u9886\u57df\uff0c\u97f3\u8c31\u56fe\u53ef\u4ee5\u5e2e\u52a9\u97f3\u4e50\u5bb6\u5206\u6790\u97f3\u9891\u7279\u5f81\uff1b\u5728\u8bed\u97f3\u8bc6\u522b\u4e2d\uff0c\u5b83\u88ab\u7528\u4e8e\u63d0\u53d6\u8bed\u97f3\u4fe1\u53f7\u7684\u7279\u5f81\uff1b\u5728\u97f3\u9891\u5206\u7c7b\u4efb\u52a1\u4e2d\uff0c\u97f3\u8c31\u56fe\u53ef\u4f5c\u4e3a\u673a\u5668\u5b66\u4e60\u6a21\u578b\u7684\u8f93\u5165\u7279\u5f81\u3002\u901a\u8fc7\u8fd9\u4e9b\u5e94\u7528\uff0c\u97f3\u8c31\u56fe\u6210\u4e3a\u97f3\u9891\u6570\u636e\u5206\u6790\u7684\u91cd\u8981\u5de5\u5177\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5c06\u58f0\u97f3\u8f6c\u5316\u6210\u97f3\u8c31\u56fe\u7684\u6838\u5fc3\u6b65\u9aa4\u662f\uff1a\u52a0\u8f7d\u97f3\u9891\u6570\u636e\u3001\u8fdb\u884c\u77ed\u65f6\u5085\u91cc\u53f6\u53d8\u6362\u3001\u751f\u6210\u97f3\u8c31\u56fe\u3001\u53ef\u89c6\u5316\u97f3\u8c31\u56fe\u3002\u4e0b\u9762\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb [&hellip;]","protected":false},"author":3,"featured_media":1139944,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1139935"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1139935"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1139935\/revisions"}],"predecessor-version":[{"id":1139945,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1139935\/revisions\/1139945"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1139944"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1139935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1139935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1139935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}