LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 03-19-2003, 07:26 AM   #1
figadiablo
Member
 
Registered: Feb 2002
Location: Virginia USA
Distribution: Slackware, CentOS, Fedora
Posts: 342

Rep: Reputation: 30
About Java Sound programing


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.

I'll apreciate any answers that I get,
Figa
 
Old 03-19-2003, 12:37 PM   #2
no2nt
Member
 
Registered: Aug 2001
Location: South Carolina, USA
Distribution: Redhat 8.0/Custom
Posts: 96

Rep: Reputation: 16
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...
 
Old 03-19-2003, 01:09 PM   #3
figadiablo
Member
 
Registered: Feb 2002
Location: Virginia USA
Distribution: Slackware, CentOS, Fedora
Posts: 342

Original Poster
Rep: Reputation: 30
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
 
Old 03-20-2003, 07:47 AM   #4
no2nt
Member
 
Registered: Aug 2001
Location: South Carolina, USA
Distribution: Redhat 8.0/Custom
Posts: 96

Rep: Reputation: 16
Quote:
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.
 
Old 03-20-2003, 10:01 AM   #5
figadiablo
Member
 
Registered: Feb 2002
Location: Virginia USA
Distribution: Slackware, CentOS, Fedora
Posts: 342

Original Poster
Rep: Reputation: 30
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.

Figa
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
programing in java on linux phoenix_wolf Linux - Newbie 21 01-26-2005 06:35 AM
No Sound in Java PenguinPwrdBox Linux - Software 3 09-15-2004 11:01 AM
Java Programing Tutorial embalmedlenin Programming 2 08-23-2003 09:53 AM
Java programing VincentB Linux - Software 3 07-14-2003 07:17 PM
Java monopolizes sound? fantanas Linux - Software 1 05-02-2003 10:14 AM


All times are GMT -5. The time now is 02:48 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration