歌曲识别 songrec -开源 shazam

听歌识曲 song recognition

安装

sudo apt install cargo rustc -y 

echo 'export PATH="HOME/.cargo/bin:PATH"' | tee -a ~/.profile ~/.bashrc source ~/.bashrc sudo apt install build-essential libasound2-dev libgtk-3-dev libssl-dev -y 

cargo install songrec 

songrec

cargo 太慢 的加速方案

cd ~/.cargo/
touch config
nano config

复制以下信息粘贴过去,ctrl+o 保存,ctrl+x退出

[source.crates-io] 
registry = "https://github.com/rust-lang/crates.io-index" 
# 指定镜像(下面几个里选一个) 
replace-with = 'ustc' 
# 清华大学 
[source.tuna] registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git" 
# 中国科学技术大学 
[source.ustc] registry = "git://mirrors.ustc.edu.cn/crates.io-index" 
# 上海交通大学 
[source.sjtu] registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index" 
# rustcc社区 
[source.rustcc0] registry = "https://code.aliyun.com/rustcc/crates.io-index.git" [source.rustcc1] 
registry="git://crates.rustcc.cn/crates.io-index" 
[source.rustcc2]
 registry="git://crates.rustcc.com/crates.io-index"

以上配置信息参考以下文章:https://www.cnblogs.com/onsunsl/p/rust-cargo-proxy-and-crates-io-china-mirro.html

重新运行 cargo install songrec

使用

songrec audio-file-to-recognized-song sound_file.mp3

效果

songrec audio-file-to-recognized-song 小城大事-\ 杨千嬅.flac

得到

