TEXT to MUSIC API

PAYANT
Par Manolis Teletos | Mise à jour vor 2 Monaten | Music
Popularité

7.6 / 10

Latence

3,122ms

Niveau de service

100%

Health Check

93%

Retour à toutes les discussions

What Type of response is it giving and how can I read it as .mp3 ?

Rapid account: Armaanjain 11110
armaanjain11110
vor einem Jahr

it is giving me some weird symbols as response. how can i parse it ?

Rapid account: Manosteletos
manosteletos Commented vor 6 Monaten

Arman the mp3 version is out . In python you can parse it like this :

import http.client

conn = http.client.HTTPSConnection(“text-to-music-api.p.rapidapi.com”)

headers = {
‘X-RapidAPI-Key’: “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”,
‘X-RapidAPI-Host’: “text-to-music-api.p.rapidapi.com
}

conn.request(“GET”, “/play?ascii_text=IaMaTextThatWillGiveMusic”, headers=headers)

res = conn.getresponse()
if res.status == 200:
# Save the response content (MIDI or MP3 data) to a local file
with open(“output”, “wb”) as file:
file.write(res.read())
print(“MIDI or MP3 file saved as output”)
else:
print(“Failed to retrieve the file. Status code:”, res.status)

Rapid account: Manosteletos
manosteletos Commented vor einem Jahr

Hello Arman.

The response is in .mid format and instantly it downloads it to your browser.
Convert MIDI to audio: MIDI files contain musical instructions, but they do not contain actual audio data. To convert MIDI to audio, you’ll need to use a software or library that can interpret the MIDI instructions and generate audio output. One popular library for this purpose is FluidSynth.
In future version in July I plan to choose what type of response you want to download in this case .mp3.

Thanks for your comment.

Emmanuel

Participez à la discussion - ajoutez un commentaire ci-dessous:

Connectez-vous / Inscrivez-vous pour publier de nouveaux commentaires