{"id":23665021,"url":"https://github.com/jcash/defold-sound-stream","last_synced_at":"2026-07-19T11:36:59.114Z","repository":{"id":269293232,"uuid":"906967431","full_name":"JCash/defold-sound-stream","owner":"JCash","description":"Examples of how to stream sounds","archived":false,"fork":false,"pushed_at":"2025-01-29T15:49:35.000Z","size":3653,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T22:47:54.206Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JCash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-22T12:54:43.000Z","updated_at":"2025-01-06T13:56:45.000Z","dependencies_parsed_at":"2025-06-16T20:47:17.891Z","dependency_job_id":null,"html_url":"https://github.com/JCash/defold-sound-stream","commit_stats":null,"previous_names":["jcash/defold-sound-stream"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JCash/defold-sound-stream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCash%2Fdefold-sound-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCash%2Fdefold-sound-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCash%2Fdefold-sound-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCash%2Fdefold-sound-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JCash","download_url":"https://codeload.github.com/JCash/defold-sound-stream/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCash%2Fdefold-sound-stream/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35651746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-19T02:00:06.923Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-29T05:41:09.218Z","updated_at":"2026-07-19T11:36:59.090Z","avatar_url":"https://github.com/JCash.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sound streaming\n\nSound streaming is useful to keep memory usage down to a minimum.\nIt is also convenient for streaming audio over the http protocol.\n\n\n## Test project\n\nThe project tests streaming sounds by playing a looping sound.\n\n* The current sound formats are .ogg, or .wav.\n\n* The streaming source may come from:\n    * The game files (Using the Defold archive or file provider)\n    * Web url (Using the Defold http provider)\n\n\n## Configuration\n\nThere are two ways to configure sound streaming.\n\n### Enabling the streaming\n\nCurrently, while it's an experimental feature, you need to enable it manually by editing `game.project`:\n\n```ini\n[sound]\nstream_enabled = 1\n```\n\n### Setting the preload size\n\nThe preload size is the number of bytes loaded as the first, partial chunk of a sound resource:\n\n```ini\n[sound]\nstream_preload_size = 16384\n```\n\n### Setting the sound chunk size\n\nThe streaming sounds are loaded in chunks (default 16k).\nThis can be configured by the setting `sound.stream_chunk_size`\n\n```ini\n[sound]\nstream_chunk_size = 16384\n```\n\n### Setting the sound cache size\n\nThe sound chunks are stored in a cache.\nWhen the cache is full, old chunks are evicted based on a LRU scheme (least recently used).\nThe size of the cache can be configured by the setting `sound.stream_cache_size`. Default is 2MB.\n\n```ini\n[sound]\nstream_cache_size = 2097152\n```\n\n\n## Creating sound data at runtime\n\nThe example also shows how to create a new resource from scratch, by downloading initial bytes over http.\nUsing this initial chunk of data, it's possible to register a new resource as a streaming resource.\n\nBy mounting a `http` file provider to the `liveupdate` system, it is possible to continue streaming from the specified URL.\nNote that the server as the URL has to support `ranged requests`\n\n\n# Testing\n\nYou can build \u0026 run the project from the Defold editor, but currently, there is no gui setup.\nSo we recommend using the command line to test the various features.\n\n## Build\n\nNo special commands are needed:\n\n```bash\njava -jar ~/work/defold/tmp/dynamo_home/share/java/bob.jar clean build\n```\n\n## Run\n\n* .ogg\n* Loading from the file system\n\n```bash\nDM_QUIT_ON_ESC=1 ./path/to/dmengine --config=test.sound_type=Ogg\n```\n\n* .wav\n* Loading from the file system\n\n```bash\nDM_QUIT_ON_ESC=1 ./path/to/dmengine --config=test.sound_type=Wav\n```\n\n\n* Specify url to file server\n* Specify relative path to files on file server\n\nStart a server at `http://localhost:8000`\n```bash\npip3 install RangeHTTPServer\n(cd path/to/project \u0026\u0026 python -m RangeHTTPServer)\n```\n\nRun the example, using the `--config` options:\n```bash\nDM_QUIT_ON_ESC=1 ./path/to/dmengine --config=test.sound_type=Web --config=web.url=http://localhost:8000 --config=web.filename=web/mary-had-a-little-lamb-loop.wav\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcash%2Fdefold-sound-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcash%2Fdefold-sound-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcash%2Fdefold-sound-stream/lists"}