Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2
1  Java Game APIs & Engines / J2ME / The Chromalizer! on: 2012-05-17 20:18:12
I thought it's about time I wrote a few things for my Sony-Ericsson T610!

I was surprised just how slow the JVM on this thing is, it's quite difficult to get any sort of animation. It does seem to be quite good at drawing filled rectangles, however, so here's what I came up with:

http://sites.google.com/site/mumart/home/j2merastereffects

Cheers,
Martin
2  Java Game APIs & Engines / Java Sound & OpenAL / Re: How to plau a mod sound file in java! on: 2012-05-13 19:57:56
I have written several Java mod-player libraries over the years. The source code for the most recent ones can be found at http://code.google.com/p/micromod/

Quote
My question is how can these files be converted into sound in modern day computers?? (I know they can, JavaModPlayer2 is a good mod player). I'm assuming that the original notes in the mod files were directly fed to the 15 hardware instruments that resides in the Amiga.

Wouldn't this undoubtedly make mod files sound different on practically every computer depending on how the 15 Amiga instruments are emulated?

The Amiga did not have any built-in instruments, the original SoundTracker MOD format could have up to 15 8-bit samples contained within the file. Every mod file contains the sample data for all instruments within it. The early mods all sounded the same because everybody used the instruments provided with SoundTracker, on a disk called "ST-00".

Quote
How do modern mod players play mod files? Do they decode into another format first, like mp3? Or do they directly feed the information to the sound hardware - how do they do that? Does Java provide an API for this?

Usually they generate a PCM wave-file a fraction of a second at a time (10-100ms depending on the tempo) using sample-rate conversion for each channel and mixing them together. Java can play PCM sample data using an appropriately configured javax.sound.sampled.SourceDataLine.

Any differences in the sound between different players is generally due to the quality of the sample rate conversion. The original Amiga hardware did not have any oversampling, and the sound quality was comparable to using nearest-neighbour resampling at a high sample rate such as 96000hz.

Cheers,
Martin
3  Games Center / Showcase / Re: Yet another Sokoban (J2ME/MIDP1.0) on: 2012-05-13 19:16:21
You need to transfer it to your phone, as it is J2ME only. You can run it on your desktop using MicroEmu (this is what I used for debugging):

http://code.google.com/p/microemu/downloads/list

"Failed to load main-Class"

I guess something went wrong with exporting.
4  Games Center / Showcase / Yet another Sokoban (J2ME/MIDP1.0) on: 2012-05-13 16:59:27
Here is a simple version of Sokoban which should work on most Java mobiles. The source code is included in the 64k jar file along with over 1000 freely-available puzzles from http://sokobano.de



https://sites.google.com/site/mumart/home/sokobanformobilejava/Warehouse.jar
5  Discussions / Jobs and Resumes / Martin Cameron (Dev/Test/Etc) on: 2005-05-18 00:53:58
I suppose this has got to be worth a try! I'm looking for pretty much any job in the sphere of software development.

I've put my CV up on http://geocities.com/sunet2000

Aplologies for lack of style, HTML definitely isn't on my list of skills Smiley
6  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-05-09 14:38:19
Some more MOD related bits and pieces. I guess it's a hobby of mine :-/

This one has some tuning of the MOD playback, so PC mods with more than 4 channels now work well. There's still no S3M loader, but you can always convert to XM if you're desperate ...

http://geocities.com/sunet2000/ibxm-alpha31c.jar

If IBXM is too bulky for you, try http://geocities.com/sunet2000/Micromod.java - a full featured MOD-only player with a turbocharged mixer in less than 600 lines of code, which compiles to just one 12k class Smiley

I'll update the website soon.

Cheers,
Martin
7  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-04-14 16:55:20
Another day, another alpha. There are a couple of major fixes (any xm that attempted a global volume slide down would simply fall silent).

There's also a seekable InputStream for use in an SPI, and a WAV InputStream.

http://geocities.com/sunet2000/ibxm-alpha31.jar

Cheers,
Martin
8  Java Game APIs & Engines / Java Sound & OpenAL / Re: [1.5.0]sampled stuff isn't working anymore on: 2005-04-14 16:47:58
Quote
Have I hit the same bug?


No I haven't. A bug in my read method caused it to return 0 every time. I'm surprised I can get anything I write to work these days Embarrassed

Clips seem to work every time for me, although streaming mods through the clip interface is slow and takes up enormous amounts of memory. It's obviously not designed for that.

Quote
Have I hit the same bug?

I've written a seekable InputStream for my modplayer, and verified that it spits bytes out (so I should hear /something/, even if it is just noise Smiley.

The following code is silent:

