News:

Want to praise Simutrans?
Your feedback is important for us ;D.

[Project proposal] Optional music and podcast integration

Started by victor_18993, August 26, 2026, 01:00:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

victor_18993

I am considering adding optional external audio support to Simutrans, but I would only implement it if there is real interest from the community.

The idea is to integrate it into the existing Music options, so players could keep the normal Simutrans soundtrack, use local music, or connect a supported streaming provider. From inside Simutrans they could browse their own playlists and control playback without leaving the game.

For podcasts, the same interface could allow players to search subscriptions/episodes and listen while playing, using open podcast feeds where possible.

Simutrans would not download, copy or redistribute music or podcast files. Playback would come directly from the provider or podcast feed.
Possible music providers include:

  • Apple Music
  • Audius
  • Jamendo
  • Deezer — subject to final API/usage confirmation
  • Qobuz — likely requires API/partner approval

Spotify cannot currently be integrated, because Spotify's Developer Policy explicitly prohibits using the Spotify Platform inside games.
For podcasts, possible sources include:
  • Podcast Index
  • RSS feeds directly
  • Listen Notes / similar podcast directories

The goal is simply to make long Simutrans sessions more comfortable and immersive: players could stay inside their Simutrans world while listening to their own music or podcasts.

This is only a proposal for now. I would implement it only if the community considers it useful.
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)

Isaac Eiland-Hall

If it gets implemented, I can see hosting a site for music. A worry would be allowing others to upload, but I might open it to Devotees contributing. Might be worth figuring out how to make it so that when simutrans send the request to the site, it has to provide some sort of key - imho, it'd be fine to be a single key for all of Simutrans - the idea being make it just difficult enough to discourage random passersby while keeping it simple for Simutrans.

It would be really awesome to be able to create music for Simutrans. We had some really great compositions a few years ago, and MIDI isn't.... well, okay, it is terrible. heh. But being able to create stuff to share as like mp3 or whatever actual audio format would be nice.

prissi

Support for sample playback is absolutely easy. Actually, the windows version can play mp3 inside wav files since forever.
Turning the midi to mp3 would also allow to get rid of the huge and hard to include midi lab with its huge soundfonts. MIDI indeed is a fossil from DOS.
But Simutrans is not excluding normal player running beside it. Also, the midi player interface is rather rudimentary. Hence, player use the favourite software parallel to Simutrans seems like a better option.
Finally, I am uncomfortable to bind commercial links to Simutrans, feeling like an endorsement of streaming services with their questionable impact on niche music. (Even though that ship has long sailed.) For me, streaming music is a personal choice but nothing Simutrans should endorse.
Maybe I am too old though.
So I am all for turning music support to mp3, but that's about it.

makie

I fully agree with Prissi.

Another point is the Android Play Store. We currently state that we do not pass on any data to third-party services. That would then have to be changed to a complex privacy policy requiring user consent, etc.

Support for MP3 audio in the simutrans/music folder or the pak???/sound would be nice.
Maybe there are free music oder sounds that we could provide.

victor_18993

Thanks for the feedback. I think I should clarify the idea a little better.

The intention is not to link Simutrans to, endorse, or depend on any commercial music platform. Apple Music, Audius, Jamendo, etc. were simply examples of services that expose APIs that could technically be used by an optional audio-provider interface.

The design I have in mind would be provider-neutral. If there is an open-source or community-oriented service that fits Simutrans better, please suggest it and I will gladly investigate its API.

Isaac's idea of hosting music for Simutrans is also very interesting. We could support a community-hosted catalogue alongside local music, podcasts/RSS and any optional external providers, all through the same player interface.

Regarding privacy, Simutrans would not collect user credentials, account passwords or personal information, nor send Simutrans user data to third parties. For services such as Apple Music, the user explicitly authorizes their existing account and the client communicates directly with that provider using an authorization token. Simutrans would only request the minimum information required for playback, such as playlists and tracks.

There would be no hidden telemetry or automatic connection to any external service. Nothing would happen unless the player explicitly enables and authorizes a provider.

So the goal is really broader than integrating a particular commercial service: to create an optional, neutral audio layer that lets the player choose how they want to experience Simutrans.
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)

Isaac Eiland-Hall

Also notably, if people want to stream music from an existing provider, they can probably typically do that while playing Simutrans. I'm not sure about Android offhand, I've not tried to stream in the background while playing a game. But for desktop users at least, they can surely stream music in the background seamlessly.

But being able to provide curated channels of music like The Sims does would be nice.

