Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Microservice to convert midi file to mp3 file

NotificationsYou must be signed in to change notification settings

WeeSee/dockerized-midi2mp3-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Cloud Build StatusDocker Image Size (latest by date)Docker PullsGitHub issues

REST API for converting MIDI files to MP3 audio files - Provided as Docker container for easy usage.

Upload a JSON with base64 encoded Midi data and get a JSON including the base64 encoded Mp3 file. All details see below.

This is a stateless microservice without volumes. The microservice runs forever and accepts http requests on the specified port.

Setup and run

You need to have installed:

  • docker
  • docker-compose
  • make

Running the container

Run the container usingthe prebuild image from Dockerhub:

docker run -p 8094:80 midi2mp3

Building the container

You can build the image and start it up withmake anddocker-compose

make build up ps

There are more commands in the Makefile, try

make

API Usage

Endpoint http://[docker-machine]/info

Request

  • Verb : GET
  • No parameter

Response

  • Content-Type : Application/json
{"apiName":"midi2mp3","version": {"api":"1.0"  },"description":"midi to mp3 audio files cnverter"}

Endpoint http://[docker-machine]/convert

Request

  • Verb : POST
  • Content-Type : Application/json
  • Parameters :-- midiData : Base64 encoded MIDI-Data (see test section for an example)

Response

  • Content-Type : Application/json
{"statusCode":"OK|ERROR","message":"Information on error","base64MidiData":"....","logs": []}

Test from command line

Or make the test from inside the container:

    make bash

and build a request file:

echo -n"{\"midiData\":\""> /tmp/test.json    cat /tmp/elton.mid| base64 --wrap=0>> /tmp/test.jsonecho"\"}">> /tmp/test.json

or as a one liner:

    {echo -n"{\"midiData\":\"";echo -n"`base64 --wrap=0 /tmp/elton.mid`";echo"\"}"; }> /tmp/test.json

then execute the conversion

    curl -X POST -H"Content-Type: application/json" --data"@/tmp/test.json" localhost/convert| jq.

You should get a json output containing the base64 encoded mp3 file as

    {"statusCode":"OK","message":"","base64Mp3Data":".......","logs": []    }

You can test the microservice from outside the container (this is more complicated since you need the tools installed in your os):

    curl -X POST -H"Content-Type: application/json" --data"@test.json" localhost:8094/convert| jq.

To extract the mp3 file out of the result on the command line, use

    curl -X POST -H"Content-Type: application/json" --data"@/tmp/test.json" localhost/convert| jq -r .base64Mp3Data| base64 -d> /tmp/elton.mp3

Credits

This repo was inspired by

Author

weesee@web.de

(C) Copyright, 2020

About

Microservice to convert midi file to mp3 file

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp