max mod player

BlitzMax Forums/BlitzMax Programming/max mod player

REDi(Posted 2005) [#1]
Could a few of you test THIS for me please? (windoze only)

Its an Amiga Soundtracker MOD player done with max and directsound that I'm writing for fun, I just want to see how stable it is on a few different systems. It does use threading so it might even crash on ya.

BTW not all effects have been added yet but the most important ones are in :)

You'll need to find an amiga mod song to play, if you don't have any already just do a google search.


Haramanai(Posted 2005) [#2]
It plays but never had an amiga so i can't tell if the quality of the emulation is good.
The bigest problem is that sometimes it have small scrathes that as i have understand it's poses.

I am at 466mhz. Win 98. and an onboard sound card.


Sledge(Posted 2005) [#3]
Fairly glitchy on the mods I tried (portamento was out, some notes detuned, oh and it goes nuts if it loses focus), but it's still damn impressive. Hope you're going to see it through to completion.


EOF(Posted 2005) [#4]
Here's a collection of mods to play with:

SoundTracker Mods

The ones in the zip with a prefix of XXX have problems playing:

* Thalamus - Either makes the program quit or plays incorrectly until SongPat 3
* Leave Me Alone - Portamento and speed wrong

There were a couple of others that make the app quit and on other occasions they'll will load and play.

Are you aiming to handle more formats than the 4-channel SoundTracker type?

Good luck with this one.


REDi(Posted 2005) [#5]
Thanks for testing it guys, yeah lots of bits are still missing that can make it sound really bad, but I'm more concerned about performance issues like being able to fill the channel buffers quickly enough, this works by filling one half of the buffer while playing the other half.

I've put a new version up, might be a bit better, I've tweaked the threading and removed a really silly bug from the player thread, the problem when using threads is you can't use the max debugger at all, it crashes the IDE :(

@Haramanai would you mind trying it again for me please, just to see if its any better now, if it works on your specs I'd happy.


REDi(Posted 2005) [#6]
@jb Thanks mate I'll take a look at them, yeah I'm planning on writing a tracker in the end, I'll probably have a look at xm next but I thought I would start with an easy one to see how max handles it.

Do you get any buffer underruns at all?


REDi(Posted 2005) [#7]
New version HERE


EOF(Posted 2005) [#8]
Do you get any buffer underruns at all?
Do you mean things like sound skipping, clicks etc ..?
The new version (v0.05) seems fine on my setup.
I like the new tracker-style pattern updating.

Now, wheres the funky oscilloscope already? :)


REDi(Posted 2005) [#9]
Do you mean things like sound skipping, clicks etc ..?

Yeah it sounds a bit like a cd jumping.

I think "Leave Me Alone" sounds a lot better now, nice mod btw.
Does "Thalamus" still bomb out for ya? plays okay here (I think)

Anyone else care to test it, I need to know how stable it is, also any comments on the sound quality, or if you hear any bugs. Thanks in advance.


Haramanai(Posted 2005) [#10]
Sorry man I am in format procedure right now on this old Machine. I will check it when all will have been done.


REDi(Posted 2005) [#11]
No worries Haramanai


BlackSp1der(Posted 2005) [#12]
Crash over crash for me -_-'


EOF(Posted 2005) [#13]
Does "Thalamus" still bomb out for ya? plays okay here (I think)
Still plays incorrectly at pattern 1.
Try playing it via the excellent (and free) MadTracker 2.5

All of the mods are playing at a tempo of 125 too.

Also, for some reason, the app quits at random locations.
It's as if the ESC key is being triggered.
Not sure if it's my coordless keyboard/mouse causing this. I noticed it happen before on other Max 'console' apps.

Are you able to jump to different patterns?
If so, it might be worth adding PageUp/PageDown key checks so we can jump around and check different parts of the tune.


REDi(Posted 2005) [#14]
@BlackSp1der that's not good, what specs are you on? Does it play anything, or does it just not start at all?

Still plays incorrectly at pattern 1.

Oh right, I think its fixed now. (in v0.07)

All of the mods are playing at a tempo of 125 too.

I've noticed that most songs are 125, I have seen it handle <>125 but I just can't seem to find any of them mods ATM :(

It's as if the ESC key is being triggered.

Sounds like it might be the old thread safety thing, I'll have to look into that, believe it or not it hasn't bombed out on me at all for days.


xlsior(Posted 2005) [#15]
Sounds pretty impressive -- is this all made from scratch, or are you using any rd party libraries such as fmod?

Are you intending to release this as a (free?) module at some point, or are you making this jus tfor your own use?

I just threw the old Amiga 'chuck rock' theme at it, and the first three sheet sounded absolutely horrendous (some very loud messed up samples), but sounded great after that.


REDi(Posted 2005) [#16]
is this all made from scratch

Yep, just BlitzMax and DirectSound8.

Are you intending to release this as a (free?) module at some point

yeah if I ever get it stable enough, the main problem is that I can't use the blitzmax debugger and the player thread at the same time :( but I could do it so that it disables in debug mode.

I just tried chuckrock and nearly woke the kids up with it =) I'll get that sorted, cheers mate. *EDIT* It didnt like it if the sample didnt exist, fixed now.

New version HERE


REDi(Posted 2005) [#17]
Strange, Why does it run better after I've just compiled it? If I download a copy and run it from the rar, then drag the window about the music distorts, but when I compile from the IDE and drag it about it plays perfectly... WTF? any ideas?

*EDIT* And if I download it and then extract it to the harddrive, Its even worse!

*EDIT* If you manualy change the priority to high with task manager you can hear it how i hear it after a fresh compile, something must be messing with my priority settings somehow :(


EOF(Posted 2005) [#18]
Better. The Thalamus track works now.

I have added another one to my collection called:

XXX - FurElise.mod

This is a simple tune (piano) which I notice a lot of buzzing/crackling/noise. It also plays too slowly.
In Madtracker, the playback speed is:

BMP: 150 LPB: 4 Speed: 5


REDi(Posted 2005) [#19]
FurElise seems to be a Fasttracker 6 channel mod, not supported... yet :)


xlsior(Posted 2005) [#20]
I just tried chuckrock and nearly woke the kids up with it =) I'll get that sorted, cheers mate. *EDIT* It didnt like it if the sample didnt exist, fixed now.


Hey, don't say I didn't warn you! :-)

It works great now, by the way.
I did notice that my CPU utilization stays up around 35-40% on my 2800+ -- Is it actually using that much to play the music itself, or is part of it used just sitting around?

Any idea what the minimum system specs are before the quality of the music starts to deteriorate?


REDi(Posted 2005) [#21]
I did notice that my CPU utilization stays up around 35-40% on my 2800+ -- Is it actually using that much to play the music itself, or is part of it used just sitting around?

I've put a new version up that just does the player on its own, goes around 0-3% on my machine.
I've got no idea what the minimum spec would be, anyone on a slow machine want to test it for me?

New version HERE


xlsior(Posted 2005) [#22]
Hm... that one doesn't seem to do anything.
when I launch the test12 application, it gives me the file requester dialog. I pick a file, it opens and immediately closes a window.

No sound whatsoever, and it's not listed in my process list anymore either.

No error messages, tried various modules including the ones you included in your rar archive itself.


LineOf7s(Posted 2005) [#23]
Yep. That's exactly what's happening here too. Seems you broke something. :o)

Nice work up until that point though. Watching this with interest.


BlackSp1der(Posted 2005) [#24]
Papa Lazarou (Posted 2 days ago)
@BlackSp1der that's not good, what specs are you on? ---
Pentium 4(640-64bit) 3.2Ghz - 1GB ram - Win XP SP2 (32bit)

Does it play anything, or does it just not start at all?
--
version test6 few times works and play only seconds
version test12 don't work.


Murilo(Posted 2005) [#25]
Hm... that one doesn't seem to do anything.

Same here! Darn it...


REDi(Posted 2005) [#26]
New version HERE

I think its was down to this...
Graphics(800,480,0,60|HARDSYNC)

DOH! I changed it while testing in fullscreen and forgot to put it back :-( but it still worked on my machine.

I also changed from D3D to GL, but I don't think that would be a problem.

Does it work now?


xlsior(Posted 2005) [#27]
800,480 isn't a supported resolution on most systems. :-?

Anyway, this one works now, and seems to use much less CPU power than the previous version (Even after hitting ESC once and seeing the playing data, the CPU load is a lot less than it was with the previous version the other night)

0-8% (5% typical) without showing info, 5-16% (10% typical) with showing info now.

Given that this is based on DirectSound, I guess the chances of a Linux or Mac version are prett ymuch non-existant?


REDi(Posted 2005) [#28]
800,480 isn't a supported resolution on most systems. :-?

Yeah, I remembered to change that bit when I swaped it back to windowed mode ;-)

seems to use much less CPU power than the previous version

This is only because I put a longer Delay() in the main loop, nothing special.

Given that this is based on DirectSound, I guess the chances of a Linux or Mac version are prett ymuch non-existant?

Well I was going to do it with OpenAL but...
http://www.blitzmax.com/Community/posts.php?topic=49210#547374

Could do it with FMOD, but that would defeat the point really! :D


EOF(Posted 2005) [#29]
Getting better each release. Practically all of the mods seem to play correctly now.

When playing the XXX - FurElise.mod though I here a strange 'beat/click' sound kicking in at POS 12, 24, and 36 where the base sound is playing through tracks 5 and 6. You'll notice in the mod that both play the same note together. Maybe this combination is causing the trouble(?)

The app still quits on me at random places. Anywone else getting this?


Suggestion time:

Can you add PageUP/PageDOWN so I can jump to different song patterns for testing purposes?

keep at it Cliff. This is good stuff.


xlsior(Posted 2005) [#30]

Could do it with FMOD, but that would defeat the point really! :D



a 'problem' with FMOD is that there is is a licensing cost, even for shareware programs that use it.


REDi(Posted 2005) [#31]
I here a strange 'beat/click' sound kicking in at POS 12, 24, and 36

I've tried a few things to sort that out, but looking at the sample waveform in madtracker (zoom in at the begining) I can see why its doing it, I have a couple of ideas that might help tho.

You'll notice in the mod that both play the same note together. Maybe this combination is causing the trouble(?)

You can now click on a channel to mute it, even with just one channel it still clicks :(

Suggestion time:

Done, but the change wont happen until the end of the current sequence ATM (then it will step up one as normal).


EOF(Posted 2005) [#32]
but looking at the sample waveform in madtracker (zoom in at the begining) I can see why its doing it
Your right. The sample starts at a non-zero'd point:


I still get lots of app closing issues. Especially with the 'Leave Me Alone.mod'
No error messages. Just closes down during playback (at random areas).
However, if I pick up and drag the max window (and keep hold of it) the song plays through no problem.
I'm guessing that, since the max window is being held/moved there is no threading/callbacks going on.
Maybe thats where the hiccup is happening?

The others generally play through without a glitch.


REDi(Posted 2005) [#33]
I still get lots of app closing issues.

Well I hope I've sorted that out now jb (crosses fingers), almost a complete rewrite this version ;)

finally found an 8 channel fasttracker mod "dune-dne_wro3.mod"

New version HERE


Sveinung(Posted 2005) [#34]
Some noise when I play the modules (most on TOWARDS IMMORTALITY.mod).

Sveinung


REDi(Posted 2005) [#35]
Hi Sveinung, what does this noise sound like? eg clicks white noise ect?


EOF(Posted 2005) [#36]
Works great now. No app closing. Top banana.

Have you thought about how your commands and functions are going to be implemented?

Two examples:
mymod=LoadTracker(file$)
PlayTracker mymod [,sequence]
StopTracker mymod
PauseTracker mymod
ev=GetTrackerEvent(mymod) ' returns true if $8xx command occured

p=CountSequences(mymod) ' total number of sequences in song
p=SequencePlaying(myod) ' returns pattern number playing
t=TrackerTempo(mymod) ' current tempo
s=TrackerSpeed(mymod) ' current speed

SetTrackerVolume mymod,vol
v=GetTrackerVolume(mymod)

Or ..
mymod:TTracker=LoadTracker(file$)
mymod.Play
t=mymod.Tempo()
ev=mymod.Event()
mymod.Pause

As you can see, there's rooms for lots of commands and functions to add. I personally prefer the second approach.

The most handy functions to have though would be the 'tracker events' and 'which sequence is playing' ones. That way Max could be used to play a module and sync graphics to changes occuring as the song plays.


Haramanai(Posted 2005) [#37]
Here i am with the old machine.(I just haded the bigest trial in my life with format this week)
My machine is 466Mhz Windows Xp (Was 98) 256Ram
It plays almost well the easy stuff like Phantasy for example in the start. But when the song becomes heavy with many instruments and rich samples the seems like it loses the sample rate of the samples.
About the cpu usege plays around
70-94 for Phantasy
66- 91 for mr_death-castles&adventures.mod
The strangest think and more important is that it seems that it brakes in random. What i mean : it played all the Mr death and then breaked in the change of loop 1 to 2. but an other time that i tryed to play it it crashed in 4th loop.

edit:About the CPU usage if i just move a window the usage goes for an instant from 2-4 to 20-30


REDi(Posted 2005) [#38]
Have you thought about how your commands and functions are going to be implemented?

Your second example is how I've been doing it so far

nice idea about using effect 8xx for events, I'll end up using blitz events when we get them :)

As you can see, there's rooms for lots of commands and functions to add.

you'll even be able to check if a perticular sample or channel is playing.


Thanks for trying it Haramanai, seems the spec for this is a bit high :(
more important is that it seems that it brakes in random

oh #&$£ I thought I sorted that out, anyone else had crashes?


Haramanai(Posted 2005) [#39]
Test_15 crash in the start.
Loads the file, turns to fulscreen, shows the mousecursor and then it crashes.


REDi(Posted 2005) [#40]
Strange, works fine here, oh well sleep time.


REDi(Posted 2005) [#41]
Flash New version HERE

Now, wheres the funky oscilloscope already? :)

that funky enough for ya jb? B)


xlsior(Posted 2005) [#42]
Nice!

Just a suggestion: Maybe you should also add an option to load a new module while the program is running? (Or if there is one already, I haven't found it. ;-)


EOF(Posted 2005) [#43]
that funky enough for ya jb? B)
I'll have some of that!
The player is working great now Cliff. No more random app closing.

q1) How many channels are you able to handle now?
q2) How different is the *.xm format?


REDi(Posted 2005) [#44]
Just a suggestion: Maybe you should also add an option to load a new module while the program is running?

Yeah I'm waiting for the GUI module before I worry too much about that sort of thing, I will certainly add it at some point.

q1) How many channels are you able to handle now?

ATM its set to 64 channels max, but I could put it up to 128 (or anything really)

q2) How different is the *.xm format?

I've started on xm format (just reads headers atm) and its not that different really, I'll see how it goes, watch this space ;)


Hotcakes(Posted 2005) [#45]
Wait until you start getting requests for .it format. It's not pleasant. =]


xlsior(Posted 2005) [#46]
Are you intending to wrap this all in a (free) module at some point, or do you have other plans?


REDi(Posted 2005) [#47]
Wait until you start getting requests for .it format. It's not pleasant. =]

I've just twigged how much different xm is to mod :) definitely not looking forward to .it =)

Are you intending to wrap this all in a (free) module

It's already a module :) If all goes well, there will be a free Pre-built player module for BlitzMAX, and a not so free (but very cheap) tracker! But really its just a bit of fun, I wanted to know if it possible to make a "real-time" tracker, most other (all AFAIK) trackers/players pre render the output before playing it, this one uses type methods like Song.PlaySample() ect.

There's now a Song.GetOscScope(Channel,Stereo,OscSize) method that returns a bank, so all you have to do is draw it :)
And you can use it to play sounds in your games as well, with Song.PlaySample(Channel,Sound:TWav)


Hotcakes(Posted 2005) [#48]
I've just twigged how much different xm is to mod :)

Oh, it's not that bad. Certainly workable.

When I played around with .it, I was in the process of trying to create a middle ground internal format so I only needed one replayer. .it is so much different in some ways to the others, I don't think I ever got it working right actually. Got it close though.


REDi(Posted 2005) [#49]
I was in the process of trying to create a middle ground internal format so I only needed one replayer.

I'm debating this ATM, either as you say a middle ground player or a separate player for each format, I'm currently leaning towards the latter.

now reads xm pattern data correctly :) on to instruments.


Hotcakes(Posted 2005) [#50]
With regards to instruments, get them working as normal samples first. Not many modules used the envelope datas. That'll help you feel like you're making some progress! =]

As for the internal format, it depends on how you're tackling the playback - if the mod player module is basically one big module then it might be worth the time to come up with your own internal format. Writing replayers over and over again isn't fun =] Altho I would do that after having a good knowledge of mod, xm and it... But if you're umm... modularising your modules, in a similar way to the sample/picture loader modules, then it's probably better writing a specialised replayer for each one.

If you are keeping each mod format in a seperate max module, my hat goes off to you. I like that stuff =]


EOF(Posted 2005) [#51]
I can't wait to test out the *.xm you are working on. I have a fair old collection of songs in that format.
Here's a fantasic Orchestral/Medievel 16 track *.xm mod you may want to try out:

Kngdmsky.xm

It starts out nice and quiet so you can listen out for any clicks/pops. At the end its really dramatic.

If you manage to get the *.xm format working it'll be music to my ears.
(I know. I know. Someone had to get that pun in!)


REDi(Posted 2005) [#52]
Well its getting there, but file format doc for xm makes the blitzmax docs look great ;)


Hotcakes(Posted 2005) [#53]
Are you using the version from www.wotsit.org? It's a corrected version of the original - the original had many nasty innaccuracies atht required me a lot of debugging ;]


REDi(Posted 2005) [#54]
Thanks Vanilla, that looks much better than the one I was using, I'll give it a go later :)


Arowx(Posted 2005) [#55]
Hi Gents, any updates on XM format player, as I'm just completing my first game a '4 Blocks Falling game' ;o) and I've found some nice free and small XM music that would be ideal if I can get it to play in BlitzMax?

If I have seen further it is by standing on the shoulders of giants. Isaac Newton (1642 - 1727)


REDi(Posted 2005) [#56]
Back from the dead :)

All new version HERE for you guys to test. Now with added GUI-goodness!

If the music starts jumping just stick the priority up a bit (in task manager) but If you do please tell me what setting works best for you.

@Merx - Sorry mate I didn't see your post! I've had a bit of a play with xm (load'em at your own risk :D ) but I think I should complete the mod player before I carry on with that. oh BTW you could use FMOD to play your xm's.


xlsior(Posted 2005) [#57]
Seems to work pretty well so far -- Any chance we see a blitzmax module containing these player routines at some point?


REDi(Posted 2005) [#58]
Yeah, thats the plan, just need to be sure its stable, also not sure if its worth it until I get xm in :)


REDi(Posted 2006) [#59]
MaxMod module for testing...

http://www.armbell.com/forum/index.php?mforum=papa

All feed back is appreciated


REDi(Posted 2006) [#60]
bump!

No response? If there isnt any demand for this sort of thing I'll just keep it all for myself :)


Tiger(Posted 2006) [#61]
Sorry for keep you waiting :)
It work great, I have not test all the functions.
Will give it a try later.

Keep up the good work.


Scott Shaver(Posted 2006) [#62]
I'm definately interested in this once it is stable.


REDi(Posted 2006) [#63]
Thanks for testing it guys :)

Good to know it works for you Tiger.

Scott, does that mean its not stable for you atm? ie is it crashing?


xlsior(Posted 2006) [#64]
The sample thing works great, although without more information it's a bit fuzzy how to extract the extended information from it.

Question: I know that this build around the microsoft DirectSound.. You think it is at all possible/feasible to have a Mac and/or Linux port of this module as well at some point, or does is everything dependend on DirectSound?


EOF(Posted 2006) [#65]
Working great here Papa. Tested the methods on a few songs and no issues to report.

Very easy to use too. You mention there are lots of other methods in there. Any chance of a revealing which commands control the pattern-playing position?
I've hade a play with the method .SetCurrentPattern but I suspect this is not the way to change the songs pattern:
Song.SetCurrentPattern Song.GetCurrentPattern()+1


Thanks Cliff.


REDi(Posted 2006) [#66]

You think it is at all possible/feasible to have a Mac and/or Linux port of this module as well at some point


I know sweet FA about Mac and Linux sound api, but if its at all possible to feed data into sample while its playing, then it could be done. The other consideration is latency, directsound is very low latency, but again I haven't got a clue how Mac and Linux performs.


Any chance of a revealing which commands control the pattern-playing position?


Not long now mate, I should have version 1 up within the next week, with full functionality :)


Sonic(Posted 2006) [#67]
Yes I second the 'please make a Mac version'. I am writing a commercial title and am really unhappy about the prospect of paying 2000 dollars for each platform to use fmod. This is exactly what I need, but I can't afford to be PC only. I'll pay for it!


xlsior(Posted 2006) [#68]
Sonic: worst case you can always use a mod player for the PC, and convert the music to .ogg for the Mac... Downside of course would be that it takes up considerable more diskspace to store the music that way.


Scott Shaver(Posted 2006) [#69]

Scott, does that mean its not stable for you atm? ie is it crashing?



Really this just means I need a working version for at least Windows and Mac.


REDi(Posted 2006) [#70]
Well, I don't have access to a Mac, and no spare cash to get one, but if any Mac users want to have a go... ;)

The first problem would be threads, I don't think anyone has done a working threads module for the Mac yet :( (does Mac even use threads?)
Then we'll need a wrapper for the sound API, once that's done it would be very easy to integrate into what I've already got.

Anyone up for the challenge?

I've made some big improvements over the last couple of days, sounds a lot better now :)
I'll post version 1 soon.


REDi(Posted 2006) [#71]
Okay guys version 1 is up :)


Aymes(Posted 2006) [#72]
Woot! This is looking really good so far!

Ive always wanted to write my own tracker so I'll have a go with this at some point. Otherwise its gonna be great for including IT modules into my games! (once IT support is included of course, I can always live with XM)

I dont think a lot of the blitz community knows what this could do for their projects (or maybe they do?) in terms of filesize and also because Mod/IT/XM files have always had a certain unique "feel" to them.

Cant wait for IT support :D :D

Also, if there's anything I could do to help...?


Hotcakes(Posted 2006) [#73]
I would have attempted something like this a good 12 months ago, but without threading it seems a bit pointless and with threading (as it stands) it's too dangerous =]


REDi(Posted 2006) [#74]
Well I'm waiting for someone to complain about stability, but so far so good :)

It doesn't really use any blitzmax functions in the player, and any memory manipulation is done within a mutex lock (getters/setters), and DirectSound AFAIK is thread safe.

But yeah, some blitzmax commands are certainly not thread safe, the trick is not to use them in the thread :)


Chris C(Posted 2006) [#75]
Why not just use a timer, you don't really need a thread do you?


Aymes(Posted 2006) [#76]
Hey Mr lazarou, Had any more progress on this recently? I for one am really excited about this :)


REDi(Posted 2006) [#77]
Hi Aymes, just click the link in my sig for latest version.


xlsior(Posted 2006) [#78]
Will you release an updated copy of the module for Blitzmax 1.18?


REDi(Posted 2006) [#79]
Been so busy lately, I was putting it off, but here you go
ALL NEW MAXMOD


xlsior(Posted 2006) [#80]
Much appreciated!