1  
2  
3  
4  
5  
            AudioFormat format = new AudioFormat( rate, 16, 2, true, false );
            AudioInputStream ais = new AudioInputStream( new IBXMInputStream( i ), format, i.getSongLength() );
            Clip c = AudioSystem.getClip();
            c.open( ais );
            c.start();
9  Java Game APIs & Engines / Java Sound & OpenAL / Re: [1.5.0]sampled stuff isn't working anymore on: 2005-04-12 14:08:34
Have I hit the same bug?

I've written a seekable InputStream for my modplayer, and verified that it spits bytes out (so I should hear /something/, even if it is just noise Smiley.

The following code is silent:

1  
2  
3  
4  
5  
            AudioFormat format = new AudioFormat( rate, 16, 2, true, false );
            AudioInputStream ais = new AudioInputStream( new IBXMInputStream( i ), format, i.getSongLength() );
            Clip c = AudioSystem.getClip();
            c.open( ais );
            c.start();
10  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-04-09 23:53:59
In the spirit of not keeping things back, here's another alpha!

http://geocities.com/sunet2000/ibxm-alpha30.jar

The framework is now feature complete, and the interface is not likely to change. Probably still has quite a few bugs, though. XM is an amazingly quirky format. Some might even say "baroque" Smiley

All the effects that I want to implement are now done. I've had some feedback and it appears that playback is very accurate (or as he put it, "blimmin amazing!!") and much better than kbxm. Certainly good enough for gaming!

Also there has been a bit more tuning and bugfixing, and the commandline player application now lets you choose the interpolation.

Next job is S3M Smiley

Cheers,
Martin
11  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-04-08 10:16:34
Quote
Good work Smiley

Did switching to integer arithmetic improve performance? (Do you have some numbers?)



I measured the time it takes to mix the entire song at 44100hz with linear interpolation without writing the result on a bunch of different versions, all use integer arithmetic except for KBMod.

Tests done on a 1500mhz Sempron with Java 1.5.0:

Song: Jogeir Lilljedahl - Guitar Slinger (299 seconds)

MicroMod 0.83 : 1516ms
MicroMod 0.98 : 2250ms
KBMod : 6359ms
IBXM: 1672ms
IBXM-Fastmix: 1156ms

Song: TNT - Once More TNT (195 seconds)

MicroMod 0.83 : 906ms
MicroMod 0.98 : 1297ms
KBMod : 3344ms
IBXM: 984ms
IBXM-Fastmix: 687ms

Even the slowest of these only takes 2% of this cpu Smiley

IBXM is nearly 4x faster than KBMod. Floating point has quite a speed penalty!

"IBXM-Fastmix" is a test version that directly mixes into a mono 8 bit byte array and only supports forward sample loops. Since it's only 50% faster and poor quality I probably won't follow it up.

The fastest player with good quality mixing is MicroMod 0.83, but only by 10% or so, which did surprise me, given how naive the mixing code is in that player. IBXM sounds much better, anyway Smiley I may be able to optimise it to close that gap.

The slowness of MicroMod 0.98 comes as no surprise. I'm surprised it's not slower, given how much buffer copying it does.

Quote

Oh and right now there isn't a way to cleanly exit the demo player. Pressing ctrl+c can result in an endless loop of the last frame (until you reboot), because the cleanup stuff isn't reached.

There are several ways to fix it, but it would make the programm more complicated, which isn't necessarly a good thing. So, just print a message that it's better to let it run through Wink


I see, I've never come across that problem before. I'll bear it in mind.

Cheers,
Martin
12  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-04-07 19:00:16
OK, I didn't make the 2-week deadline, but it's good to put pressure on yourself from time to time!

Here's an alpha of my new player, called IBXM. I've spent the last couple of days tuning it, and it sounds much better than KBXM on a lot of modules.

http://geocities.com/sunet2000/ibxm-alpha26.jar

