Currently there's only 2 ways to play audio that I'm aware of:
1. Use an entity that makes sound (lots of processing overhead as the entity is doing a bunch of stuff I don't need)
2. GUI left-click sounds (only applicable to GUI).
I'd like a way to emit sound at a specific map location, without having to place an entity, ideally by first defining a `sound` prototype (so I can set volume via data.lua, preload, etc) and then using it via an API call (method on LuaSurface, possibly with ability to limit to specific player) passing in the name of the sound prototype.
If there are low-overhead ways to do this already, please let me know
Programatical way to play audio
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Programatical way to play audio
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: Programatical way to play audio
About audio, I wanted to make a musical mod that provides something like Minecraft's Jukebox.
I used assembling machine as the entity and changed its working sound. The idea was that when the machine received a musical material, it plays sound for roughly 0.5 seconds.
But the main issue was that the working sound didn't transmit far enough. It was loud when I was standing next to the machine. But if I walked away, the sound was lowered too quickly.
I have thought about calling API to play sound too. So I think I have to second this request.
(Or more specific to my case: I need a property that can change sound transmit distance. )
I used assembling machine as the entity and changed its working sound. The idea was that when the machine received a musical material, it plays sound for roughly 0.5 seconds.
But the main issue was that the working sound didn't transmit far enough. It was loud when I was standing next to the machine. But if I walked away, the sound was lowered too quickly.
I have thought about calling API to play sound too. So I think I have to second this request.
(Or more specific to my case: I need a property that can change sound transmit distance. )