🔒 Locked
[java] music for game
Advertisement
Original Post
MP3s or MIDI are good choices for Music. Check out the Java Media Framework for more libraries to play such files (esp Mp3, standard VMs should be able to play MIDI).
A full MIDI song normally is less than 50KB. But the only drawback is you''ll need a good soundcard, otherwise you''ll hear cartoonish music.
A full MIDI song normally is less than 50KB. But the only drawback is you''ll need a good soundcard, otherwise you''ll hear cartoonish music.
I''m probably missing something here, but can''t you double buffer your audio, you load in one buffer (about 50k per buffer) and play from the other. Then when you''ve finished playing you swap buffers and play from the one you''ve just loaded and load in to the one you were previously playing? Not sure how easy this is to do in Java, I''d imagine there''s an object that handles thsi sort of thing?
Need coffee brain not working fully.....
Need coffee brain not working fully.....
i''m not really into java, but does java not have any capability to stream audio files? just asking...
nomad | nomad forum
nomad | nomad forum
I use the .au files for my in game music. Personally I tihnk you are right the media, for a dial up connection, gets outrageously large especially for background music. What I usually to is make a sample that is small enough to be downloaded properly and loops well... Then just loop your BGM. This does tend to make the BGM repetive and if you do it like this you SHOULD give the player the option to tunr the music off.
Conversely depending on the type of game you have this could be a good thing too. If you have several samples that loop well and aren''t too annoying you could make them play in a sequence or even set them up to play when something happens in game,this could help set the atmosphere of the game.
Good luck!

Conversely depending on the type of game you have this could be a good thing too. If you have several samples that loop well and aren''t too annoying you could make them play in a sequence or even set them up to play when something happens in game,this could help set the atmosphere of the game.
Good luck!

I would go for SI_78''s suggestion.. and the best with that is the greater challenge trying to write it..
ogg-vorbis is better to use than mp3.. I would go for that.. More about ogg vorbis can be found here
ogg-vorbis is better to use than mp3.. I would go for that.. More about ogg vorbis can be found here
yup midi is the best, but i want more than midi music
i want really music...
so java can play mp3, humm but how to use it?
i just want to use standard j2se for my game
do not want any other plug-in
(coz it''ll be too complicated for player,
if they have to install jre and also jmf to play my game)
is there any other way to play .mp3 without jmf (Java Media Framework)
or how to play .ogg in java??? in code plzz
thanxxx
i want really music...
so java can play mp3, humm but how to use it?
i just want to use standard j2se for my game
do not want any other plug-in
(coz it''ll be too complicated for player,
if they have to install jre and also jmf to play my game)
is there any other way to play .mp3 without jmf (Java Media Framework)
or how to play .ogg in java??? in code plzz
thanxxx
Found this examples using the all mighty Google-god
http://www.ddj.com/documents/s=1679/ddj0302d/
http://www.jcraft.com/jorbis/
If this isn''t enough - write your own player in C/C++ with some help of the FMod libs and JNI
#define Email Lex & Yacc Function Pointers Virtual Terrain Knowledge Base Real Programmers
"Evolution is NOT a mistake"
http://www.ddj.com/documents/s=1679/ddj0302d/
http://www.jcraft.com/jorbis/
If this isn''t enough - write your own player in C/C++ with some help of the FMod libs and JNI
#define Email Lex & Yacc Function Pointers Virtual Terrain Knowledge Base Real Programmers
"Evolution is NOT a mistake"
thanxx, but i have used javazoom javalayer 
it supports .mp3 and only takes 10 megs memory usage to play one full .mp3 song
(compare to half cut .au that i played before that takes 30 megs, it''s marvelous)
but i''ll take a look at that site
maybe i can use .ogg instead .mp3
umm why .ogg is better to use than mp3 Rickmeister??
and where to find and create that .ogg files?
it supports .mp3 and only takes 10 megs memory usage to play one full .mp3 song
(compare to half cut .au that i played before that takes 30 megs, it''s marvelous)
but i''ll take a look at that site
maybe i can use .ogg instead .mp3
umm why .ogg is better to use than mp3 Rickmeister??
and where to find and create that .ogg files?
quote:
Posted by role
umm why .ogg is better to use than mp3 Rickmeister??
and where to find and create that .ogg files?
It's not "better" in that way.. But it's open source..
All you want to know about it is on display at www.vorbis.org
#define Email Lex & Yacc Function Pointers Virtual Terrain Knowledge Base Real Programmers
"Evolution is NOT a mistake"
[edited by - Rickmeister on February 24, 2003 6:17:50 AM]
Well, Ogg Vorbis keeps claiming their encoding is better than MP3 in actual sound quality. You should probably compare both yourself and see.
Also, MP3 does have a patent on it. Yes, you can't sell MP3's without paying some guy whose name starts with an 'F'. You can do whatever you want with OGG files, AFAIK.
EDIT: BTW, MP3 has been DROPPED from the Java Media Framework. I found that to be a nice incentive to look up information on Ogg Vorbis.
This isn't life in the fast lane, it's life in the oncoming traffic.
-- Terry Pratchett
[edited by - Kentaro on March 1, 2003 9:33:53 PM]
Also, MP3 does have a patent on it. Yes, you can't sell MP3's without paying some guy whose name starts with an 'F'. You can do whatever you want with OGG files, AFAIK.
EDIT: BTW, MP3 has been DROPPED from the Java Media Framework. I found that to be a nice incentive to look up information on Ogg Vorbis.
This isn't life in the fast lane, it's life in the oncoming traffic.
-- Terry Pratchett
[edited by - Kentaro on March 1, 2003 9:33:53 PM]
note, mp3 or not, you definately want to learn to stream your music anyway ... write a simply sound manager class, that loads up the first segment of oncoming music in memory, and frees up outgoing (old, nonactive i mean) buffers. Then make your stream class manage it''s buffers automatically.
There are a few options:
VorbisSPI is an actual SPI that you can attach to the Java Media Framework. I think that might be overkill.
JOrbis is an Ogg Vorbis decoder written in pure Java. I think this might be what you need but I don''t know.
Google for some stuff and see what you come up with.
This isn''''t life in the fast lane, it''''s life in the oncoming traffic.
-- Terry Pratchett
VorbisSPI is an actual SPI that you can attach to the Java Media Framework. I think that might be overkill.
JOrbis is an Ogg Vorbis decoder written in pure Java. I think this might be what you need but I don''t know.
Google for some stuff and see what you come up with.
This isn''''t life in the fast lane, it''''s life in the oncoming traffic.
-- Terry Pratchett
cool, i use jorbis and it works very nice
(but i don''t know to loop the music)
oh yeah, do u know what''s the best mp3 to ogg converter
i have tried several converter, but it didn''t work well
maybe i have to convert mp3 to wav first, instead directly convert mp3 to ogg?
okay thank you very much guys
oh yeah, do u know what''s the best mp3 to ogg converter
i have tried several converter, but it didn''t work well
maybe i have to convert mp3 to wav first, instead directly convert mp3 to ogg?
okay thank you very much guys
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement