...turns out that just putting code in to decode Oggs into ByteBuffers cost about 4k, and then, the samples themselves are sort of massive really compared to anything else. So sound effects from Oggs don't appear to be such a great idea after all Back to the drawing board on that one.

In other news, just to show you how completely rubbish I am at all this, so far I've got a black screen up in about 6800 bytes. Admittedly it's a very nice black screen which resizes, remembers its position between runs, can be toggled between fullscreen and windowed, paused, fades volume out when inactive and back in again, is perfectly rate locked at 60Hz, and automatically adjusts its aspect ratio correctly for any size of display. But, er, you get the idea. Hm...

In other news, just to show you how completely rubbish I am at all this, so far I've got a black screen up in about 6800 bytes. Admittedly it's a very nice black screen which resizes, remembers its position between runs, can be toggled between fullscreen and windowed, paused, fades volume out when inactive and back in again, is perfectly rate locked at 60Hz, and automatically adjusts its aspect ratio correctly for any size of display. But, er, you get the idea. Hm...

Sounds like a perfect powerful black screen to me

Would you mind to release the source? I mean - that sounds like it's basically one of the best startup codes you could get for any LWJGL game, right? A commented version would be a jewel in the LWJGL wiki for example

I'm currently pursuing two ideas. One is to see what can be done generating SF/X with FM synthesis (frequency modulation). The overhead for FM is remarkably light. Biggest cost is maybe two K for a good sized sine wave table. It's just a matter of figuring out how to program the various needed SF/X. I'm hopeful as I have a good decade of DX7 programming behind me, including a fair number of SF/X in my library that can potentially be plundered. Hoping to make some more progress later in the week. (It COULD also be a way to encode and play back musical ditties.)

What kind of SF/X exactly are you hoping for?

The second idea is to work off of samples, but in a more efficient fashion. The ClipTrack is the most recent thing I wrote. It works like a Clip, but allows one to replay with overlap, including playback at different speeds. I am thinking, also, the source data doesn't have to be stereo, and there may be other ways to compact things. For example, using a form of granular synthesis, make continuous effects (rain, running water, fire, wind) from random assembly of a few fragments rather than multi-second samples. Or even just use a lower resolution in the storage. It can be totally arbitrary, as long as the operation to convert to the correct resolution is no more than a multiply. Maybe even A-law or mu-law quantization of the audio would work, as these are cheap in terms of cpu to decode (compared to mp3 or ogg/vorbis).

With the ClipTrack, for example, one can take a single sample of a bell, and play it back at several different speeds, making a melody. The gun shot effect I demo on this site http://www.hexara.com/VSL/AudioMixerDemoWarOfWorlds.htmkind of works as an explosion as well (again, different speeds). But slowed down effects are better if they originate in the distance, due to frequency rolloff.

I am happy to share any of this code (would be honored).

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables

Maybe too limited We'll see how it goes. If I had my way it'd be LWJGK64k but I have a feeling someone would indulge in a massive techno-wank and do some shader based extravaganza and demoralize everyone with a stunning graphical demo. I'd still give it 0/10 for shit gameplay though

Ogg/Vorbis files got about 3.5k of header overhead. This overhead collapses inside a solid archive, because that whole thing is essentially the same for all of your samples (except for 12 bytes somewhere at the beginning).

Zip (or jar for that matter) doesn't allow you to create solid archives.

(Solid archive = everything is compressed in one go, not individually.)

I pack my wavs into a single OGG file normally. Unfortunately all of my OGGs are huge anyway and I can't find a way of compressing them further.Not to worry though, I've got an FM soft synth working in about 5kb so far. Though I can't get it to produce satisfactory noise. Any tips on producing noise that actually varies with pitch? (Just using Math.random() produces uniform white noise at any pitch!)

I pack my wavs into a single OGG file normally. Unfortunately all of my OGGs are huge anyway and I can't find a way of compressing them further.Not to worry though, I've got an FM soft synth working in about 5kb so far. Though I can't get it to produce satisfactory noise. Any tips on producing noise that actually varies with pitch? (Just using Math.random() produces uniform white noise at any pitch!)

Only a code fragment from a 3 channel + noise synth I was playing with. The noise channel worked by only taking a new random number at the frequency specified by the note, effectively giving a noise low pass filtered at the note frequency. It's a bit rough and ready, but takes very little code.

I haven't tried it on noise, but it worked pretty well on a sawtooth wave I generated via a wavetable, yesterday. (Just starting to learn about filters.) I found I had to make the values pretty close to 0 to hear any effect, so some scaling other than linear will probably be needed.

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables

As has been suggested, you can easily generate 1 bit pitched noise by generating a new sample (randomly 1 or -1) every period. This is how old consoles like the NES work and it sounds pretty good. Alternatively you can low pass filter white noise and there are a bunch of different filters with varying characteristics. State variable filters are about as simple you can get, have resonance to play with and low/high/bandpass simultaneously available:

Looks good to me. I hadn't realised a LPF could be done in so little code. It would be interesting to compare the two results. I imagine the roll-off could be different.

Edit: @ShannonSmith. The HPF and BPF look good too. I'm thinking about reworking my synth. The main drawback is that it doesn't support tempo changes. Once that's fixed, the next thing on the list is programmable channels. I was considering a program definition that specified the amount of each harmonic used in the note generation to see what variety that would give me. Also easy is programmable attack/decay (currently fixed attack/decay is used to avoid glitches). I was wondering about some sort of pitch bend capability, perhaps as simple as specifying a rate of increase/decrease in frequency from the starting note. Other nice to have features are hall effect and modulation. Of course this all adds more code, so perhaps a music based game.

@ShannonSmith - love that filter code - just excellent! My synth is now doing noise, triangle, sine and square waves, FM, AM, polyphony, and has envelopes for ADSR, pitch, resonance, and cutoff. Combined with reverb and echo from OpenALSoft I think I should be able to get a whole load of cool sounds out of it.

Mine is now finished thanks to you and Alan_w It's still a little large for my liking - though with Pack200, I've got this entire awesome synth and the aforementioned Nice Professional Windowing Code all in 4kb so far. I think it's time to move on to font rendering. I'm budgeting 2k for font rendering.

You really do have a super-human ability to stay on target and should write a tutorial on how you do that. I literally have 50 game projects that are all about 10% complete. Whoever said getting started is the hardest part needs a swift kick in the bollocks.

You only get to see the public results I have a pile of unfinished broken projects lying around too, you just don't see so much of them!Besides, I've been at it for a few days now and still don't have a game to show for it. I'm thinking a vector asteroids game would be a good start so that's what I'm going to aim for, and vector graphics need very little art or memory to do really well. And there should be some awesome blooping and zapping noises.

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