Create personalized karaoke track of your favorite songs

   contact@myra.io

Myra API Reference – Standard Plan Subscription

Standard Plan Description

Standard Plan gives you an option to let your users have more flexibility to generate karaoke tracks. It unlocks “Add Melody” and “Add Layers” features for your users. Plus it also gives you early bird access to all the upcoming beta features of myra.io. You can either choose to configure your UI to just use the simple vocal remover feature with no melody and layers or choose to give both options to your users. In the below article you will find instructions for both the case.

To see the options in action you visit myra.io and use the UI as reference when creating your own UI.Our tech works best for newer songs. Generally speaking songs that are recorded after year 2015. Please make sure to let your users know about it on your platform.

Here are list of features that the Standard Plan unlocks.

  • Feature 1: Generate Karaokes from YouTube video URLs
    • Option 1A – remove vocals and add melody plus melody layers
    • Option 1B – just remove the vocals
  • Feature 2: Generate Karaokes by uploading a local audio file of the song
    • Option 2A remove vocals and add melody plus melody layers
    • Option 2B just remove the vocals

Depending on your use case you can choose to integrate all the above features on your platform or choose to integrate one or more of these features. Instructions to integrate all the above features are explained step by step in this guide.

Step 1: Get your API Key

  1. Visit myra.io/choose-a-plan and choose “Standard” plan. If you have come here after subscribing then go to Step 2.
  2. Once you complete the subscription process you will get an email with your API Key. Please note that we don’t store any of your payment information. We use stripe.com as our payment partner.

Step 2: Configure your website

This step is basically adding a “Button” or any UI element on your website or platform and making a HTTP POST request to our API when the button is pressed. You might configure your website differently depending upon your use case. In this example we will use a “Button” to make a POST request to Myra API end point.

The button on a website might look something like the image below.

Optional (recommended): As pointed out earlier, if you want your users to have flexibility in choosing instruments for melody of a song and melody layers then you might have to configure your website or app UI with list of supported instruments. Here is the list of supported instruments.

  • Melody Instruments:
    • Guitar
    • Piano
    • Strings
    • Bells
  • Melody Layers
    • Guitar
    • Piano
    • Strings
    • Violin

We understand if you don’t want to change or add a UI with above options. In that case please send us ‘Piano‘ as default melody instrument and Strings, Guitar, Piano as default layers. Please see the sample payload below. Melody layers are to be sent as array of strings and Melody instrument is a string.

Step 3: Making a Request to Myra

We will use Postman to show how to send a request to Myra API end point. You will have to send headers params no matter which scenario you are configuring.We will use this information to authenticate and process your karaoke files.

MYRA API END POINT
HTTPS://MYRA.IO/KARAOKE

Header Params for all scenarios

Params:

Authkey: YOUR_AUTH_KEY (from the email you got upon subscription)

Feature 1: Generate Karaokes from YouTube video URLs

Option 1A – remove vocals and add melody plus melody layers

Params for Body (POST request) – Sending youtube url to create karaoke

Send below details along with the headers for the scenario where your users choose to add melody and melody layers.

Please note that:

  • the key “sending_email” is always yes and email_id value is always populated with users email.
  • the key “sending_file” will be no in this scenario as user will be entering or pasting youtube url to generate a karaoke track

So in this scenario when user wants to generate karaoke track from a youtube video url and wants to add melody and layers then myra api is expecting 6 key-value pairs as shown below.

