ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi everybody, this is my first time in this part of LinuxQuestions.org.
I don't know if this is the right place to ask this question, but I've try many how-tos, my text book, and even the java.sun.com forum, where people are not that nice like here. But here I go:
I'm doing this program for my java programming class, and what I'm doing is: using the javax.sound.sampled, I'm taking in a sound.wav file in and playing it as a clip because I want to be able to stop, pause, and go to any desired frame. I have managed to be able to actually play sound clips, nothing really difficult, but only small files. I am aware that java actually loads a clip into memory before playing them. What happens is that java complains about running out of memory if I try to play a longer or bigger file, in wave format of course. Now my questions is: is there a way to actually load long or bigger clips and play them? another question: if I install the ogg-vorbis pluggin for java (from tritonius) will I be able to play entire songs because the actual size of the vorbis file is much smaller than that of the wave file?
I don't really like java that much, I mean it's easy to implement a program with a gui interface, but I still have some questions about its performance. Nevertheless is been kind of fun to just fiddle around with java for this course's purposes.
If in fact Java is loading the wave file into memory, you may need to increase your heap size. There should be a -ms/-mx or -Xmx/-Xms switch that will allow you to set the initial and maximum heap size that Java can use. I've had to use it before on some of our larger applications.
Just a side note, it really annoys me that JavaSound would load the whole binary into memory instead of loading segments. Most of the popular audio players (winamp, xmms, ...) only load segments at a time. Maybe there is a method in the Java Sound API that allows you to tell Java how much of the audio data to buffer in memory...
Originally posted by figadiablo is there a way to specified the amount of heap size in the code itself. I just don't want to have to type the heap size everytime I run the program.
Thanks for the help.
Figa
Not that I know of. I wouldn't think I would want a programmer to be able to dynamically change the properties of a java virtual machine. I've only ever seen the setting modified on the command line.
Yeah, I've seen people using this over at the java.sun.com forums. Seems to be hot topic over there.
About the clip and wav files, I think Im gonna have to use a stream, rather than a clip to play my music, but I still don't know about that. To what I understand you don't get the same kind of controls with streams that you get with clips. I'll ask my java professor to see what he thinks about all this.
Thanks fo the help no2nt, I appreciate it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.