While thinking about how I'd like something like this to work - just throwing this out here, not the suggestion on how I think it shoudl work:

- Multiple channels available to sort out possible styles of music - if we enough enough tracks to warrant it. I could envision old-time public domain music, with some Railroad Tycoon style stuff, some big band style. Maybe jazz, maybe stuff that feels like a city, maybe upbeat stuff, maybe laid-back stuff. A single track appearing in applicable categories
- Just occurrred to me, a special channel that plays music from the decade you're in - or rather, each track has a year associated, and every time the year changes, the playlist updates to play stuff mostly from the past 5 years or decade, weighted toward the new stuff but set so it doesn't repeat too often, allowing some older stuff up to the past 20 years, weighted less as the time goes back.
- Ability like The Sims to uncheck tracks so they don't play so ones people hate won't play
- In an ideal world, we'd have music from multiple places - at least the countries from which we have enough uers to contribute music.

So ideally you could choose one or more styles of music, one or more regions of music, one or more eras of music.

And maybe allow for curated lists - someone can create a playlist that they like or think others would.

That's very very complex on options. Too much to start. But a slew of ideas means others can refine and improve and come up with better ideas.

To start, having a single "channel" means replicating the music options we have now, just mp3/etc instead of MIDI. heh.

So per-pak music would already be an improvement and another wy for paks to differentiate themselves :)

But I'd definitely love to find some music like Railroad Tycoon that we could bring in.

makie

It would be useful for adding a bit more atmosphere to the game if buildings like the CUR could have a sound effect—similar to the factories when the cursor is nearby.

Nazalassa

#7
If the music is unrelated to the state of the game itself, then I think anyone can use their favourite audio player to listen to whatever they want. No need for the game to do this itself.
If it depends on the state of the game (e.g season, year, pax transported, etc.) then there are endless possibilities, so they cannot all be implemented in the program itself. People may want widely different things, so implementing only some will likely not have everyone covered.

Maybe add "music-scripts"? i.e use a script to change the music, perhaps by providing an "on_music_change" callback so each time the music changes the script decides which goes next. The game gets the music name etc. form the file, unless the script says otherwise. The scripts would be within the music/ directory and could be selected from the sound settings. The game does nothing more.

This allows payers to write their own music-scripts.

An example:
 - installation instructions: drop file openttd-music.nut and directory openttd in the music/ directory
 - script looks like: (pseudo-code, I cannot squirrel yet)
path = "openttd/"
function on_music_change do
   file = random_file_under(path)
   return file
end

More advanced scripts could conceivably e.g access the internet, find a music published in they current game-year, download it, and play it. Although maybe not from the squirrel scripts...

(This however does not work for reading audio streams, without downloading a file. Maybe another callback, to supply audio data directly?)
Making paks since October 2023  |  pak48.bitlit | pak32.box | MLM for pak64 | Empire F7 cars | Pneumatic tubes | More pak64 vehicles and industries

Life is like a multi-tasking OS: you know you'll eventually get back to everything, but you don't know when.

isidoro

