Page 1 of 1

LunaDLL+SDL2_Mixer = FLAC,OGG,MOD,XM,IT, etc.

Posted: 1 Jan 2015, 15:37
by Wohlstand
Hello! I wanna present a some special thing: We with Kevsoft made a hook to the MCI call and we was got able to replace music/sound playback machine.

This this a build of LunaDLL which will completely replace SMBX's audio engine with SDL2_mixer. SDL2_mixer will give more, faster and flexible audio playback and more supported built-in formats! Also, SDL will play MIDI's correctly unlike default MCI, and will play traker music formats like .MOD, .IT, .XM, .S3M, etc... (you can create them through Mod Plug Tracker with or without using of MIDI-files as sources and with your samples, for example, which you used to build your own .SPC files)

Default MCI:
- Floods system tray with codec icons
- Loading slow
- Between loops you will hear clicks
- Supported formats: MP3, WAV and buggy playback of MID

SDL2_Mixer:
- Supported built-in formats: MP3, WAV, MID, OGG, FLAC, MOD, IT, XX, S3M, etc...
- Will prevent flood of system tray because SDL Mixer play all sounds and musics with built-in decoders!
- Almost instant music/sound loading!
- Faster and better sound playback
- Starting of music playback is faster!
- True and clean loop: you will don't hear clicks between loops if your sound have connected waves on edges
- We have able to implement customization of sounds and musics stuff through LunaDLL without replacing of default content and without re-hexing of smbx.exe!
- SMBX summary will starts FASTER!

phpBB [youtube]

Original link: http://www.youtube.com/watch?v=oIBI2aPT0C4


Download level file from this video with used musics:
https://drive.google.com/open?id=0B3QNPpAJx9HnLXJzVkptMm5zNVE&authuser=0