Plays MOD and XMs. S3M support is not done (but only because I haven't written the loader yet). SPI is coming soon.

The player is 100% integer arithmetic, and has generally cleaner code than KBXM (which itself wasn't so bad IMO).

Use the commandline to test (as usual):
java -jar ibxm-alpha26.jar <modfile>

Cheers,
Martin
13  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-03-25 16:25:58
Quote
Thanks Martin, just about to download the jar file!

Fingers crossed the game will get finished (first EVER game on the PC so its a REALLY slow process hehehe)
so you'll be able to see your name in lights (well, lots of phosphor dots anyway! hehehe) with the mod player credit!  Grin

PS. Just downloaded it! nice music! hehe.. takes me back to the mid 70's when i was a teeny tiny kid! haha..


Nice one! Java can be hard work at times. I think the classes are usually well designed, but they don't seem to do much to help you get things done. Getting drag and drop to work was an exercise in futility!

Cheers,
Martin
14  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-03-25 13:58:16
Quote
Thank you

So you'll have to update the demo applet, which has a class version of '49' (java 1.5).

Lilian


OK, I've recompiled the applet with -source 1.3 and -target 1.1, so it'll work on pretty much anything that has a JavaSound implementation now.

Martin.
15  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-03-25 13:20:51
Quote
Got the classloader getting the file path etc, but just cant fathom out how to then pass the info to the:
1  
module = ModuleLoader.read(new RandomAccessFile(modFile, "r"));


as it keeps throwing an error no matter how i try to pass the url to it (even converting to a String it lets it compile, but then get a NullPointerException  :-/)


Here's a micromod jar with a built-in mod to show you how it's done.

You'll probably need Java 1.5 to run the jar, because that's what I compiled it with. [EDIT] I've rebuilt it, and it should work on 1.3+ now.

http://geocities.com/sunet2000/micromod098.jar

Cheers,
Martin


16  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-03-24 22:41:18
Quote
Thank you

So you'll have to update the demo applet, which has a class version of '49' (java 1.5).

Lilian


Doh! Will recompile.
17  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-03-24 22:39:38
A neat trick for getting hold of files inside jars is to make use of a classloader. This works for me with images, so it should work with mods aswell.

If you put the file in the same place as the current class, this should return a URL to the file, whether it's in a Jar or not:

URL url = this.getClass().getResource("filename");
18  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-03-24 05:24:00
The player should work on Java 1.3 or above. You should have no trouble running it with the MacOS X built-in Java.

The engine code should theoretically work with Java 1.1, but stock Java 1.1 only supports 8khz mono audio, and even then you can only perform streaming by using undocumented classes.

Cheers,
Martin
19  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-03-24 00:12:54
I have just been gathering some more of my code in one place. Now most MODs with more than 4 channels will play, and if you download the jar and run it with "java -jar" (or double-click it in recent Windows JVMs) you will be greeted with a craptacular, barely functional drag+drop GUI which lets you adjust the interpolation.

Tomorrow I'll do some work on fixing some more crashing bugs (ie some of those reported last year)

Cheers,
Martin
20  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-03-23 17:45:22
Here's a new version.

http://geocities.com/sunet2000/kbapplet.html

I haven't fixed any playback bugs (probably added
a few). MOD playback is still limited to 4 channels,
but I'll fix that and maybe add S3M within the next
few days.

Here are the obvious changes.

BSD licence!

New integer mixing algorithms with improved quality
(but slower because I have used a big piece of glue to
adapt the new resampling interface to the old one).

More reliable XM loading.

MOD/XM playback in a single codebase.

Simple Applet included.

Have fun!
Martin
21  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-03-18 16:03:02
I'm going to do an SPI for the next version, so it should be much easier to integrate (this would make any choppiness purely the fault of Java and nothing to do with me Smiley

I haven't made much progress on it these past few months, but I'm laying down the gauntlet now.

Within 2 weeks:

BSD Licence.
Robust MOD/S3M/XM playback.
32bit accumulator Integer arithmetic throughout.
J2ME compatible replay engine.
Will include an SPI for easy JavaSound integration.
Sample accurate song length calculation.
FAST 16 point FIR interpolator (already written, uses a really cool fully vectorisable algorithm)

Or your money back Smiley
22  Game Development / Performance Tuning / Re: New VM performance improvements on: 2005-02-05 23:25:39
Quote
Operations on streams can be very cool too ( and subject to massive optimizations using MMX, 3DNow, SSE, SSE2, SSE3, etc ).

1  
2  
3  
4  
5  
6  
void add( int value, int[] stream, int offset, int length );
void mul( float factor, float[] stream, int offset, int length );
void xor( short mask, short[] stream, int offset, int length );
void lshift( int amount, int[] stream, int offset, int length );
void clamp( byte lbound, byte ubound, byte[] stream, int offset, int length );
...


Ah yes, the wonderful MMX, where 1*1 = 0.5

I would love to be able to use SIMD from java, though.

23  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2005-01-14 21:07:13
Sorry about the lack of communication/effort etc. I'm a lazy git. For an example of using kbmod in an applet and loading mods over http visit http://geocities.com/sunet2000/kbapplet

This uses some slightly tweaked code which prevents the data being trashed by the loader.

A greatly improved, integer-only mod/ftk/s3m/xm player is on the way!
24  Game Development / Networking & Multiplayer / Re: Scrambled/Cooked data over HTTP connection. on: 2004-09-26 10:51:37
I figured it out eventually!

I was parsing the file using the read() methods of a basic InputStream. I didn't realise these were non-blocking calls and not all the data I asked for was guaranteed to be read.  Embarrassed

The bug didn't show up when reading from local files because the IO could keep up with the program. Now I'm using a DataInputStream all is OK.

Thanks for your help!

Martin
25  Game Development / Networking & Multiplayer / Scrambled/Cooked data over HTTP connection. on: 2004-09-25 23:22:33
I've been doing some small experiments with applets and I've run into some trouble. I'm sure there must be a really simple solution to this.

I have a binary file on a webserver and am using the following code to access it from an applet:

url = new URL( getDocumentBase(), getParameter( "filename" ) );
InputStream i = url.openStream();
// ... Read bytes and close stream

The problem is the data I receive is scrambled. I'm not sure exactly how the scrambling is done but I assume it's being "cooked" (inappropriate ascii cr/lf conversion).

The file is not scrambled when I download it using a web browser so there's no problem with the source. The content-type is "audio/mod". My guess is java doesn't understand this and is treating it as ascii.

I have tried getting a URLConnection and manually setting the "content-type" request property to "application/octet-stream" but that didn't help. Maybe this is only used for sending data?

Hope someone can help!

Martin
26  Java Game APIs & Engines / Java Sound & OpenAL / Re: Ok Linux users - Proove your OS! on: 2004-09-11 19:05:44
If you need it working as quickly as possible, just get a soundblaster live and drop it in. They work well with linux.
27  Java Game APIs & Engines / Java Sound & OpenAL / Re: Ok Linux users - Proove your OS! on: 2004-09-11 19:04:13
The DMA messages suggest that the driver isn't working.  

Make sure you have the latest drivers by installing the most recent kernel package. Have a look into apt-rpm, which can be used to automatically update your system.

Redhat 6.2 is quite old, you should consider updating to something like fedora if possible.
28  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2004-07-16 11:33:26

Also, about GC, I'm very careful not to allocate objects during playback, so my player should never trigger a garbage collection.
29  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2004-07-16 11:28:17

Hi!

Garbage collection tweaking will not help with this problem unfortunately. It is caused by the fact that JavaSound is a load of crap. You can only do blocking writes to the sound device because the available() and getMicroSecondPosition() methods of DataLine are too inaccurate (they return values that only change when the buffer is half full).

I solved this in MicroMod by using a timer that estimated the amount of data that could be written to the buffer without blocking, and mixed only the amount of samples that were required. This meant that you could calculate the audio in the graphics thread, eg every frame. This required some quite complicated code because of things like volume ramping.

The current players are simplified as much as possible, and so this is not implemented. The best you can try right now is reducing the buffer size to about 20ms (which is the default "tick" length in MOD).

In the next version (when I get around to it!), I will put this feature back in. I'm also planning on getting it integrated into a gaming library and converting it to use integer arithmetic for J2ME Smiley

Regards,
Martin

30  Java Game APIs & Engines / Java Sound & OpenAL / Re: Java MOD/XM Playback on: 2004-06-06 14:25:16
Hi there!

Quote

Right now it's LGPLed, wich doesn't really work for Java (the license itself is absolutely ok for C/C++ stuff). Since most people doesn't like having legal gray areas involved, it might be a good idea to switch to a more appropriated license (BSD style or something similar to the license of lwjgl).


I'll look into it!

Quote

Unfortunately one of the modules caused kbxm to bomb out (at the very end of the track) for some weird reason.
Code:


Well, I didn't call it alpha for no reason! At least it let you hear the tune before crashing Smiley It looks like a bad module with an invalid pattern break (I don't do a lot of checking for things like that). I'll fix it.

