Author Topic: How to make Simutrans play custom music?  (Read 1615 times)

0 Members and 1 Guest are viewing this topic.

Offline IgorEliezer

  • Devotee
  • Administrator
  • *
  • Posts: 3941
  • Total likes: 134
  • Helpful: 70
  • Lost In Stupid Parenthesis
    • Igor Eliezer Architect and Urban Planner/Arquiteto e Urbanista
  • Languages: PT, EN, AutoLISP, Python
How to make Simutrans play custom music?
« on: January 03, 2015, 02:23:52 PM »
Theoretically, Simutrans can play custom music that is saved in /simutrans/music. If you open the said directory you'll find the readme.txt, which says:

Quote
You can put your own music files here. Edit music.tab to list them
and Simutrans will read and play them.

Good. Say, I downloaded this track (Mr Mealeys Mediocre Machine.mp3) and saved in the proper directory.

Then I edited music tab:

Code: [Select]
# music.tab
music/01-Mr Mealeys-Mediocre-Machine.mp3
Mr Mealeys Mediocre Machine

I don't know if the hyphens and the "01-" are necessary. Needlessly to say the file name also reflects the name in the tab file.

And, it didn't work. The "Sound" dialog displays the same of the music (01 Mr Mealeys Mediocre Machine), and the "Mute" button is not pressed, but I can't hear anything.

I'm guessing Simutrans doesn't support mp3.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4733
  • Total likes: 180
  • Helpful: 108
  • Languages: EN, NO
Re: How to make Simutrans play custom music?
« Reply #1 on: January 03, 2015, 03:39:29 PM »
Last I checked, Simutrans played MIDI music only. Supporting files of various formats is quite complex requiring libraries almost as big as Simutrans itself. There are also patents involved with many of them. I think we discussed supporting Ogg Vorbis once, which is an open format, but the format is almost unknown, despite being the only format used on Wikipedia for audio (or was for some time). For sound effects, Simutrans only supports uncompressed sound, but uncompressed music takes a lot of space, unless the quality is cranked way down.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8764
  • Total likes: 307
  • Helpful: 229
  • Languages: De,EN,JP
Re: How to make Simutrans play custom music?
« Reply #2 on: January 06, 2015, 09:32:36 PM »
Simutrans will play any files when compiled with SDL_mixer. Otherwise only midi and wav.

Offline NNW

Re: How to make Simutrans play custom music?
« Reply #3 on: January 11, 2015, 07:36:36 PM »
Simutrans will play any files when compiled with SDL_mixer. Otherwise only midi and wav.

I have tested 120.0.1 with and without sdl, with mp3 and wav.
Simutrans dont play any music but midi, regardless of sdl or not.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2593
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: How to make Simutrans play custom music?
« Reply #4 on: January 11, 2015, 08:24:52 PM »
SDL_mixer != SDL

You need to compile it yourself to compile with SDL_mixer.

Offline kierongreen

Re: How to make Simutrans play custom music?
« Reply #5 on: January 12, 2015, 01:04:59 AM »
I'm not sure SDL_mixer build is even supported on Windows? I put it in because it was the easiest way to get MIDI playback on Linux. The other formats were a bonus (although there is issues with the sample rate for those!).