Restrictions:
========================================================================================
- You should convert all .MP3 sound effects into .OGG format (put your .ogg files into /sounds dir of SMBX, you can remove old .mp3 stuff, but save them just in case. LunaDLL+SDL will play .OGG sounds instead of original .MP3's).
- All your musics should have 44100 sample rate or you will hear dirty noise. You should re-sample your musics into 44100 Hz. (SDL's real-time re-sampler is buggy yet.). Why? Because SDL mixer plays all sounds and musics in the united stream and all tracks should have a uniform sample rate (SDL trying to re-sample them if they have sample rate which is not equal to sample rate of stream, but this is not giving guaranties for good playback).


How to use:
========================================================================================
Simple and easy: just unpack contents of archive and replace LunaDLL.dll with new (smbx.exe should be hexed with LunaDLL!) and your SMBX will have able to play more music formats! If you will don't use autocode or lua scripts, all SMBX's sounds and musics will be played through SDL anyway! You will take able put your .OGG, .FLAC or any tracker musics (.IT, .MOD, XT, etc...) into your "custom" music field and enjoy ;-)
But if you wish to use SDL with scripts, you now have a way to play multiple custom musics at one section!


Download official LunaLUA (Already includes SDL2_mixer)
_____________________________________________________________________________________________________

Useful stuff and examples

Download OGG stuff for SMBX 1.3.0.1
http://wohlsoft.ru/docs/Sounds/SMBX_HQ/SMBX-sfx-hq-ogg.zip
To take effects, unpack archive into your SMBX directory (sounds.ini and musics.ini - definition of standard musics and sounds, you can edit them instead of hack EXE!)

Download OGG stuff for A2MBXT
https://drive.google.com/open?id=0B3QNPpAJx9HncWp2eE5Hck1PNkE&authuser=0
To take effects, unpack archive into your SMBX/A2MBXT directory (sounds.ini and musics.ini - definition of standard musics and sounds, you can edit them instead of hack EXE!)

LUA Example 1 - multiple custom musics in one section!
https://drive.google.com/open?id=0B3QNPpAJx9HnZWo2UThWazJOcm8&authuser=0
(You have able use ANY files with formats: WAV, MP3, OGG, MID, IT, MOD, XM, S3M, etc...)

LUA Example 2 - Random music switch and panning stereo SFX loop effects!
https://drive.google.com/open?id=0B3QNPpAJx9HnUlBzdTdnWHFwV3c&authuser=0

Custom sound pack example
https://drive.google.com/open?id=0B3QNPpAJx9HnY0ZmVWVDSHZLS3c&authuser=0
Unpack them into root of any your episode and try to play it!


P.S> PGE uses SDL2_mixer to play musics and sounds!

Also:
Download software MIDI-driver which plays MIDI like SB16 on Windows 95/95: http://wohlsoft.ru/docs/Sounds/SMBX_OPL/opl3synth.zip
Driver for Windows XP/Vista/7/8. If you have Windows Vista/7/8 You will need a tool which giving able switch MIDI playback device
(I recommends a BASSMIDI http://www.kode54.net/bassmididrv/ ). In the Windows XP you can switch your MIDI device in the "Control Panel" / "Sounds and Audio Devices"

Customization of default sounds and musics WITHOUT replacing! (sounds.ini and music.ini)
========================================================================================
There are a special files which redefining music and sounds paths. You can just put them into SMBX root with sound and music fodlers
or you can insert them into your episode (you don't need to customize complete stuff, you can just replace only necessary).

Episode tree:

Code: Select all

/--MyEpisode
-|--Folder of musics
-------musicfile1.mp3
-------musicfile2.ogg
-------musicfile3.mid
-------musicfile4.it
-------...
-------...
----music.ini
----sounds.ini


In the INI-file all path relative to EPISODE ROOT: If put musics into subfolder "My Music", you should define paths:
....
file="My Music/myfile.ogg"
....

Same rule for sounds.ini!

In the "_ini_examples" folder you can take examples of INI-files redefinign of music and sounds stuff.

You have able use ANY music in next formats: MP3, OGG, FLAC, WAV, MID, IT, XM, MOD, S3M, (and other tracker music formats...).
You have able use ANY sounds in next formats: OGG, FLAC, WAV (Note: sounds in MP3 format will NOT work with SDL Mixer!)


SDL Mixer specific LUA API:
========================================================================================
Read official LunaLUA references

Posted: 2 Jan 2015, 21:16
by Void
This Is Awesome! Is There Any Way To Change The Soundfont Used For MIDI Files? (For Example, Make MIDI Files Sound Like The Sega Genesis In SMBX)

Posted: 2 Jan 2015, 21:59
by Wohlstand
Yes! You can install the BASSMIDI driver which is a midi driver which supports using of any sound fonts. I always use them and I using the Cakewalk Sonar 1.0 with patches which a great and advanced midi editor. (Now newer is Cakewalk SONAR X3 is much better and progressive, but for MIDI editing much better is an old build of Sonar 1.0)

Update of LunaDLL+SDL

Posted: 6 Jan 2015, 5:17
by Wohlstand
New update is available now!

  • Added sounds and default musics customization: you can use INI-files instead of hacking EXE to redefine paths to your audio files!
  • Added episode specific sounds and musics customization: you can use same sounds.ini and music.ini inside your episode to take able customize EVEN WORLD MAP MUSIC WITHOUT REPLACEMENT OF DEFAULT SMBX's STUFF! Also you can have custom P-Switch musics too!

Main page was updated, added examples of GLOBAL and EPISODE SPECIFIC audio stuff configs.

Posted: 13 Mar 2015, 13:58
by Wohlstand
Repost of my Talkhaus post:
Good news!
I just implemented the new audio API which has 33 API functions to work with sounds and musics!
https://github.com/Wohlhabend-Networks/LunaDLL/blob/master/LunaDll/LuaMain/LunaLuaMain.cpp#L235
Later there are will be available in next build, now I documenting a new stuff.
New stuff uses more useful things of SDL Mixer API, including the looped SFXed with ability to control them! Etc.
Also I was implemented the fix of annoy bug with Alt-Tab: It will work, but with new rules:
- Set ANY default music into section with LUA-music
- Add into onLoad() event the Audio.SeizeStream(xxx) (where XXX - is a section ID from 0...20. If you will write -1 - will be seized ALL sections). This function will seize music stream from SMBX engine and we can freely use music stream with LUA. This also fixing a bug: SMBX think than "Music is playing" and sends "pause" and "resume" commands to play/pause music by alt+tab switching.

Also I fixed bug with playing long SFXes after exiting from level: all custom SFXes and LUA Musics will be aborted when level/world will be closed.

Later I can bind more functions of SDL Mixer API:
http://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer.html

Documentation of new LunaLUA Audio API: http://wohlsoft.ru/pgewiki/LunaLua_global_Sound_and_Music_functions
Small tutorial of Audio usage: http://wohlsoft.ru/pgewiki/How_To:_Music_and_sounds

Experimental Pre-Release patch: http://wohlsoft.ru/docs/_laboratory/LunaLUA_v0.6-dev-patch.zip which contains some bug fixes and new LunaLUA Audio API
(Unpack this archive into SMBX directory after installation of current version of LunaLUA with replacing of files)

PROBLEM :(

Posted: 22 Mar 2015, 19:44
by lighthouse64
Ok I have this problem with the ogg files. Anyone know how to fix it?
Spoiler
Image

Posted: 22 Mar 2015, 23:32
by Wohlstand
lighthouse64 wrote:Ok I have this problem with the ogg files. Anyone know how to fix it?
Spoiler
Image
Careful read message: you have no sound on your PC

Posted: 23 Mar 2015, 8:02
by lighthouse64
Wohlstand wrote:
lighthouse64 wrote:Ok I have this problem with the ogg files. Anyone know how to fix it?
Spoiler
Image
Careful read message: you have no sound on your PC
oh DERP I forgot to plug in the headphones for sound. :facepalm: :facepalm: :facepalm: :p

Posted: 19 Apr 2015, 1:43
by Void
Could You make an Update That Supports SEGA Genesis BIN Files? I Noticed There's A SPC Format Supported, Could Ya Make A BIN Player For it? :)

Posted: 19 Apr 2015, 2:39
by tb1024
beanluv wrote:Could You make an Update That Supports SEGA Genesis BIN Files? I Noticed There's A SPC Format Supported, Could Ya Make A BIN Player For it? :)
I'm afraid this is not possible.

Playing a SMD (SG in USA) requires a software synthesizer which emulates the synthesizers employed in SMD, find out how to decode the operators inside and decode the melody. And there aren't any OSS SMD Bin players out there. Althrough I'm sure if Wohl and Kev are skilled enough, they can look at an emulator's source code and grab the soundcard emulation part.

Unlike SNES, which you've got a plenty of open sourced SNES players, and you just need to grab the samples and the melody.

Posted: 15 Sep 2015, 16:57
by ditrox
The 7z with SMBX ogg sounds is broken

Posted: 15 Sep 2015, 20:06
by Wohlstand
ditrox wrote:The 7z with SMBX ogg sounds is broken
Don't care about it. Now you can download latest LunaLUA package (New instalation, not "update only") which will already have ogg sounds.
BUT, right link is: http://wohlsoft.ru/docs/Sounds/SMBX_HQ/SMBX-sfx-hq-ogg.zip