Mp3 playback in the fewest steps?

BlitzMax Forums/BlitzMax Programming/Mp3 playback in the fewest steps?

Dubious Drewski(Posted 2009) [#1]
I need to create a program for other photographers in my community that lets
them play mp3s in the background while displaying their images. This is not for profit.

I've searched and searched these forums and have come across some monstrous
threads with multiple explanations, but nothing is really clear.

What is the easiest, most painless way to have mp3 playback in your
program?
Do I really need to download mods and install MinGW and change
my computer's path variables and all that hassle?

Can't Blitz just let me play mp3s?


ImaginaryHuman(Posted 2009) [#2]
No, mp3 has patents attached to it and so is not `free` as such, so Max supports .ogg instead. And wav. But not mp3. you could perhaps make an mp3 loader/player, though, or use some module/library.

Or you could find a free mp3 player program and send it commands or launch it from blitz?


Dubious Drewski(Posted 2009) [#3]
Hmm. My issue is this: I'm making this program for other people to use. It
allows you to sequence your photographs and display them in a certain order
while music plays in the background.

Ideally, I would like the finished product to be a single exe that takes
images and sounds that are sitting in its same folder and uses them in the
show. So if I give this program to someone who is not a programmer and is
not really computer savvy, how do I explain to them that they need to
convert their mp3 files to ogg files? They won't know what I'm going on
about and they'll just go and use a different program that can play
mp3s, like Pro Show.


GfK(Posted 2009) [#4]
MaxMod lets you play MP3s. Do a forum search.


plash(Posted 2009) [#5]
So does BASS, FMod and IrrKlang.


Dubious Drewski(Posted 2009) [#6]
Yeah, I'm trying to get maxmod to run as we speak. When I try to build the modules, all I get is this:

"Can't find interface for module brl.Openalaudio"

I unzipped the maxmod.mod folder into my Blitzmax\mod folder. Is this right?
I now also have MinGW installed and set up properly.


GfK(Posted 2009) [#7]
Oh yeah, you need OpenAL too. You can install OpenAL, grab the two DLLs (which it installs to the Windows/system32 folder) and put them in your blitz program folder, then uninstall OpenAL.

http://connect.creativelabs.com/openal/Downloads/oalinst.zip

So does BASS, FMod and IrrKlang.
...and none of them are free.


plash(Posted 2009) [#8]
...and none of them are free.
They are if your not selling your program.


Dubious Drewski(Posted 2009) [#9]
Ok, I installed openal, found the two dlls and put them in my Blitzmax\ folder ...
is that right? It still gives me the error when I try to build modules.


Brucey(Posted 2009) [#10]
It still gives me the error.

Not surprising, since those DLLs won't solve that particular problem. :-)

You need to have the latest BlitzMax installed. What version are you running?
I thought the OpenAL stuff was only in 1.30.

Did you build those specific modules, or just do "Build Modules" from the IDE?


Dubious Drewski(Posted 2009) [#11]
I haven't used Blitz in a while, so in the IDE, I went to check under
Help/About Blitzmax, but it just says "About" and doesn't give me any
version info. Argh. So I don't know what version I'm using, but I'll go
download blitz again to be sure.


Brucey(Posted 2009) [#12]
And remember, if you intend building any modules, we assume you have installed and set up MinGW? :-)


GfK(Posted 2009) [#13]
You need to have the latest BlitzMax installed. What version are you running?
I thought the OpenAL stuff was only in 1.30.
I used OpenAL for Buzzword and that was nearly two years ago so I reckon 1.26 at least had OpenAL support.

I haven't used Blitz in a while, so in the IDE, I went to check under
Help/About Blitzmax, but it just says "About" and doesn't give me any
version info. Argh. So I don't know what version I'm using, but I'll go
download blitz again to be sure.
Sounds like you're using version 1.18 and some updates since the Help/about box was broken in that version.

Install 1.30, do what I said above, and it'll work. :)


Dubious Drewski(Posted 2009) [#14]
Yup, I've got MinGW all set up. And I installed Blitz 1.3. Alright, we've
made progress. Thank you very much guys. But we're not quite there yet.

I'm trying to get the sample maxmod code to work, but it only seems to work
on 1 out of every 3 mp3 files. It gives me unhandled memory exception
errors on all other mp3s. Is there a required bitrate? And I guess they
can't be variable bitrate mp3s, huh.


GfK(Posted 2009) [#15]
Not sure on that as I've always used OGG format myself, but variable bitrate OGGs work just fine.

Are you setting the audio driver to "openAL" or "Directsound"?


Dubious Drewski(Posted 2009) [#16]
Ok, so 128kbps, 160 and 192 work alright, but an mp3 at 224 gives me an
unhandled exception error. Well this is awesome that it's mostly working,
but there's going to be 1 out of 10 people that's going to try to use their
song and the bitrate will be too high and they'll come to me saying "Your
program doesn't work!"


GfK(Posted 2009) [#17]
Oh, sorry. Wasn't aware of that bug/limitation. I think REDi (the MaxMod guy) will have to take over from here... :/

Alternatively, try using MaxMod 1.27 in the meantime. Its a slightly different beast to MaxMod 2 Beta 4.


Dubious Drewski(Posted 2009) [#18]
Oh, and using OpenAL versus Directsound didn't seem to make any difference. I would like cross-platform usability, so should I stick with openAl?


GfK(Posted 2009) [#19]
Well, nothing to stop you using DirectSound on Windows and OpenAL on Mac. Although the DirectSound/Vista combo can be a bit crackly on some hardware setups by all accounts so might be better to stick to OpenAL.


xlsior(Posted 2009) [#20]
The problem: Even if your program is free, you are still liable for royalties to the MP3 licensing board... it's the distribution that they want to get payed for, regardless of whether or not you charged anything for your work.


Dubious Drewski(Posted 2009) [#21]
Well alright then. I accept that risk. If my program somehow SOMEHOW gets
popular enough to draw their attention and they ask for royalties, I will
have become well known enough through the whole ordeal for the cost to have
been worth the risk.

But All I plan on doing is distributing this to a handful of friends in my
local photography club who don't want to pay the $130 for ProShow Gold.


REDi(Posted 2009) [#22]
Hi

I take it your using the original maxmod? as maxmod2 doesnt have openal support.

MaxMod(1) has a couple of known issues with the ACM MP3 decoder stuff, I would suggest trying the maxmod2 beta if possible, the MP3 support is far superior. ;)

Or even go the BASS/FMOD/whatever route, if your not selling your project it doesnt really matter.

as for the MP3 licensing stuff, if your writing an application it costs $0.75 USD per unit sold, and for games it costs a one off payment of $2500 USD (per title), but you don't have to pay anything until you shift 5000 units ($0.50 USD per unit), so IMHO its not that bad really.


Dubious Drewski(Posted 2009) [#23]
Ah, in version 2, mp3 playback is seekable? As in, I can play from any point
in the mp3 file? That's what I'm looking for.

Alright, I put the maxmod2.mod folder in the blitzmax\mod folder and deleted
the old maxmod.mod. But now in the IDE, "Build Modules" is grayed out. What
could be doing that, I wonder?

The IDE always does this and I never understand why. It's really
frustrating. Just build the modules, please Mr IDE!

My system path has this on the end: ;D:\MinGW\bin\ and that's the proper spot.
What else does it need?


REDi(Posted 2009) [#24]
Now when you say "the mp3 support is far superior", do you mean that I will
be able to find out the length of the MP3s, or maybe have the ability to
play from a random point in the mp3?


Yes and yes ;)


But I wouldn't bother just yet if your happy with maxmod1, I'll be releasing another maxmod2 beta soon with some major changes over the current beta.


GaryV(Posted 2009) [#25]
and for games it costs a one off payment of $2500 USD (per title), but you don't have to pay anything until you shift 5000 units ($0.50 USD per unit), so IMHO its not that bad really.
That applies even if the games are freeware. And the 5,000 is by distribution, not sales. Even a crappy game can get 5,000 downloads in a day or two if it gets a mention or review on a popular gaming blog.


xlsior(Posted 2009) [#26]
That applies even if the games are freeware. And the 5,000 is by distribution, not sales. Even a crappy game can get 5,000 downloads in a day or two if it gets a mention or review on a popular gaming blog.


And keep in mind: If you have a 30-minute demo of your game, and the game is pretty decent and gets a (not unusual) ~1% conversion rate (1% of the people who try your game end up buying it) it means that by the time you've 'distributed' your 5,000 copies and would be required to pay the $2500 licence, you've only really sold 50 of them.
Unless you have more than $50 profit on each game sold, you're on the hook for more money than you made at that point.


SebHoll(Posted 2009) [#27]
My system path has this on the end: ;D:\MinGW\bin\ and that's the proper spot.
What else does it need?

You also need to create a new system environment variable named MINGW, which points to your root MinGW folder, e.g. D:\MinGW.


REDi(Posted 2009) [#28]

That applies even if the games are freeware. And the 5,000 is by distribution, not sales. Even a crappy game can get 5,000 downloads in a day or two if it gets a mention or review on a popular gaming blog



Apparently its free avoidable for open source and/or free software... http://en.wikipedia.org/wiki/MP3

Which i suppose explains why lame hasnt been shut down.


GaryV(Posted 2009) [#29]
Apparently its free for open source and/or free software...
You are confusing software and games. The MP3 licensing info is VERY explicit on the differences between licensing for software and for games:

http://www.mp3licensing.com/royalty/games.html

For games, cost of the game is not an issue and it goes strictly by distributed copies not sales.


REDi(Posted 2009) [#30]
Yes there is different licenses for applications and games (and no I'm not confused as to what software is ;), but the point is they don't actually chase free/open source projects for licenses, whatever type of software you are writing (even if its a third party mp3 decoder) as long as you dont profit from it.

do a google search for free mp3 software, do you really think they all pay a license fee and give us the software for nothing?

The MP3 licensing info is VERY explicit

I wouldn't say that.

*EDIT*
let me reiterate that... open source software should have a license, but if you don't you wont be chased.


GaryV(Posted 2009) [#31]
the point is they don't actually chase free/open source projects for licenses,
Actually, Thomson is famous for doing just that.

However, the previous reply was only because you quoted me and took it out of context when I was clearly discussing games only ;)


REDi(Posted 2009) [#32]
This thread has taught us the consequences of large amounts of alcohol on the brain, hik. ;)


SLotman(Posted 2009) [#33]
What about using MCI? (if your program is Win only, of course)

You probably won't have to pay anything (you're not implementing MP3 deconding on your program, just using the codecs/SDK already available on Windows). But don't take my word for it, I'm just guessing here :)