• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

lupine

[java] Sa..Sa...Sound

15 posts in this topic

You mean to tell me that there is not sound in Java 1.1 without a special plugin? I hope this is not entirely true, what kind of sound files/formats are compatable with Java 1.1 Thanks you, weekend have that
0

Share this post


Link to post
Share on other sites
If it's an applet use play() or getAudioClip() in Applet. If it's an app use Applet.newAudioClip(). I think it only supports au files in 1.1. May use wav too. Don't know. I always give up before I add sound to my games.

Oh crap, that newAudioClip method is 1.2 only. Oops. Disregard

But why would you write an application in 1.1? The user would have to download a JRE anyway. I guess you could want to take advantage of jview.exe that everyone with IE has...

There are that com.sun.audio package though...

Edited by - buh on June 8, 2001 11:41:16 PM

Edited by - buh on June 8, 2001 11:44:16 PM

Edited by - buh on June 10, 2001 1:35:46 PM
0

Share this post


Link to post
Share on other sites
Thanks for the pointers,
using 1.1 for maximum portability

I will check out com.sun.audio (is that 1.1 ?)

I am familiar with .wav , what is "au" is that higer quality then .wav?

thanks all
0

Share this post


Link to post
Share on other sites
Nope, .au files are crap. Actually I can't really hear any difference. Probably just not compressed as well. Don't see them around nowadays.

Sorry, guess it's just sun.audio. Using this little package kinda defeats the maximum portability thing though. It'll only work with Sun's 1.1 JRE. It'd probably be better to just use 1.3 or 1.4.

Edited by - buh on June 11, 2001 1:51:08 PM
0

Share this post


Link to post
Share on other sites
so, is the verdict .wav files only in Java 1.1?

I wonder what would be involved in writing a player
myself?

Has anyone tried this?

0

Share this post


Link to post
Share on other sites
The sun audio class can be used in 1.0 and 1.1

By using it you are not being 100% platform transperent aparently but I have had no problems with it....

I posted this ages ago....

import sun.audio.*;

Variables
byte play_snd_data[]; remember to fill it with something!
AudioData snd_audio;
AudioDataStream snd_stream;

to play
snd_audio = new AudioData(play_snd_data);
snd_stream = new AudioDataStream(snd_audio);
AudioPlayer.player.start(snd_stream);

to stop
AudioPlayer.player.stop(snd_stream);

and there is a method to play looping to



0

Share this post


Link to post
Share on other sites
Thanks Chaos, that helps

What kind of audio files will it play?

I am assuming this will work in an app?

Thanks for all your help.
0

Share this post


Link to post
Share on other sites
By default the JDK 1.1 sound API supports only the .AU (u-law compressed) format. But the nice thing is that if you use the "official hack" shown by Chaoslab, you are accessing some of the internal classes and you can implement support for other formats.

See how I''ve implemented .WAV support in my GameFrame for Java library (goto downloads section and download the 0.9.5 version).

The source code of interest can be found in source file src/gameframe/implementations/jdk11x/CSoundEngine.java

The loadSample method loads a WAV file and converts it to a format that is understood by the JDK 1.1 internal sound mixer. The SoundStream, LoopingSoundStream, RiffWavFile and ULawEncoder classes are used in the process.
0

Share this post


Link to post
Share on other sites
quote:
Original post by javanerd

By default the JDK 1.1 sound API supports only the .AU (u-law compressed) format. But the nice thing is that if you use the "official hack" shown by Chaoslab, you are accessing some of the internal classes and you can implement support for other formats.




I''m confused, what other formats?

So, Chaoslab''s example is an "official hack" of sun.audio?
Are there any pitfalls, do I need to worry about soundbank or anything like that?

I really appreciate everyones help 8)

0

Share this post


Link to post
Share on other sites
Well I don''t believe any hack is official!

;-)

I have read that it is not considered "pure java" but I have had no problems with it and I have a suspition that it''s what the applet.audioclip use''s anyway.

The only prob is you have to create the sounds from byte buffers (as you can see) which takes a bit more effort, but hay that also meens you can apply algorythms to them.
0

Share this post


Link to post
Share on other sites
quote:
Original post by Chaoslab

Well I don''t believe any hack is official!
;-)
hay that also meens you can apply algorythms to them.


Nice! so this code:

import sun.audio.*;

Variables
byte play_snd_data[]; remember to fill it with something!
AudioData snd_audio;
AudioDataStream snd_stream;

to play
snd_audio = new AudioData(play_snd_data);
snd_stream = new AudioDataStream(snd_audio);
AudioPlayer.player.start(snd_stream);

to stop
AudioPlayer.player.stop(snd_stream);


will enable me to play .wav files,and I could add a loop
I just got clearence from the sound and music guy to use
.wav files. I am assuming I will be able to play multiple
tracks simultaneously if I code it correctly?

Thanks All!



0

Share this post


Link to post
Share on other sites
Yes you can play multiple sounds con currently but don''t play to many as it can sound a bit crusty!

Of course if you like crust (And I don''t really mind it!)

Then all is good anyway!

:-)

0

Share this post


Link to post
Share on other sites
I owe you one Chaoslab


8) Robert Corrina
mailto:robertcorrina@patownsend.com



0

Share this post


Link to post
Share on other sites
quote:
Original post by lupine
I''m confused, what other formats?

Sorry I wasn''t too clear on that. My post meant that you can write your own loader for any format.

One way to do this is to write your own AudioDataStream implementation that converts the audio format from the loaded format to U-law format (that JDK 1.1. understands) and then feeds JDK 1.1 audio engine with this stream.

JDK 1.1 doesn''t support WAV by itself. That''s why I pointed out the library code, because there you can see how I''ve implemented the conversion from WAV to AU upon loading the file. Also I''ve implemented a looping sound stream that allows me to loop the sound as needed.
0

Share this post


Link to post
Share on other sites
Do be careful using the sun.audio.* classes, they don''t work under java 1.3.
So it might be worth doing some checking to see if the relevant classes exist at runtime or not. You should be able to do a bit of cunning introspection/reflection to do this. That way people can still play the game, but they might not have any sound, which is better than it crashing.

John
0

Share this post


Link to post
Share on other sites
Thanks for the information nerd 8)
Sounds like I'm gonna have to get a little fancy
to code this functionality. I feel squemish about
using outside libraries.

Thanks for the heads up lil'
Looks like I'll do a 1.1 with dodge(error handling)
and then I'll follow up with a different version
for 1.3 and beyond
This brings me to my distribution questions
I hope I can count on all your help in my next thread
8)



Edited by - lupine on June 15, 2001 3:22:37 PM
0

Share this post


Link to post
Share on other sites