Hear a phrase and a chord
curl https://aisenseapi.com/services/v1/audio_render/C4:4,E4:8,G4:8,R:4,C4+E4+G4:2 --output phrase.wavThe answer is a mono 16-bit WAV at 22050 Hz: middle C, E and G, a rest and the C major chord on the piano, with half a second of quiet after the last note. The notes are written as for midi_encode; add the tempo and a General MIDI program as the next path segments, such as /audio_render/C4:4,E4:8,G4:8,R:4,C4+E4+G4:2/120/24 for a guitar. With Accept: application/json the call answers the fields, with the WAV in audio_base64:
curl -H "Accept: application/json" https://aisenseapi.com/services/v1/audio_render/C4:4,E4:8,G4:8,R:4,C4+E4+G4:2/120/24
{"audio_base64":"UklGRvAEAgBXQVZFZm10IBAAAAABAAEAIlYAAESsAAAC...","mime_type":"audio/wav","input":"notation","title":null,"notes":6,"channels":null,"duration_seconds":3,"sample_rate":22050,"truncated":false}Try it
Hear notes here, or a MIDI file or an Amiga MOD module you drop on the box; the sample is the start of Beethoven's Ode to Joy over a bass line. Your browser posts the notes in a JSON field named data, with tempo and program beside them, or uploads the file as a form field named file, and plays the WAV that comes back, up to 180 seconds.
A MIDI file or a MOD module
POST a file as a multipart field named file, as the raw body, or as base64 in {"file_base64": "..."}; the format is read from its first bytes. A Standard MIDI File plays through the synthesizer. A ProTracker module, the MOD format of the Amiga, plays its own samples: 31 samples, 1 to 32 channels, with arpeggio, slides, tone portamento, vibrato, tremolo, volume, sample offset, pattern jumps, breaks, loops and delays, and changes of speed and tempo. A MIDI file is at most 1 MiB and a module at most 4 MiB; a JSON body is at most 256 KiB, so through file_base64 a file can be about 190 KB.
curl -X POST https://aisenseapi.com/services/v1/audio_render \
-H "Accept: application/json" -F file=@song.modTo try one, the Amiga Music Preservation archive keeps the modules of Dr. Awesome, Bjørn Arild Lynne: make your move from the Bacteria musicdisk by The Crusaders, 1990, and de pyp uit, with the rest on his page. For MIDI, J. S. Bach's Invention 1 on the Mutopia Project, typeset by Jeff Covey under CC BY-SA 3.0. Download a file there and drop it in the box above.
How the notes sound
The 128 General MIDI programs come in sixteen groups of eight, and each group plays one of ten voices: piano, mallets, organ, plucked strings for guitars and basses, bowed strings, brass, reeds, flutes, synth leads and pads, each with its own envelope. MIDI channel 10 plays drums, from kick to cymbal. It is a small synthesizer, made to hear a melody and its harmony, not to replace a sound bank. The same input always gives the same sound.
At most 180 seconds
At most 180 seconds of sound are made, and the notes' own lengths together at most 1800 seconds; a longer or denser song is cut there and truncated is true, so a WAV is at most 7,938,044 bytes, about 7.6 MiB, whatever it was made from. A module plays at most 720 seconds of channels, 180 seconds of four channels or 90 of eight. It stops where the song would start over. When the service is busy, a call answers HTTP 503 with Retry-After: 2.
What the free audio render API endpoint returns
| Field | Type | Description |
|---|---|---|
| audio_base64 | string | The WAV as base64: PCM16, mono, 22050 Hz, at most 7,938,044 bytes. |
| mime_type | string | audio/wav. |
| input | string | notation, tracks, midi or mod. |
| title | string or null | The module's title, or the first track name of a MIDI file. |
| notes | integer or null | The notes read, for notes and MIDI, counted before any cut at 180 seconds. |
| channels | integer or null | The channels of a module. |
| duration_seconds | number | The length of the WAV. |
| sample_rate | integer | 22050. |
| truncated | boolean | Whether the song was cut. |
Without Accept: application/json the answer is the WAV itself.
HTTP 415 when the file is neither MIDI nor MOD
curl -X POST https://aisenseapi.com/services/v1/audio_render \
-H "Content-Type: application/octet-stream" --data-binary "RIFF"
{"error":"The file is neither a Standard MIDI File nor a ProTracker module.","fix":"Send a .mid file, which starts with MThd, or a 31-sample MOD with a signature such as M.K. at byte 1080."}HTTP 400: notes that cannot be read, as for midi_encode, or more than one of data, tracks and file_base64. HTTP 413: a MIDI file over 1 MiB or a module over 4 MiB. HTTP 503: another sound is being made, with Retry-After: 2, or a sound took too long to make, with Retry-After: 10.
Where rendering earns its keep
Agents that compose
An agent writes a melody as text and the user hears it at once, without a synthesizer installed.
Previews
A MIDI file or a module heard in a browser, as a WAV every browser plays.
Retro sound
Amiga modules played back for a page, a stream or a game menu.
Notifications
A short motif as a sound file, made from one URL.
Privacy and limits
The notes and files are not stored. A file waits in a private working folder only while its sound is made, and the hourly cleanup deletes what an interrupted render leaves there. The sound is answered in the same call.
The service-wide limit is 5000 requests per IP per day, with no key and no account behind it. Every endpoint is listed in the free public REST APIs reference.