Play SID files in the simplest way.

BlitzMax Forums/BlitzMax Beginners Area/Play SID files in the simplest way.

Schwang(Posted 2013) [#1]
Hi guys.

I'd like to be able to play Commodore 64-style SID files in a bmx project.

The forums revealed that MaxMod2 is the only way to do this - is that still correct?

After several hours, finally managed to install and get MaxMod2 to compile, so that step is under my belt. I found GMan's old wrapper, which looks out of date since it still refers to an older version of MaxMod - can't use it.

I assume MaxMod2 is still the way to do this, but most of the references I find seem to be years old and I can't get so much as a sample SID file to play.

Please help.

EDIT:
-----
Solved in post 8 below: http://www.blitzmax.com/Community/post.php?topic=100331&post=1184088


Ole JR(Posted 2013) [#2]
Brucey has a SID player mod thingy in his googlecode svn repository.
No idea if it (still) works, or how.

http://maxmods.googlecode.com/svn/trunk/


jsp(Posted 2013) [#3]
Also gman did something in the past:
http://www.blitzmax.com/Community/post.php?topic=60937&post=685481


Schwang(Posted 2013) [#4]
Thanks guys. Brucey's code seems to refer to bah.mod - if I'm not mistaken, this is something that was in the old and now unsupported MaxMod, and is therefore not usable?

The link to Gman's solution is also broken. Will try to do more research when there's time.


Brucey(Posted 2013) [#5]
My SID player module plays fine with its related BASS audio module.


Schwang(Posted 2013) [#6]
Cheers Brucey, please check that my setup is correct:

-Created new folder under Blitzmax\mod called BaH.mod.
Path is now Blitzmax\mod\BaH.mod

-Added 2 subfolders. Paths are:
BlitzMax\mod\BaH.mod\bass.mod
BlitzMax\mod\BaH.mod\sid.mod

-Copied the contents of http://maxmods.googlecode.com/svn/trunk/bass.mod/ and http://maxmods.googlecode.com/svn/trunk/sid.mod/ into these subfolders, respectively.

-Fired up Blide's module compiler and received no errors.

When I try to compile your provided SID player example_base.bmx file, the error message is "Compile Error: Can't find interface for module 'bah.sid'".

Blide recognizes that path though, not sure why the compiler doesn't. I'm not very experienced with Blitzmax's folder structure, sorry. Can you spot what the problem is?


Brucey(Posted 2013) [#7]
You'll also need sidbass.mod

And probably name BaH.mod as bah.mod (in case gcc wants to be case sensitive)


The example_base.bmx is just some base code for different drivers.

If you look in sidbass.mod/examples you'll find the real example there.


Don't forget to build modules too, which you'll need to do.
You'll probably also need a copy of bass.dll (from the bass.mod/lib/win32 folder) in the same folder as your exe.

Plenty to do :-)


Schwang(Posted 2013) [#8]
Success! Thanks Brucey, the example works and everything sounds wicked cool!


To save future users some headaches, here's the full process to follow getting SID files to play in the simplest (?) way possible:

1. In your BlitzMax\mod folder, create a new folder called "bah.mod".

2. Added 3 subfolders inside bah.mod as follows:
-BlitzMax\mod\bah.mod\bass.mod\
-BlitzMax\mod\bah.mod\sid.mod\
-BlitzMax\mod\bah.mod\sidbass.mod\

3. Download the respective mods into these new folders:
> bass.mod = https://code.google.com/p/maxmods/downloads/detail?name=bass_1_01_src.zip&can=2&q=
> sid.mod = http://maxmods.googlecode.com/svn/trunk/sid.mod/
> sidbass.mod = http://maxmods.googlecode.com/svn/trunk/sidbass.mod/

4. Compile these mods and build their documentation (use Blide's built-in Advanced Module builder using MinGW or search the forums how if you've not done it before).

5. Copy bass.mod/lib/win32/bass.dll to the folder your exe will be in (in this case, copy it to the folder below, in step 6).

6. Open sidbass.mod/examples/example.bmx, compile & run to verify that it's all working.

You're now able to play SID files! Now just refer to the .bmx files from the other mod folders to learn how to integrate SID files into your own projects using Brucey's library.


Kryzon(Posted 2013) [#9]
You're not now able to play SID files! (corrected)


Schwang(Posted 2013) [#10]
:O

Thanks Kryzon. Reeeally unfortunate typo there haha


Hotshot2005(Posted 2013) [#11]
this should be sticky topic because in the future...people will be asking the same questions as this!


Brucey(Posted 2013) [#12]
If I ever get around to making other audio drivers for it, I might release it as a download proper... but it's a bit of work to do that (as you'll see if you look at the sidbass source)

Sticky? I shouldn't think so.


Xerra(Posted 2013) [#13]
Thanks for all the comments in this thread. I've been tinkering with Blitzmax and using sid files for years on and off. I even found some source code for a gui sid player I was working on about six years ago that I can now get working with Brucey's mod.

Very much appreciated, guys.


Schwang(Posted 2013) [#14]
Glad you found this useful Xerra. All my previous attempts at getting this to work has failed, as all the threads about SIDs are very outdated and many of the links point to pages that don't exist, a real pain.

It'll just be up to us, the community, to keep try and keep our experiences up to date on these forums since they're the only real place to share info & knowledge.


Xerra(Posted 2013) [#15]
I tinkered around some more with it but I'm definitely rusty these days as I couldn't incorporate it into a gui interface as the code confused me.

Looking at it, I suspect it's not able to run that way anyway as a gui is waiting for an event nearly all the time and paused which means the sid wont play without repeated calls to the update function - unless i'm reading it incorrectly.


Schwang(Posted 2013) [#16]
Xerra, yes, it does seem to need an update for each loop. Not a problem for a standard game loop structure I typically use, but I suspect for an event-driven interface you'd need a different solution.
Here's a little program I slapped together as a tester:




Xerra(Posted 2013) [#17]
Yep, that does work but it'll only play the first track of the loaded sid. I took apart Brucey's example in the module archive as that demonstrated how to have multiple tracks loaded in and playback any of the tunes within each one.

I just wish I'd looked a bit harder at it and realized that it wouldn't work within a gui interface in its current state :-)

It's not all bad, however. Always a good excuse to listen to some old classic Sid tunes when I'm tinkering with stuff like this.


Schwang(Posted 2013) [#18]
When you load a sid file, all the tracks are loaded as well. This new example below is updated to include the left/right keys to skip between tracks with the variable 'trackNr' instead of using play(0) which always plays only the 1st one.




Brucey(Posted 2013) [#19]
a gui is waiting for an event nearly all the time and paused

You can always run a timer, which ticks regularly, waking the GUI so you can call update or whatever.


Xerra(Posted 2013) [#20]
I have no idea how to do that. Can you show a simple example if it's not too tricky?


Schwang(Posted 2013) [#21]
While this works and is functional, I must say that as a bit of an audiophile, the quality of the SIDs played via my program sound vastly inferior to those played via Sidplay2/w, my favouritest SID player.

Brucey, I reckon you're the man for this. Supposedly, the audio quality has something to do with the bass.dll file, right?

Sidplay comes with its own set of DLLs which I assume you can't simply slot into a bmx program. Is there some way to do this?


Brucey(Posted 2013) [#22]
The problem with libsidplay2 is that it has a GPL license, which precludes me from doing anything interesting with it.

I don't have anything against GPL and its friends as I use a lot of GPL'd software myself. But as for providing modules, I try to stick to a minimum of LGPL, which makes things more useful for people in general (who may not want to release the source to their programs).

So yes, if libsidplay2 had a less restrictive license I would have gone with that instead.


Xerra(Posted 2013) [#23]
So we can't bribe you to tinker with it? Even if we have cookies? :)