I think that going this path isn't a good idea.  Simutrans is a game, not a media player.  If I'd like to listen to music while playing (which isn't the case), I would use another application to do that and I'd choose the one that fits my taste more (nice interface or options, which won't probably be the ones chosen for ST).

Or maybe are we talking "mobile phone" world?  In that case, we're trying to solve a problem of a defective design (Android) in our program vs. other systems (desktop) that don't have it.

On top of that, when implementing new options, one has to think not only about the cost of development, but also the cost of maintenance of that code (interface evolution/deprecation, etc.)

I'm with Prissi that getting rid of MIDI makes sense nowadays for just the same reason...  If I want to play midi, I'd choose the right synth.  It seems a waste of space to carry all that burden (samples, etc.) to finally get a poor result.

victor_18993

After reading the replies, I think the discussion has actually clarified the direction quite well.

Rather than adding an API for external music services or podcasts, what I take from the comments is that it probably makes more sense to look at modernising the sound and music system that Simutrans already has.

This also fits naturally with the SDL3 work. The SDL3 backend is already integrated into the Simutrans codebase, and I have tested the current music playback with it. At the moment, the music behaves the same as it does with SDL2, so there is no regression there.

The interesting difference is that SDL3 gives us a more modern audio foundation, with better support for current audio devices and a cleaner path if Simutrans eventually wants to move beyond the existing MIDI-centred approach.

So perhaps the more useful question that comes out of this discussion is not "how do we add external music?", but:

What should the Simutrans music system evolve towards?

At the moment, the subsystem is still designed around MIDI. Would it make more sense to evolve it into a format-independent music system that can use normal compressed audio files, for example with Ogg Vorbis as a standard format? Should MIDI remain supported for compatibility, or should it eventually be phased out?

Reading the comments, this seems much more aligned with the direction being suggested in the thread: keep music inside Simutrans, without Internet services or external APIs, but modernise the audio system that is already there.
I would be interested to know what format and compatibility approach people think would make the most sense.
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)

makie

No one needs Simutrans just to listen to a playlist or play tracks from one at random; other programs handle that better. In other games, the music is context-sensitive. For example, combat music kicks in when a monster attacks, danger music if it is nearby and calm music plays once the fight is over. We don't have that kind of thing in Simutrans. What we have are sounds like the buzz of a chainsaw in the forest when timber is being felled, the sound of a train departing or a crossing gate closing, or simply a "click" to confirm the construction of an object. These are the sounds that create the atmosphere in Simutrans. It would be great to have more of them, and in MP3 or Ogg Vorbis format, too.

Someone could also convert the MIDI files into MP3 or Ogg format, which would allow us to remove MIDI support entirely. Roboron got MIDI support working again—thanks for that—but for a long time, MIDI playback was broken, and then we had more players as today.

[DE]
Musik per Playlist hören, oder per Zufall aus einer Playlist, dafür braucht niemand Simutrans. Das können andere Programme besser. In anderen Spielen ist die Musik Kontext abhängig. Wenn zum Beispiel ein Monster angreift dann kommt Kampfmusik. Wenn der Kampf vorbei ist dann kommt ruhig Musik. Sowas haben wir in Simutrans nicht. Was wir haben ist dass im Wald die Motorsäge zu hören ist wenn Holz geschlagen wird. Wenn der Zug abfährt, die Bahnschranke schließt, oder ganz einfach Klick als Bestätigung für das Bauen von einem Objekt. Es sind Geräusche die die Atmosphäre bei Simutrans bilden. Da gerne auch mehr und auch in MP3 oder Ogg Vorbis.

Es könnte auch jemand die Midi Dateien in MP3 oder Ogg überführen. Dann könnte man die Midi Unterstützung entfernen. Roboron hat die Midi Unterstützung wieder flott gemacht, danke dafür, aber lange Zeit war das Abspielen von Midi kaputt und da hatten wir mehr Spieler als heute.

-------------------------------------------------------------

Edit: another idea in additionto this:
Quote from: makie on August 26, 2026, 03:39:20 PMIt would be useful for adding a bit more atmosphere to the game if buildings like the CUR could have a sound effect—similar to the factories when the cursor is nearby.
SimCity has radio announcements "heavy traffic in the city" or "traffic jam"
We could underlay the messages "No route" and "Vehicle %s is stucked!" with a sound.

add a column sound on/off at this

prissi

Translation dependent sound is a big can of worms. One could, at least on Windows, delegate this to the OS.
On the other hand, such messages are less useful when you still have to click on it to go there. Also, Simutrans GUI (and general gameplay) is certainly not compatible with screenreader or blind people ...

victor_18993

That's a good point. I was not thinking of storing translated voice files in Simutrans; that would indeed become difficult to maintain.

Using the operating system's text-to-speech service for translated messages could be a much cleaner approach, especially on Windows. Simutrans would only provide the already translated message text, while the OS would handle the voice.

Creo que también es útil diferenciar dos ideas: los sonidos ambientales o de eventos, como el tráfico o los edificios, y el diálogo opcional para los mensajes del juego. 

I think it is also useful to separate two ideas here: ambient/event sounds, such as traffic or buildings, and optional speech for game messages. They do not necessarily need the same implementation.

Your point about having to click the message afterwards is also interesting. If speech were ever added, it would probably make sense to review which information can be conveyed completely without opening another window.

I agree that proper screen-reader accessibility would be a much larger subject. I would prefer not to mix that entire problem into this proposal, but using system TTS for messages could at least be a useful first building block.
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)

makie

I wasn't thinking about spoken dialogue—even though that's how SimCity handles it (and, incidentally, it doesn't translate that part; the message is spoken in English even in the German version).

I was thinking of sound effects, like car horns during a traffic jam ("Vehicle %s is stucked!") or screeching brakes when there's a "No Route" issue.

It has actually happened to me that I overlooked such problems for months amidst the flood of open windows, causing entire supply chains to collapse.