Quote

The mod player is somewhat restricted. 4 channel NoiseTracker and most ProTracker modules.


Well, my collection is 100% 4 channel amiga mods, so that's what I focused on. I wasn't sure if anybody used the "multichannel" mod formats like FTK (I added support to micromod after 1 request). Also the extra panning command added to FTK conflicts with some of my amiga mods which used the effect for video synchronization.
Adding FTK support with panning etc is literally about 10 lines of code. I'll put that on my todo list Smiley Thanks onyx!

Quote

i tested it with serveral .mod's from Amiga Demo Archiv, but no one was falid, i allways get the "No Vaild Mod" Exception.

Stay Tuned,
Jens


This might be a stupid question, but are you trying to load .mods into kbxm? You need to use kbmod to play mods. I've got a good reason for splitting the two players up. XM is really not very similar to MOD and each format has it's own quirks. It's much better for good playback to use separate code. I suppose I should be reusing some of the common bits like the mixer and front end. That's a job for later I suppose.

Cheers!
Martin
Pages: [1] 2
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (19 views)
2014-09-24 16:12:06

Grunnt (45 views)
2014-09-23 14:38:19

radar3301 (27 views)
2014-09-21 23:33:17

BurntPizza (63 views)
2014-09-21 02:42:18

BurntPizza (32 views)
2014-09-21 01:30:30

moogie (40 views)
2014-09-21 00:26:15

UprightPath (50 views)
2014-09-20 20:14:06

BurntPizza (54 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!