{
   "location": {
     "altitude": 300.0,
     "latitude": 45.0,
     "longitude": 2.0
   },
   "matches": [
     {
       "channel": "0",
       "frequencyskew": -0.000080525875,
       "id": "211328242",
       "offset": 98.397078125,
       "timeskew": 0.00020325184
     }
   ],
   "tagid": "f8363b97-85e9-477e-842f-76e15de54231",
   "timestamp": 308436620,
   "timezone": "Europe/Paris",
   "track": {
     "albumadamid": "905172864",
     "artists": [
       {
         "adamid": "19433132",
         "id": "40063263"
       }
     ],
     "genres": {
       "primary": "Pop cantonaise"
     },
     "highlightsurls": {
       "artisthighlightsurl": "https://cdn.shazam.com/video/v3/fr/CH/android/40063263/40774356/highlights?affiliate=mttnagencyid%3D769459046716559743%26mttnsiteid%3D125115%26mttn3pid%3Da_custom_779816081798873874%26mttnsub1%3DShazam_android_am%26mttnsub2%3D5348615A-616D-3235-3830-44754D6D5973%26itscg%3D30201%26app%3Dmusic%26itsct%3DShazam_android_am",
       "relatedhighlightsurl": "https://cdn.shazam.com/video/v3/fr/CH/android/40063263/artist-similarities-id-40063263/relatedhighlights?max_artists=5&affiliate=mttnagencyid%3D769459046716559743%26mttnsiteid%3D125115%26mttn3pid%3Da_custom_779816081798873874%26mttnsub1%3DShazam_android_am%26mttnsub2%3D5348615A-616D-3235-3830-44754D6D5973%26itscg%3D30201%26app%3Dmusic%26itsct%3DShazam_android_am"
     },
     "hub": {
       "actions": [
         {
           "id": "905172869",
           "name": "apple",
           "type": "applemusicplay"
         },
         {
           "name": "apple",
           "type": "uri",
           "uri": "https://audio-ssl.itunes.apple.com/itunes-assets/Music3/v4/18/31/c6/1831c618-1321-ee79-7609-72acbd754395/mzaf_2517155932408704426.plus.aac.ep.m4a"
         }
       ],
       "displayname": "APPLE MUSIC",
       "explicit": false,
       "image": "https://images.shazam.com/static/icons/hub/android/v5/applemusic_{scalefactor}.png",
       "options": [
         {
           "actions": [
             {
               "name": "hub:applemusic:deeplink",
               "type": "intent",
               "uri": "intent://music.apple.com/ch/album/%E5%B0%8F%E5%9F%8E%E5%A4%A7%E4%BA%8B/905172864?i=905172869&mttnagencyid=769459046716559743&mttnsiteid=125115&mttn3pid=a_custom_779816081798873874&mttnsub1=Shazam_android_am&mttnsub2=5348615A-616D-3235-3830-44754D6D5973&itscg=30201&app=music&itsct=Shazam_android_am#Intent;scheme=http;package=com.apple.android.music;action=android.intent.action.VIEW;end"
             },
             {
               "id": "905172869",
               "name": "hub:applemusic:connect",
               "type": "applemusicconnect",
               "uri": "https://unsupported.shazam.com"
             },
             {
               "name": "hub:applemusic:androidstore",
               "type": "uri",
               "uri": "https://play.google.com/store/apps/details?id=com.apple.android.music&referrer=utm_source=https%3A%2F%2Fmusic.apple.com%2Fsubscribe%3Fmttnagencyid%3D769459046716559743%26mttnsiteid%3D125115%26mttn3pid%3Da_custom_779816081798873874%26mttnsub1%3DShazam_android_am%26mttnsub2%3D5348615A-616D-3235-3830-44754D6D5973%26itscg%3D30201%26app%3Dmusic%26itsct%3DShazam_android_am"
             }
           ],
           "beacondata": {
             "providername": "applemusic",
             "type": "open"
           },
           "caption": "OUVRIR",
           "colouroverflowimage": false,
           "image": "https://images.shazam.com/static/icons/hub/android/v5/overflow-open-option_{scalefactor}.png",
           "listcaption": "Ouvrir dans Apple Music",
           "overflowimage": "https://images.shazam.com/static/icons/hub/android/v5/applemusic-overflow_{scalefactor}.png",
           "providername": "applemusic",
           "type": "open"
         }
       ],
       "providers": [
         {
           "actions": [
             {
               "name": "hub:spotify:androidsearchdeeplink",
               "type": "intent",
               "uri": "intent:#Intent;action=android.media.action.MEDIA_PLAY_FROM_SEARCH;component=com.spotify.music/.MainActivity;S.referrer=Shazam;S.query=Small%20Town%20Event%20%EC%96%91%EC%B2%9C%ED%99%94;end"
             },
             {
               "name": "hub:spotify:iossearchdeeplink",
               "type": "uri",
               "uri": "spotify:search:Small%20Town%20Event%20%EC%96%91%EC%B2%9C%ED%99%94"
             }
           ],
           "caption": "Ouvrir dans Spotify",
           "images": {
             "default": "https://images.shazam.com/static/icons/hub/android/v5/spotify_{scalefactor}.png",
             "overflow": "https://images.shazam.com/static/icons/hub/android/v5/spotify-overflow_{scalefactor}.png"
           },
           "type": "SPOTIFY"
         },
         {
           "actions": [
             {
               "name": "hub:youtubemusic:androiddeeplink",
               "type": "uri",
               "uri": "https://music.youtube.com/search?q=Small+Town+Event+Miriam+Yeung&feature=shazam"
             }
           ],
           "caption": "Ouvrir dans YouTube Music",
           "images": {
             "default": "https://images.shazam.com/static/icons/hub/android/v5/youtubemusic_{scalefactor}.png",
             "overflow": "https://images.shazam.com/static/icons/hub/android/v5/youtubemusic-overflow_{scalefactor}.png"
           },
           "type": "YOUTUBEMUSIC"
         },
         {
           "actions": [
             {
               "name": "hub:deezer:searchdeeplink",
               "type": "uri",
               "uri": "deezer-query://www.deezer.com/play?query=%7Btrack%3A%27Small+Town+Event%27%20artist%3A%27Miriam+Yeung%27%7D"
             }
           ],
           "caption": "Ouvrir dans Deezer",
           "images": {
             "default": "https://images.shazam.com/static/icons/hub/android/v5/deezer_{scalefactor}.png",
             "overflow": "https://images.shazam.com/static/icons/hub/android/v5/deezer-overflow_{scalefactor}.png"
           },
           "type": "DEEZER"
         }
       ],
       "type": "APPLEMUSIC"
     },
     "images": {
       "background": "https://is2-ssl.mzstatic.com/image/thumb/Features114/v4/ce/6e/d2/ce6ed27e-c6dc-afcb-6e84-bcda3bf670c1/mzl.rdoswfqc.jpg/800x800bb.jpeg",
       "coverart": "https://is3-ssl.mzstatic.com/image/thumb/Music3/v4/7d/d0/97/7dd09728-0f83-be5a-b7c5-1029b6799a48/825646226610.jpg/400x400bb.jpeg",
       "coverarthq": "https://is3-ssl.mzstatic.com/image/thumb/Music3/v4/7d/d0/97/7dd09728-0f83-be5a-b7c5-1029b6799a48/825646226610.jpg/800x800bb.jpeg",
       "joecolor": "b:ffffffp:2d2924s:31302dt:575450q:5a5957"
     },
     "isrc": "HKG580400082",
     "key": "40774356",
     "layout": "5",
     "relatedtracksurl": "https://cdn.shazam.com/shazam/v3/fr/CH/android/-/tracks/track-similarities-id-40774356?startFrom=0&pageSize=20&connected=",
     "sections": [
       {
         "metadata": [
           {
             "text": "電光幻影",
             "title": "Album"
           },
           {
             "text": "Gold Typhoon Hong Kong",
             "title": "Label"
           },
           {
             "text": "2004",
             "title": "Sorti"
           }
         ],
         "metapages": [
           {
             "caption": "양천화",
             "image": "https://is2-ssl.mzstatic.com/image/thumb/Features114/v4/ce/6e/d2/ce6ed27e-c6dc-afcb-6e84-bcda3bf670c1/mzl.rdoswfqc.jpg/800x800bb.jpeg"
           },
           {
             "caption": "Small Town Event",
             "image": "https://is3-ssl.mzstatic.com/image/thumb/Music3/v4/7d/d0/97/7dd09728-0f83-be5a-b7c5-1029b6799a48/825646226610.jpg/800x800bb.jpeg"
           }
         ],
         "tabname": "Titre",
         "type": "SONG"
       },
       {
         "beacondata": {
           "commontrackid": "40955552",
           "lyricsid": "10722156",
           "providername": "musixmatch"
         },
         "footer": "Writer(s): Mark Lui\nLyrics powered by www.musixmatch.com",
         "tabname": "Paroles",
         "text": [
           "青春彷彿因我愛你開始",
           "但卻令我看破愛這個字",
           "自你患上失憶 便是我扭轉命數的事",
           "",
           "只因當失憶症發作加深",
           "沒記住我但卻另有更新蜜運",
           "像狐狸精般 並未允許我步近",
           "",
           "無回憶的餘生 忘掉往日情人",
           "卻又記住移情別愛的命運",
           "無回憶的男人 就當偷厄與瞞騙",
           "抱抱我不過份",
           "",
           "吻下來 豁出去 這吻別似覆水",
           "再來也許要天上團聚",
           "再回頭 你不許 如曾經不登對",
           "你何以雙眼好像流淚",
           "",
           "彼此追憶不怕愛要終止",
           "但我大概上世做過太多壞事",
           "能從頭開始 跪在教堂說願意",
           "",
           "娛樂行的人影 還在繼續繁榮",
           "我在算著甜言蜜語的壽命",
           "人造的蠢衛星 沒探測出我們已",
           "已再見不再認",
           "",
           "吻下來 豁出去 這吻別似覆水",
           "再來也許要天上團聚",
           "我下來 你出去 講再會也心虛",
           "我還記得到天上團聚",
           "吻下來 豁出去 從前多麼登對",
           "你何以雙眼好像流淚",
           "每年這天記得再流淚"
         ],
         "type": "LYRICS",
         "url": "https://cdn.shazam.com/lyrics/v1/fr/CH/android/musixmatch/subtitles/40955552/208/1?token=f042dc79fa7c240c2784b046c8a388f3"
       },
       {
         "tabname": "Vidéo",
         "type": "VIDEO",
         "youtubeurl": "https://cdn.shazam.com/video/v3/-/-/android/40774356/youtube/video?q=Miriam+Yeung+%22Small+Town+Event%22"
       },
       {
         "actions": [
           {
             "id": "40063263",
             "type": "artistposts"
           },
           {
             "id": "40063263",
             "type": "artist"
           }
         ],
         "avatar": "https://is2-ssl.mzstatic.com/image/thumb/Features114/v4/ce/6e/d2/ce6ed27e-c6dc-afcb-6e84-bcda3bf670c1/mzl.rdoswfqc.jpg/800x800bb.jpeg",
         "id": "40063263",
         "name": "양천화",
         "tabname": "Artiste",
         "toptracks": {
           "url": "https://cdn.shazam.com/shazam/v3/fr/CH/android/-/tracks/artisttoptracks_40063263?startFrom=0&pageSize=20&connected="
         },
         "type": "ARTIST",
         "url": "https://cdn.shazam.com/digest/v1/fr/CH/android/artist/40063263/recentpost",
         "verified": false
       },
       {
         "tabname": "Titres similaires",
         "type": "RELATED",
         "url": "https://cdn.shazam.com/shazam/v3/fr/CH/android/-/tracks/track-similarities-id-40774356?startFrom=0&pageSize=20&connected="
       }
     ],
     "share": {
       "avatar": "https://is2-ssl.mzstatic.com/image/thumb/Features114/v4/ce/6e/d2/ce6ed27e-c6dc-afcb-6e84-bcda3bf670c1/mzl.rdoswfqc.jpg/800x800bb.jpeg",
       "href": "https://www.shazam.com/track/40774356/small-town-event",
       "html": "https://www.shazam.com/snippets/email-share/40774356?lang=fr&country=CH",
       "image": "https://is3-ssl.mzstatic.com/image/thumb/Music3/v4/7d/d0/97/7dd09728-0f83-be5a-b7c5-1029b6799a48/825646226610.jpg/400x400bb.jpeg",
       "snapchat": "https://www.shazam.com/partner/sc/track/40774356",
       "subject": "Small Town Event - Miriam Yeung",
       "text": "J'ai utilisé Shazam pour découvrir Small Town Event par Miriam Yeung.",
       "twitter": "J'ai utilisé @Shazam pour découvrir Small Town Event par Miriam Yeung."
     },
     "subtitle": "Miriam Yeung",
     "title": "Small Town Event",
     "type": "MUSIC",
     "url": "https://www.shazam.com/track/40774356/small-town-event",
     "urlparams": {
       "{trackartist}": "Miriam+Yeung",
       "{tracktitle}": "Small+Town+Event"
     }
   }
 }

这篇文章有一个评论

发表回复