Shazam

부분 유료
Verified
분류별 Api Dojo | 업데이트됨 8일 전 | Music
인기

9.8 / 10

지연 시간

1,879ms

서비스 수준

99%

Health Check

N/A

모든 자습서로 돌아가기 (1)

How to use .../songs/detect endpoint

Hello everyone,

Firstly, you need to generate your own raw sound from a recording device (directly from your phone mic for example). You also make quick test by converting any audio files from other format (mp3, wav, etc…) to raw data by using any Audio application such as Audacity https://www.audacityteam.org/download. Remember that all audio files are NOT mono, so you always have to remove one channel to make the sound mono. In addition, you need to Import the raw file (not Open ) to Audacity and play the sound to test whether it is working or not.

Secondly, you write some logic code to read the raw file by using input file stream to get byte[], then convert the byte[] to base64 string and send base64 string in body via POST requests with body as plain text by using any HTTP client tools, such as : https://www.postman.com/.

String inputRawFile = ".../clinteastwood_portion_mono.raw";
byte[] byteArray = readFile(inputRawFile);
String base64Str = Base64.getEncoder().encodeToString(byteArray);
try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(".../clinteastwood_portion_mono.txt"), StandardCharsets.UTF_8)) { out.write(base64Str); }

You may download sample raw sound data from the following link : https://www.dropbox.com/sh/2ldg24swrkhr6l3/AADeEbIiLR4DIR_RpFnphPG4a?dl=0