MP3 playback

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
User avatar
Newbie
Insane DCEmu
Insane DCEmu
Posts: 171
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sat Jul 27, 2013 1:16 pm
Has thanked: 0
Been thanked: 0

MP3 playback

Post by Newbie »

Hi everybody,

I want to test MP3 playback using KOS on Dreamcast.
I found in KOS Ports two libraries :

libMP3 and XingMP3, what is the best to use ? are there others libs for that ?

Thanks
Attachments
MP3.jpg
MP3.jpg (3.85 KiB) Viewed 1046 times
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5658
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: MP3 playback

Post by BlueCrab »

libmp3 contains the KOS interface to XingMP3. Linking with libmp3 will also link in the XingMP3 code.

Just as a reminder, as the documentation to KOS states, XingMP3 is GPLed. You must release source code to anything you make with it (and it must be licensed under a GPL-compatible license).

As for other libraries, I know that libmad was ported for use in a MP3 player program back in the day (I think it was called "To Eleven"), but I dunno if the code is around for that port any more or not.

One other point to make with MP3 is that legally, you cannot use a MP3 decoding library without a proper patent license, at least in the US (and until at least September 2015, and possibly as late as 2017). Are the patent holders likely to come after you for it? Not really, but legally speaking this is the case.

If you're looking to do background music, I'd suggest using Ogg Vorbis (and either libtremor of liboggvorbisplay, which are also in kos-ports), as Vorbis files tend to have similar or better sound quality at the same or lower bitrates as MP3, and there's not any weird patent or license issues to worry about (the Vorbis libraries are licensed under a BSD-like license, as KOS is).
User avatar
Newbie
Insane DCEmu
Insane DCEmu
Posts: 171
Joined: Sat Jul 27, 2013 1:16 pm
Has thanked: 0
Been thanked: 0

Re: MP3 playback

Post by Newbie »

For the legal side :
thanks, i do not think about that issue even if i do not imagine black suits guys coming after me.

For the technical side :
is Ogg Vorbis replay routine as much quick as MP3 replay routine ?
I need something that do not kill 80% of CPU time you know :)

I found a "liboggvorbis" folder in KOS PORTS.
But there are two sub folders "liboggvorbis" and "liboggvorbisplay".
Which one is the correct lib ?
Is there a sample to show how to use it ? I think there is only the libs.
Attachments
OGG.jpg
OGG.jpg (10.19 KiB) Viewed 1039 times
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5658
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: MP3 playback

Post by BlueCrab »

I don't think Vorbis decoding will be any worse than MP3 decoding, CPU wise.

There are two examples of using the Vorbis libraries in the KOS examples tree (which will also show you how to link with them and such). Look in examples/dreamcast/sound at the hello-ogg and ghettoplay-vorbis examples.
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 191
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: MP3 playback

Post by SWAT »

Also you can use mine ports of mpg123 and oggvorbis, it's contains more fresh libraries than in KOS:

https://github.com/DC-SWAT/DreamShell/t ... mp3/mpg123
https://github.com/DC-SWAT/DreamShell/t ... boggvorbis

XingMP3 is not very good library, because it's can't play some MP3's.

Examples you can see in module.c code of both modules, it's very simple to use and compliant to KOS interface.
Image
User avatar
Newbie
Insane DCEmu
Insane DCEmu
Posts: 171
Joined: Sat Jul 27, 2013 1:16 pm
Has thanked: 0
Been thanked: 0

Re: MP3 playback

Post by Newbie »

Thanks a lot i have downloaded it.
I will test it with pleasure.
User avatar
Newbie
Insane DCEmu
Insane DCEmu
Posts: 171
Joined: Sat Jul 27, 2013 1:16 pm
Has thanked: 0
Been thanked: 0

Re: MP3 playback

Post by Newbie »

Well like i said earlier, i followed the link you provided.

I have downloaded the complete source code of DreamShell.

I have found a directory called "mpg123" in the path "DreamShell/modules/mp3/libmp3/".

Now i just want to include the replay routines of this directory to my main code (and not using the makefile in the directory to compile a static library).

So i have a simple question : which file must i include ?

An another question is about the example called "module.c" in "DreamShell/modules/mp3/".

It seems to load libraries at demand and working with all DreamShell architecture.

I just want an example playing a mp3 using mpg123 source code.

Could you tell me where i can find it ?

Thanks a lot.
User avatar
SWAT
Insane DCEmu
Insane DCEmu
Posts: 191
Joined: Sat Jan 31, 2004 2:34 pm
Location: Russia/Novosibirsk
Has thanked: 1 time
Been thanked: 0
Contact:

Re: MP3 playback

Post by SWAT »

:?
Include https://github.com/DC-SWAT/DreamShell/b ... udio/mp3.h
Call sndmp3_start(const char * fname, int loop); and this all. It's incredibly simple.
Image
User avatar
Newbie
Insane DCEmu
Insane DCEmu
Posts: 171
Joined: Sat Jul 27, 2013 1:16 pm
Has thanked: 0
Been thanked: 0

Re: MP3 playback

Post by Newbie »

Very simple thank you !
Post Reply