Sonilo Audio Generator - AI music and sound effects inside the Defold editor

Sonilo Audio Generator

Hi everyone! :waving_hand:

I just released Sonilo Audio Generator, an editor extension that generates AI music and sound effects without leaving Defold, powered by the Sonilo API.

GitHub: GitHub - Sonilodeveloper/defold-sonilo: Generate AI music and sound effects inside the Defold editor, powered by the Sonilo API · GitHub

What it does

  • Music: build a structured prompt from dropdowns (Game Type, Scenario, Mood, Dynamic Behavior), set a duration in minutes/seconds, hit Generate. The plugin submits an async task, shows live progress in the dialog, and downloads the result as a .wav into sonilo/generated_audio/ automatically.
  • Sound effects: just describe what you need (“heavy rain on a tin roof with distant thunder”), optionally refine with the same categories.
  • Preview in place: Play/Stop with a live progress bar and clickable seek points — or one click opens a browser preview with a natively draggable timeline (served through the editor’s built-in HTTP server).
  • Export in one click: create a ready-to-use audio prefab (.go with an embedded sound component + a runtime script handling sonilo_play / sonilo_stop / volume / fade messages), or right-click a .go in the Assets pane to add the generated sound directly onto it.
  • No login — click Add API Key, paste a key from platform.sonilo.com, done. The key is stored in editor preferences (masked), never inside your project.
  • Try it offline: without an API key the plugin generates placeholder sine-wave audio, so you can walk the whole flow (generate → preview → prefab) before signing up for anything.

Installation

Add the library to your game.project dependencies:

https://github.com/Sonilodeveloper/defold-sonilo/archive/main.zip

Then Project ▸ Fetch Libraries and open View ▸ Sonilo Audio Generator.

Requirements & honest notes

  • Defold 1.9.3+ (uses the editor.ui dialog API, technical preview; 1.9.8+ recommended for masked API-key prefs).
  • curl on PATH (preinstalled on macOS/Linux/Windows 10+).
  • The UI is a modal dialog (that’s what editor.ui currently supports), and there’s no slider component — the in-dialog timeline uses clickable time stops, with the browser preview covering real dragging.
  • In-editor playback shells out to the OS (afplay/aplay); on Windows it opens your default player.

The whole plugin is plain Lua editor scripting — no native extensions — so it might also be useful as a reference for editor.ui dialogs, async polling from suspending callbacks, and get_http_server_routes().

Feedback, bug reports and feature requests are very welcome — here or on the issue tracker. :musical_note:

6 Likes

Good job putting this together!

I wonder if it wouldn’t be possible to use the editor script version of http.request() to not have to rely on curl?

This will change in Defold 1.13.1 due for release soon:

Please open a feature request on GitHub!

Once we solve Quick "pre-hear" Play sound functionality in sound component Editor · Issue #8373 · defold/defold · GitHub we’ll also be able to add editor script capabilities for sound playback in the editor.

Any plans to support ogg and orbis?

This is not good. This extension has it’s editor script files etc (it’s library dir) in sonilo (defold-sonilo/game.project at main · Sonilodeveloper/defold-sonilo · GitHub). If you also create a local folder named sonilo this folder will “shadow” the extension folder.

2 Likes

Thanks a lot for taking the time to review this, really appreciate the detailed feedback! I’ve pushed fixes for the main points:

Folder shadowing — good catch, that was a real footgun. Generated files now go to sonilo_generated/ (outside the library’s sonilo include dir), so a consumer project can no longer shadow the extension folder.

http.request() — done. API calls and downloads now use the editor’s http.request on Defold 1.9.8+; curl is only kept as a fallback for 1.9.3–1.9.7.

Modal dialog — I’ve added forward-compatible support for the 1.13.1 change: the dialog now passes modal = false and falls back to modal on older versions. Looking forward to that release!

Slider — done, opened a feature request here: editor.ui: slider component for editor script dialogs · Issue #12952 · defold/defold · GitHub — our main use cases are a duration picker and a draggable playback timeline.

ogg/opus — the API currently only outputs wav, there’s no ogg support on the API side right now. Since Defold’s sound component handles wav fine (and the in-editor seek/timeline actually relies on slicing PCM wav bytes), wav covers the Defold use case well — but if ogg output lands on the API roadmap I’ll add a format option in the dialog.

And yes, #8373 would be great — once editor scripts can play audio I can drop the whole afplay/aplay shelling.

3 Likes