Shazam

GRATIS CON POSSIBILITÀ DI UPGRADE
Verified
Da Api Dojo | Aggiornamento 4日前 | Music
Popolarità

9.8 / 10

Latenza

1,828ms

Livello di servizio

99%

Health Check

N/A

Torna a tutti i tutorial (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