Yet another maxmod thread

BlitzMax Forums/BlitzMax Programming/Yet another maxmod thread

REDi(Posted 2009) [#1]
Well I've finally put up MaxMod2 on the google code page (link in sig), I've decided not to put all the modules up at once to make it a bit easier to deal with any problems as they crop up, so ATM you only get...

MaxMod2.MaxMod2 - Main core of maxmod
MaxMod2.RtAudio - AudioDriver and AudioStreamDriver
MaxMod2.Ogg - Ogg vorbis support
MaxMod2.Flac - Free lossless audio codec support
MaxMod2.ModPlayer - Mod and (WIP)XM support
MaxMod2.Wav - Standard PCM waveform support

When the bug reports slow down a bit I'll release some more, like...

MaxMod2ex.ModPlayerEx
MaxMod2ex.MP3
MaxMod2ex.GME
MaxMod2ex.FFT
MaxMod2ex.SoundTouch
MaxMod2ex.bsplay
MaxMod2ex.SidPlay2
MaxMod2ex.ID3tag

anyway, enjoy ;)

BTW, its source only so you'll need to build modules yourself.


GfK(Posted 2009) [#2]
Ooo.... :)

I'll snag that! Was wondering last night when this was going to appear!


Matthew Smith(Posted 2009) [#3]
Redi,

Great - thanks! Was going to contact you eventually in regards to updating the SidPlay module - excellent


xlsior(Posted 2009) [#4]
Nice!

Seems to work pretty well, although I did run into something odd: when going through a bunch of .mod's and .xm's using the sample player thing, it popped up an error after loading one of the songs:

"Activemovie Window: Miniplayer.exe - Unable to locate component

This application has failed to start because ad2h64dec.dll was not found. Re-installing the application may fix this problem."

Despite the error, the song *did* start playing, just like the others. Other than the single popup, I haven't noticed anyhing weird.

(This is using Vista 64-bit)


REDi(Posted 2009) [#5]
Hi xlsior

That's very odd, I've got no idea what ad2h64dec.dll is and certainly none of my modules require it (unless its something to do with directsound maybe), does it happen every time you load that (tracker) module?

Wonder why ActiveMovie is getting involved anyway, isn't that to do with DirectShow or something? weird.


xlsior(Posted 2009) [#6]
No idea... I've never seen that popup before, and never heard of activemovie either.

Anyway, I just tried again:

It's very random.
- I have a folder with .mod and .xm files.
- going down the list, opening and playing part of each, just now it gave me the error at song #7.
- Closed miniplayer, and started it again.
- Open song #7, no problem.
- played a bunch more, and then it errored out at song #9.
- Closed miniplayer, started it again.
- Error at song #1, which had played succesfully several times before.

Very weird...


REDi(Posted 2009) [#7]
Dodgy :(

Does it only happen with mod/xm files?


REDi(Posted 2009) [#8]
xlsior, if you get time could you try this bit of code for me to see if the error occurs, I'm just wondering if it could be the vista file requester trying to create a preview or get some info from a file, thinking that the .mod files are movies.

(just point the dir requester to your folder and press space bar to go through the tracks)

Thanks, I don't have vista 64 installed ATM (gotta get another HDD) so can't try it myself I'm afraid :(


xlsior(Posted 2009) [#9]
Ok -- that one seems to work OK when cycling through the folder that was randomly giving me problems earlier, the earlier error didn't pop up this tome.

However, I did run into another problem: one of my modules which plays just fine in ModPlug, consistently crashes maxmod2, both using the miniplayer and the code you posted above. all I see is this:


Executing:MiniPlayer.debug.exe
-breakbeforechapter
MaxMod2: MOD Loader...
MaxMod2: MOD Accepted!
MaxMod2: ID= M.K.
MaxMod2: Channels=4
MaxMod2: Title= beyond music
MaxMod2: Instrument Count=31
MaxMod2: Calculating size ...



...and it immediately pops up an 'application stopped working' dialog, and it terminates.

If you want I can send you a copy of the module...

I also have another one that sounds completely garbled, but that plays OK in ModPlug.


REDi(Posted 2009) [#10]
Ok -- that one seems to work OK

TFFT :)

Yeah if you can send me the tracks that would be great!

I also have another one that sounds completely garbled, but that plays OK in ModPlug.

Its probably an ancient 15 instrument module, you don't see many of them nowadays, would like to get it implemented though.


xlsior(Posted 2009) [#11]
Yeah if you can send me the tracks that would be great!


OK, sent to the address in your profile.

Its probably an ancient 15 instrument module, you don't see many of them nowadays, would like to get it implemented though.


Quite possible -- this is what ModPlug has to say about the garbled one:

4 Channels Protracker Module
14 samples
23 patterns, 17 are different, 16 unused
Speed: 6 Tempo: 125, GlobalVolume 256
Uncompressed Size: 111KB

And this is the one that crashes MaxMod2:

4 Channels ProTracker Module
24 samples
36 patterns, 36 are different
Speed: 6 Tempo: 125, GlobalVolume 256
Uncompressed size: 390KB


REDi(Posted 2009) [#12]
Cool, thanks xlsior, looking into it.

Just tried the garbled one with renoise and that can't play it either :)
VLC plays it ok though.

*EDIT* I've got the one that was crashing sorted now, I'll have a look at the other one tomorrow.


xlsior(Posted 2009) [#13]
Cool.


REDi(Posted 2009) [#14]
OK, new version up with changes to the mod player module.

Thanks xlsior, those two songs actually helped me sort out quite a few mistakes in the code, I also found one to do with the way looping samples were performed which has made quite a difference to some songs.


xlsior(Posted 2009) [#15]
It looks like the latest version does indeed fix those two particular modules.

I tried opening up my entire mod collection (107 modules), and came across three other ones that had problems -- one sounded garbled, two others crashed the app. I mailed these to you as well, in case you want to take another peek at them.

On the bright side, the other 104 modules seemingly played OK (although I didn't listen to them all the way through)


REDi(Posted 2009) [#16]
Thanks mate, I'll check them out.


REDi(Posted 2009) [#17]
Update 1.02 is available, with fixes to the mod player and wav modules.

Thanks again xlsior, those mods were a big help, I've got ~3000 mods and didn't come across any with them problems (though I doubt I've tried them all)

Suppose I should start having a good go at debugging xm soon. yay :/


xlsior(Posted 2009) [#18]
OK, tried them again: while debris.mod sounds better now, it's still not right: the smooth tone that plays in the first three seconds or so of the module should end up much higher pitched than when I play it back with MaxMod... It sounds like it's only about making it half-way up the scale that it should do. It's not the pitch of the song itself though, it still sounds wrong if I increase that.

The rest of the instruments appear to sound OK, but that smooth transition one ends up sounding really flat / muffled, lacking the dynamic range that it should.

No idea what the instrument itself is actually called, though. :-?

The other two that used to crash the player are now indeed fixed -- thanks!


REDi(Posted 2009) [#19]
Yeah, I've noticed this on a few songs, not entirely sure what's wrong there though, ATM the player assumes a value of $FF should slide one whole octave per tick, if I double that then debris.mod sounds much better, but then some other tracks start sounding wrong.

I'll have a play around with it some more tonight.


REDi(Posted 2009) [#20]
Update 1.03 is up, more fixes to the mod player.

Changes to the portamento effects for protracker files, hopefully fixes debris.mod and others (ie command $108 @ $F01 now slides up 1 half note)


REDi(Posted 2009) [#21]
OOPS, I forgot something :/ 1.04's up now.

My apologies to the one person who downloaded 1.03 :)


xlsior(Posted 2009) [#22]
Yup, debris.mod now sounds as expected.
Great job, btw!

Oh, just wondering: Since you're generating an audio stream out of the module, do you have the capability to convert and save the entire module as a wave file programmatically?

I just noticed that modplug that that ability (spool out an entire mod to wav in a few seconds), which can be really useful in order to be able to convert & burn modules to music CD's.


REDi(Posted 2009) [#23]
You can use the LoadMusic command to load the whole thing into a TAudioSample and then save it to file from there, either as wav or IIRC skidracer has a module somewhere that can save to ogg.

I could do a "stream straight to file" command if you like


xlsior(Posted 2009) [#24]
I could do a "stream straight to file" command if you like


Well, I can definitely picture some uses for that...
Might as well, since it sounds easy to implement?


GfK(Posted 2009) [#25]
Haven't looked at the latest versions, but is it possible to load an OGG into memory (without it taking up 50mb or whatever), and stream it from there instead of from HD?


REDi(Posted 2009) [#26]
Well, I can definitely picture some uses for that...

OK, I'll add it to my to do list.

is it possible to load an OGG into memory (without it taking up 50mb or whatever), and stream it from there instead of from HD?

Well incbin works (also from memory), so I suppose I could add a way to stream from a TBank or something.

That's another one for my to do list, should be pretty straight forward, I'll have a go tonight.


REDi(Posted 2009) [#27]
V1.05 available, Streaming from a bank took about 5 minutes to implement :)

SuperStrict
Import MaxMod2.RtAudio
Import MaxMod2.Ogg
Import MaxMod2.ModPlayer

SetAudioStreamDriver("MaxMod RtAudio")

Local Bank:TBank = LoadBank(RequestFile("",MusicExtensions()))
If Not Bank RuntimeError "Bank not loaded"

Local Channel:TChannel = PlayMusic(Bank)

Repeat
	Delay 10
	PollSystem()
Until ChannelPlaying(Channel)=False


*EDIT* It doesn't keep a reference to the bank ATM, so don't let it go out of scope! I'll change this for the next update.


GfK(Posted 2009) [#28]
Thanks. Awesome job!


GfK(Posted 2009) [#29]
Just got around to trying the 'streaming from a bank' thing. It generally works brilliantly - doesn't even get stuck when changing graphics resolutions.

There is however, a small glitch when music loops back to the start - almost as if it jumps back to the start a fraction of a second too early. I'm using OGG files and it does it on every single one I've tried (about 15). It doesn't do this when streaming from HD.


SLotman(Posted 2009) [#30]
Does anyone successfully compiled Maxmod2 for Linux? I tried, but after giving some errors with Sleep/memset/memcpy not declared (which I fixed) it just throws a *lot* of errors, which I have no clue how to solve...


Imphenzia(Posted 2009) [#31]
I get Compile Error message:

"Can't find interface for module 'maxmod2.rtaudio'"

I've uncompressed maxmod2 into my BlitzMax\mod folder and rebuilt documentation. Others have reported this error in the forum for other modules, but I don't have Threading enabled in the compliler and the maxmod2.mod folder is in the correct path where for example the MaxGUI mod works.

What am I missing?

Edit1: Ah... Finally noticed it was just a bunch of source code and then the notice in this post: "BTW, its source only so you'll need to build modules yourself. "... Let's see if I have any clue how to fix it. How come it's source only by the way?? =)

Edit2: Update. I've figured out I need MinGW now so BlitzMax can compile the modules on the fly. Not there yet though because first of all MinGW.org has hidden the downloadable so only Linuxpeople can understand how it works, and once I finally got the installer running it says I've got a corrupt Tarball and crashes :) Piece of cake.

Edit3: Update. I tried the installer and the guide (http://ziggybcn.proboards.com/index.cgi?board=publisher&action=display&thread=134) about 4 times, then I ended up editing the file mingw.ini and replaced the mirror. I also copied the install files to c:\test incase it was something to do with the path and finally WinGW installed without the corrupt Tarball issue. Very odd and completely user unfriendly.

Edit4: Update. I rebuilt all my modules (twice) and now MaxGUI also stopped working. I get "Can't find interface for module 'maxgui.drivers'". This is also the case when I try to run the examples that came with MaxGUI.

Edit5: Final update. The last maxgui issue was caused by me - the maxgui.mod folder was accidentally dragged into maxmod2.mod when I was troubleshooting. It works now.

I'm not trying to spam or release frustration by the way (maybe a little :) - but I just wanted to write down the path for Bmax newbies like myself that may have similar issues.


REDi(Posted 2009) [#32]
Hi guys, apologies for the delay, just got back from an extended holiday (more business then pleasure :( )

@GfK, OK mate I'll have a look when I get over my jet lag.

@SLotman, Haven't tried it on Linux for quite a while now, since my Linux HDD gave up the ghost, I'll have to pick up a new one and figure out what I've done to mess it up.

@Imphenzia, Yeah setting up MinGW can be a bit of a pain, I think there is a handy little util somewhere that does most of the work for you.

*EDIT* http://www.blitzbasic.com/Community/posts.php?topic=79814

I decided to distribute source only because it saves non win users downloading useless files they wont need. Also when we had syncmods MinGW was a must have, not so much now though. I suppose I should have a binary download available as well really.


GfK(Posted 2009) [#33]
Did you get chance to look at the looping glitch issue?

I've tried it on my laptop today; 32-bit Intel system, 32-bit OS; everything seems to be working fine.

The problem system is a 64-bit AMD system, 32-bit OS. Could there be an issue here with 64-bit hardware?


REDi(Posted 2009) [#34]
I wasn't able to replicate the problem on both my desktop and laptop so didn't really know where to start. My desktop has an Intel 64bit processor with 32 and 64bit versions of XP, both seem to be looping okay. My laptop has 64bit Vista and also works.

Guess I'll have to ask a few of my mates and see if I can't borrow a AMD 64bit machine to test it with.

Can I ask what the problem OS was?


GfK(Posted 2009) [#35]
I'm using Vista on both PCs. Just seems a bit odd how it worked fine streaming from HD, but not from RAM. If there was going to be a problem I'd expect it to be with HD access. :/

I don't have my source code to hand - its on my other PC. Any chance you could knock up a simple example of streaming from a bank - just so I'm absolutely certain I've done it right?


beanage(Posted 2009) [#36]
Looking forward to the mp3 mod


REDi(Posted 2009) [#37]
Any chance you could knock up a simple example of streaming from a bank

See post #27 mate

Looking forward to the mp3 mod

I can send it to you if you only want it for windows (still need to build the libmad for other platforms so cant release it yet)


GfK(Posted 2009) [#38]
I've found the problem.

All of the OGGs I'm using are variable bitrate, which causes the jump at the end. If I save it as constant bitrate, it doesn't jump.

To put this into perspective though, a constant bitrate OGG file is 521k. Its VBR equivalent with no noticable quality difference save for the jump when it loops, is only 95k - less than 20% of the original filesize.

Do you think this is fixable?


REDi(Posted 2009) [#39]
Hmm, thanks mate I'll investigate.


GfK(Posted 2009) [#40]
Don't know if this helps but I've been doing some coding today and I'm beginning to think the problem is at the start of VBR-OGG files rather than at the end?