Skip to content

APIs and Controller

Raef Maroof edited this page Oct 3, 2022 · 27 revisions

Identify Song Clip - Query Custom ML Model

Flask API endpoint to call our machine learning model. Requires the URI of a sound clip posted to a databse. Returns the song label.

Endpoint: GET /identifysong/

Request Parameters (JSON):

Key Type Value
URI String The URI of the sound byte on an external database

Returns (JSON): Artists and Title of input audio clip

Key Type Value
URI String The URI of the sound byte on an external database
Song_Name String The name of the song sent to the ML model.

Response Codes:

Response Code Interpretation
200 OK Successfully identified the song; name and requested uri supplied in return JSON.
400 Bad Request Invalid request format.
404 Not Found Could not identify the song or locate the URI in AWS.

Get Song Information

Calls AWS backend search engine to retrieve relevant movie/song information Returns relevant information about movies containing a given song.

Endpoint: GET /songinfo/

Request Parameters (JSON):

Key Type Value
Song_Name String The name of the song on which movie data is desired.

Returns (JSON):

Key Type Value
Song_Name String The name of the song on which movie data is desired.
MovieData String Objects An array of movies in which the song has been used and each movie's data.

Here's a breakdown of the objects contained in MovieData:

Key Type Value
Movie_Name String The name of the movie.
Director String The director of the movie
Year Integer The year the movie was released.
Timestamp String The time the song is played in the movie (HH:MM)

Response Codes:

Response Code Interpretation
200 OK Successfully located related movies and associated data. Returns json results as above.
400 Bad Request Invalid request format.
404 Not Found Unrecognized song.

Interactions with 3rd party SDKs, APIs, and Apps

POST song clip to AWS for ML model consumption

After recording the song clip, the frontend will POST the song to an AWS S3 bucket which the ML model can query for the clip. Include AWS access key, file, and key (which AWS uses to name the resource) in POST parameters.

Query ShazamKit SDK to identify songs

After recording the song clip, the frontend will access the ShazamKit SDK using a "Matcher" class to identify the song clip.

Open Song in 3rd Party Apps

Ability to open up song/movie [info] in other applications (e.g. spotify, youtube, google). Query apps with the ability to play songs via Intents. Allow user to select one of the responding apps on the current phone.

Clone this wiki locally