Readme
Visual Music Search by MyPart
Instantly match REAL, great music for an image, a video or a whole set of visuals. Upload your media and get a ranked list of real, released tracks from MyPart’s catalog that fit what’s on screen.
- Images, videos and collections. One file searches that image or video; several files are searched together as one collection, such as a campaign or a moodboard.
- Optional text hint. Steer the results with mood, genre or a reference, e.g.
"upbeat summer road trip","Something in the style of Bruno Marsetc - Song or section. Match whole songs, or the best-fitting part of each song with its start and end time.
- Licensed-only option. Restrict results to MyPart’s licensable catalogs.
Real music only: nothing is generated.
Get started
- Get a MyPart API key. Request access at mypart.ai/api-access. Every request needs it.
- Use your own Replicate API token to call the model, as with any model on Replicate.
Keep both in environment variables: MYPART_API_KEY and REPLICATE_API_TOKEN. The MyPart key is passed as the mypart_api_key input; Replicate treats it as a secret and redacts it from prediction logs.
Quick start
curl -s -X POST https://api.replicate.com/v1/predictions \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d '{
"version": "myart-arch/visual-music-search:883f9a1b2d6e7c4ec57b1b2a93f7a60b966bb6f04ca3c5614e86557c2f1ffd2b",
"input": {
"mypart_api_key": "'"$MYPART_API_KEY"'",
"media": ["https://example.com/your-video.mp4"]
}
}'
import os
import replicate
output = replicate.run(
"myart-arch/visual-music-search:883f9a1b2d6e7c4ec57b1b2a93f7a60b966bb6f04ca3c5614e86557c2f1ffd2b",
input={
"mypart_api_key": os.environ["MYPART_API_KEY"],
"media": [open("clip.mp4", "rb")], # one file, or several for a collection
"text": "upbeat summer road trip", # optional
"num_results": 10,
},
)
for track in output["results"]:
print(track["score"], track["artist"], "-", track["title"], track["url"])
media is always a list, even for a single file. Files can be uploaded, or passed as public or signed HTTPS URLs.
Inputs
| Input | Default | Description |
|---|---|---|
mypart_api_key |
required | Your MyPart API key (request one). Treated as a secret. |
media |
required | List of images and/or videos. One file searches that image or video; several are searched together as a collection. |
text |
none | Optional hint to refine the results: mood, genre, reference artist. |
search_resolution |
song |
song matches whole songs. section matches the best-fitting part of each song and returns its start and end time. |
results_mode |
discovery |
popular boosts highly familiar songs and artists. discovery allows a wider, more flexible search. |
num_results |
10 |
1-50. The maximum returned. |
licensed |
false |
true returns only tracks from MyPart’s licensable catalogs. |
media_type |
auto |
image or video. Leave it out unless a request fails with a media type error. |
Output
{
"results": [
{
"id": "164779",
"title": "Going Home",
"artist": "Jon Allen",
"score": 5.46,
"url": "https://.../preview.mp3",
"spotify_id": "4R19bxsqCY2NQUncOKG8Pe",
"start_time_seconds": null,
"end_time_seconds": null,
"section_lyrics": null
}
]
}
| Field | Meaning |
|---|---|
id |
MyPart track id |
title, artist |
Track title and artist |
score |
Match score; higher is a closer match |
url |
Audio preview (MP3) |
spotify_id |
When available, otherwise null |
start_time_seconds, end_time_seconds |
Section searches only: the part of the song that matched |
section_lyrics |
Section searches only: the lyrics of that part, when it has lyrics |
The order of the top results is varied on purpose; use score to rank them.
Tips
- Compress media before sending. Smaller files upload faster and results come back sooner: JPEG images around 1920 px on the long side, videos at 720p H.264, trimmed to the part that matters and ideally under 10 MB.
- Limits: each video up to 25 MB; a collection up to 100 MB in total.
- Long requests: with
Prefer: waitReplicate waits up to 60 seconds. If the response comes back asstartingorprocessing, pollurls.getuntilstatusissucceededorfailed.
Troubleshooting
| Error | What to do |
|---|---|
A MyPart API key is required |
Pass your key as mypart_api_key. No key yet? Request one at mypart.ai/api-access. |
Invalid or revoked MyPart API key |
Check the key was copied in full, or request a new one at mypart.ai/api-access. |
The MyPart API is busy |
Retry after a few seconds. |
About MyPart
MyPart builds music reasoning for creative tools: it understands what a visual or a brief needs and finds real music that fits. API access: mypart.ai/api-access.