Sample Code
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://myra.io/karaoke",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "------WebKitFormBoundary8asda9UISJD\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\nhttps://www.youtube.com/watch?v=ZmDBbnmKpqQ\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"sending_file\"\r\n\r\nno\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"sending_email\"\r\n\r\nyes\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"email_id\"\r\n\r\njohndoe@example.com\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"mel_instrument\"\r\n\r\nPiano\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"layers\"\r\n\r\n[\"Guitar\",\"Piano\",\"Strings\"]\r\n------WebKitFormBoundary8ASdA9uiSjD0gw--",
  CURLOPT_HTTPHEADER => array(
    "authkey: YOUR_AUTH_KEY",
    "cache-control: no-cache",
    "content-type: multipart/form-data; boundary=----WebKitFormBoundary8asda9UISJD0gW",
    "postman-token: some-post-man-token"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
Sample Payload
{
	"url": "https://www.youtube.com/watch?v=ZmDBbnmKpqQ", 
	"sending_file": "no", 
	"sending_email": "yes", 
	"mel_instrument": "Piano", 
	"layers": ["Strings","Guitar","Piano"], 
	"email_id": "johndoe@example.com"
}

Option 1B – just remove the vocals

Params for Body (POST request) – Sending youtube url to create karaoke

Send below details along with the headers for the scenario where your users choose to just remove the vocals from the song

Sample Code
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://myra.io/karaoke",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "------WebKitFormBoundary5TRynDtg67\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\nhttps://www.youtube.com/watch?v=ZmDBbnmKpqQ\r\n------WebKitFormBoundary5TRyNDtg670gw\r\nContent-Disposition: form-data; name=\"sending_file\"\r\n\r\nno\r\n------WebKitFormBoundary5TRyNDtg670gw\r\nContent-Disposition: form-data; name=\"sending_email\"\r\n\r\nyes\r\n------WebKitFormBoundary5TRyNDtg670gw\r\nContent-Disposition: form-data; name=\"email_id\"\r\n\r\njohndoe@example.com\r\n------WebKitFormBoundary5TRyNDtg670gw--",
  CURLOPT_HTTPHEADER => array(
    "authkey: YOUR AUTH KEY",
    "cache-control: no-cache",
    "content-type: multipart/form-data; boundary=----WebKitFormBoundary5TRynDtg670gW",
    "postman-token: some-post-man-token"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
Sample Payload
{
	"url": "https://www.youtube.com/watch?v=ZmDBbnmKpqQ", 
	"sending_file": "no", 
	"sending_email": "yes", 
	"email_id": "johndoe@example.com"
}

Feature 2: Generate Karaokes by uploading a local audio file of the song

Option 2A remove vocals and add melody plus melody layers

Params for Body (POST request) – Sending file to create karaoke

Sample Code

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://myra.io/karaoke",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"file\"; filename=\"audio.wav\"\r\nContent-Type: audio/x-wav\r\n\r\n\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"sending_file\"\r\n\r\nno\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"sending_email\"\r\n\r\nyes\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"email_id\"\r\n\r\njohndoe@example.com\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"mel_instrument\"\r\n\r\nPiano\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"layers\"\r\n\r\n[\"Guitar\",\"Violin\",\"Strings\"]\r\n------WebKitFormBoundary8ASdA9uiSjD0gw--",
  CURLOPT_HTTPHEADER => array(
    "authkey: YOURAUTHKEY",
    "cache-control: no-cache",
    "content-type: multipart/form-data; boundary=----WebKitFormBoundary8ASdA9uiSjD0gw",
    "postman-token: some-post-man-token-here"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Sample Payload

Make sure to send the file as part of “multipart/form-data”. Use “key” as “file” so that we know that you are sending a file and not a url.

{
	"sending_file": "yes", 
	"sending_email": "yes", 
	"mel_instrument": "Piano", 
	"layers": ["Guitar","Violin","Strings"], 
	"email_id": "johndoe@example.com"
}

Option 2B just remove the vocals

Body – Sending audio file to create karaoke

In this case you will not be sending “mel_instrument” and “layers”. Myra end point will need below params to process the karaoke.

Sample Code Php Curl

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://myra.io/karaoke",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"file\"; filename=\"audio.wav\"\r\nContent-Type: audio/x-wav\r\n\r\n\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"sending_file\"\r\n\r\nno\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"sending_email\"\r\n\r\nyes\r\n------WebKitFormBoundary8ASdA9uiSjD0gw\r\nContent-Disposition: form-data; name=\"email_id\"\r\n\r\njohndoe@example.com\r\n------WebKitFormBoundary8ASdA9uiSjD0gw--",
  CURLOPT_HTTPHEADER => array(
    "authkey: YOURAUTHKEY",
    "cache-control: no-cache",
    "content-type: multipart/form-data; boundary=----WebKitFormBoundary8ASdA9uiSjD0gw",
    "postman-token: some-post-man-token-here"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
Sample Code : PowerShell Script
$url = "https://myra.io/karaoke"
$headers = @{
    "authkey" = "YOUR_API_KEY"
}

# Read the file as a base64 string
$fileBase64 = [Convert]::ToBase64String([System.IO.File]::ReadAllBytes("full path to your audio wav file"))
$email = "JohnDoe@example.com"

# Create the form data
$formData = @{
    "file" = $fileBase64
    "sending_file" = "yes"
    "base64" = "yes"
    "sending_email" = "yes"
    "email_id" = $email
}

# Send the request
$response = Invoke-WebRequest -Uri $url -Method Post -Headers $headers -Body $formData

# Check the response status code
if ($response.StatusCode -eq 200) {
    Write-Output $response.Content
} else {
    Write-Error "Error: $($response.StatusCode) - $($response.StatusDescription)"
}

Sample Payload PHP Curl

Make sure to send the file as part of “multipart/form-data”. Use “key” as “file” so that we know that you are sending a file and not a url. See above sample code and corresponding postman screenshots for your reference.

# php curl
{ 
	"sending_file": "yes", 
	"sending_email": "yes", 
	"email_id": "johndoe@example.com"
}
# PowerShell Script
{ 
  "file" = $fileBase64
	"sending_file": "yes", 
	"sending_email": "yes", 
	"email_id": "johndoe@example.com"
}

We are here to help you get up and running. In case you run into issues please send us an email at contact@myra.io.