Managing Audio Files In Java

Apr 18, 2014

I'm doing a little game in Java and I would like to insert a background music managed by a JButton. When the button is pressed, the music starts and then, to stop it, the button is pressed again. If you don't press the button to stop the music remains in the loop until the player plays.

View Replies


ADVERTISEMENT

Streaming Audio Files Over Web Using JMF Plugin

Feb 18, 2015

I've been experiencing problems with the JMF extension when used in an Applet on the web. The program has worked fine previously but not returns the following error...

PackageManager: error reading registry
javax.media.NoPlayerException: Cannot find a Player for : [filename]
at javax.media.Manager.createPlayerForContent(Manager .java:1412)
at javax.media.Manager.createPlayer(Manager.java:417)

[Code] .....

However the program works fine in Eclipse with no errors. I have tried reinstalling the JMF package and setting the CLASSPATH and JMFHOME but it still does not work. I am using the jmf-2_1_1e-alljava version. I have also tried putting the player code in an AccessController.doPrivileged() block but this still does not seem to work.

My code for the player is as follows....

private void play(final String track) {
Thread dispatch = new Thread() {
public void run() {
try {
if(player!=null)
player.close();

[Code] .....

View Replies View Related

Program Which Compares Audio File With Real Time Captured Audio

Nov 23, 2014

I wanted to know some hints on where to begin if I wanted to create a program which compares an audio file with real time captured audio. I found this website "[URL]...", but I think this would not do the job, so what are the basics of audio in java and how to compare audio files and see if they are compatible.

View Replies View Related

File System - Managing Secondary Memory Simulated As Byte Array In Java

Feb 11, 2014

I and a friend are working with a project to create a file system, who manages a secondary memory simulated as a byte array in Java. We want the file system to be a hierarchical tree structure like in UNIX.

We have come quite far, but the paths are not handled correct. I seem to have mistaken the relative folder ./ for the root folder, but it should mean "working directory folder", ie, where I stand now. That is, if I stand in /dir1 as my "working directory" and make mkdir ./dir2 then should dir2 end up as subfolder in dir1. But with me it appears in the root.

View Replies View Related

How To Read Audio File In Java

Mar 20, 2015

How to read an audio file in java?

View Replies View Related

Java App / Audio Producer - Multiple Consumer Design

Jun 1, 2014

I am planning to develop an application that does the following:

1) Receiving an audio streaming from a shoutcast server
2) Decode and push it throught producer to a shared buffer
3) Share audio data to as many consumers are interested to this feed.

What is the best practive for doing this? I tried several things without success.

View Replies View Related

Simple Client Server Audio Streaming Code In Java

Apr 18, 2014

I worked on this simple client server chat app and it worked now for my project i needed to work on client server audio streaming broadcast but i dont really know much bout audio api and methods on java...

View Replies View Related

Managing Class Paths On Different Operating Systems

Jun 5, 2014

I use git as my SCM and I use both Ubuntu and Mac OSX. The home directory of the two operating systems are different and there lies the problem. When I commit the .classpath to version control, it looks something like this:

Java Code:

<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/Users/MyUser/Documents/github/Gateway/GDGateway/java-json.jar"/>
<classpathentry kind="lib" path="/Users/MyUser/Documents/github/Gateway/GDGateway/postgresql-9.3-1101.jdbc41.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath> mh_sh_highlight_all('java');

Now when I update my project on Ubuntu. I have to change the build path again because it is referencing paths on OSX. And this goes back and forth. Rather than remove this file from git with .gitignore, I'd prefer to use a global environment variable like as follows:

Java Code:

<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="$HOME/Documents/github/Gateway/GDGateway/java-json.jar"/>
<classpathentry kind="lib" path="$HOME/Documents/github/Gateway/GDGateway/postgresql-9.3-1101.jdbc41.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath> mh_sh_highlight_all('java');

Is this possible?

View Replies View Related

How To Create Java Files Into Windows Applications (Exe Files)

Oct 26, 2014

What step to know to develop software..

View Replies View Related

Disabling Audio With JButton

Oct 11, 2014

I am having right now is that I don't know how to stop my music from playing? I am making a Connect 4 game with some audio to make it intuitive. Below is my code. This is my Music method.

public static void Music() {
try {
File music = new File("C:\Users\Ken\workspace\Assignment1\src\Mario1.wav");
AudioInputStream audioIn = AudioSystem.getAudioInputStream(music);
Clip clip = AudioSystem.getClip();
clip.open(audioIn);

[Code] ....

I called this method into a JButton i implemented into my main GUI.

if (e.getSource() == SoundOn){
Music();}
if (e.getSource() == SoundOff){
//What do I put here?
}

There is the method and my JButton.

View Replies View Related

Applets :: Pause / Resume Audio?

Jul 22, 2014

I'm trying to learn how to Pause/Resume audio in an applet .

View Replies View Related

Audio-system Can't Find Any Mixers

May 13, 2014

I've moved working code over to a different computer, a 32 bit Dell PC running Win7 under Netbeans and Java 8. I can't get it to play or synthesize any sounds because it can't get any Mixers. I tried adding the standard provider entries to the sound.properties file (they aren't needed in my other computer, but I had to try), and it made no difference. I've tracked down the problem farther by getting the source code for these classes and stepping through.

The system seems to have the Mixer providers, but in java.util.ServiceLoader.LazyIterator$nextService() it is looping through a set of javax.sound.sampled.spi.MixerProviders and it hits the following error:

try {
S p = service.cast(c.newInstance());
providers.put(cn, p);
return p;
} catch (Throwable x) {
fail(service,
"Provider " + cn + " could not be instantiated",
x);
}

why this is happening?

View Replies View Related

IOException - How To Play Audio File

Apr 17, 2015

I used the following but there's an IOexception. How can I set it up so that it can play audio even after the jar is built?

public void play(){
InputStream in = null;
try {
in = new FileInputStream(new File(filename));
AudioStream audioStream = new AudioStream(in);
AudioPlayer.player.start(audioStream);
in.close();

[Code]...

View Replies View Related

How To Play Audio In A Stand Alone Application

Jun 26, 2014

how to play audio in a stand alone application.

View Replies View Related

How To Play Downloaded Audio File

Dec 15, 2014

I am making a little game for my friend based on HTML and javascript and i was wondering how to play an audio file that i downloaded on to my computer without the user interacting. like a buzzer you would hear on jeopordy or something like that, creating a Wrong answer buzzer and a right answer buzzer into an if/else statement.

View Replies View Related

Swing/AWT/SWT :: Continuous Audio Data Stream Not Working

Oct 15, 2014

I am trying to make my audio loop and i tried the code below

public void audioloop() {
AudioPlayer MGP = AudioPlayer.player;
AudioStream BGM;
AudioData MD;
ContinuousAudioDataStream loop = null;
try {

[Code] ....

But is not working. I was thinking may be API is not work with java 7 because i got the following warning (AudioStream is internal proprietary API and may be removed in a future release);

View Replies View Related

Android Audio Decoding For Morse Code And PSK31

Jan 6, 2014

I have some software I need to write. I am planning to write two apps for Android, one of which will send and receive Morse code, and the other to send and receive PSK31 data.

Programming is not my strong point, and I am currently struggling on how to do this. I have researched the software, and I am having a hard time finding out how to decode the audio streams on Android. I have also had difficulty finding examples and source code as what I have found is mostly written in C/C++, whereas I need examples in Java.

View Replies View Related

Basic Translation Software - Adding Audio To Words

Jan 30, 2015

I am a visual effects artist not a programmer but I wanna create a very basic translation software to improve english language in primary school students in my country. I cannot program at all except html and css but I am willing to do and learn whatever it takes to make this work. I don't know where to start from or what language to use. The structure of the program is to type an english word and then it must give out a translation of my local language and vice versa and I would like to add audio to the words.

View Replies View Related

How To Play WMA Or MP3 Files In Java

Jan 23, 2014

I was looking at the Sound API pages in the java tutorials. I was planning to use it to run wma files. Fortunately, for me, I found, soon into the tutorials, that these API DON'T support the type I have all of my files in (I have a ton of wma files but none of the libraries mentioned support them.)

I almost thought I heard JavaFx or whatever it's called does, but that sounds foreign and Netbeans lists it as a separate type of java in a way, so I don't know if it would be cross-platform or if it could work with the JavaSE API.) Nor do I know what JavaSX or whatever it's called is really, other than that it's more for internet than application.

If I wanted a JPanel or Applet acting as the content pane of a JFrame or being in a JFrame, could I use JavaFX (or whatever it's called) or some third party library (that I always tend to end up spending hours on trying to get it to find the jar files when I import them, so I hope I don't need too many jar files!!!! ) would it work with the JavaSE API?

I don't know much about Java and playing sounds (other than that there is a static method, I think under Toolkit, that will play a system beep) with programs.

However, I can see that that packages don't support certain types (so much for cross-platform!!!!!!! ) and also that a while back that Oracle took over and that they aren't really updating the Java Sound APIs really that much at all

So, without having to learn a whole new Java set of standards (assuming JavaFX or whatever it's called is a different set of standards from JavaSE), is there a way to play .wma?

That's all I seem to have on my computer.

(I suppose I could create new sounds, though if Oracle isn't updating the library, who knows if even that works anymore, but if you're trying to run a Java Media Player that runs lots of DIFFERENT sound file types, this seems a real setback. )

I heard you could convert them to MP3s (I heard there were free things that did it, but who knows if the things aren't filled with viruses that'll do it or, even if they're not, that they'll really mess up the quality of the sound and that I might lose the old .wma file in the process even if it doesn't corrupt the sound.)

But, even if I get a .mp3, I heard the main JavaSE libraries DON'T cover that either, though it was said it was easier to make it run them than .wma files.

MediaPlayer and the main JavaSE classes don't seem to be able to fit for this type of program (a java media player) that I was planning. Heck, they can't even play any music I have on my computer at all, media player or not.

View Replies View Related

Transferring JAVA Files

Aug 8, 2014

I have made a program on BlueJ but need to transfer the class to a pen drive so that I can take it to school and show it to my teacher. How is this done

View Replies View Related

Renaming Files With Java

Mar 31, 2014

I have a batch of files that I want to remove a common word from all of their filenames. I think I could bash my way through this if I had a linux machine, but I don't. Any tips on what classes I need for the files I want to rename (if any) would be great. I can handle the string changes, but searching a directory and renaming files is something I've never done with code before.

View Replies View Related

Secure Java Files

Oct 4, 2014

My friend has a youtube channel with 50.000 - 100.000 subscribers. I dont know the exact amount but he asked me to make a program for his subscribers. I made it in Java and it works perfectly fine but now i want to make it secure so people can't decompile it and read/change the code. Because ofcourse he also has viewers who can hack programs.

But i dont know how i can do that. I dont want to make the code hard to read. I already heard about program which adds lines of code without doing anything actually and programs making the code a lot more complicated. But thats not what i want, i want to make the Class files undecompilable so people cant decompile it to Java files again and read the code.

I know this is possible, Runescape for example is written in Java too and secured good enough in my opinion. I know there are fake Runescape games called private servers or something like that. But its not easy as downloading the game, decompiling it, connecting it to another server and you're done. A little kid can do that but i think its even possible that people just programmed Runescape again from scratch.So i want to make my program very hard to decompile or even impossible, i want it as impossible as possible.

View Replies View Related

CMD Won't Compile JAVA FILES

Oct 10, 2014

I'v tried everything, i'v tried to create new path in enviornment variables i tried adding this path -->(C:Program FilesJavajdk1.8.0_20bin) to the end of the default path doesnt work i uninstalled and reinstalled and did the same thing over and it didnt work am i editing the files wrong ? what i do is write the hello world program in eclipse to make sure there arent any errors then copy and paste in note pad++ save it as a .java file and it doesnt work i tried save it in regular notepad as .java laso and it doesnt work iv done every thing i could possibly find on youtube is this stuff outdated ? is there a new way? this one one of the errors ill get

C:javat>javac helloworld.java
helloworld.java:1: error: '{' exp
public class helloworld.java {
^

And this is the code for that file im trying to compile

public class helloworld.java {
public static void main (String args[]){
System.out.println("hello world");
}
}

View Replies View Related

Batch Printing Of Files In Java

May 21, 2014

One challenging task in java i am facing is, batch printing of files in java .....

View Replies View Related

Best Way To Read / Write Files In Java?

Mar 31, 2014

I have seen different methods of creating and reading files (specifically text files) in Java. The PrintWriter method or the Formatter with a Scanner to read the file, using a BufferedWriter with a BufferedReader, etc. They will all read/write text files, but from what I understand they do so in different ways. When would it be more beneficial to use a buffered writer than, say, PrintWriter, which is much simpler code-wise? Is there a "best" way to handle i/o in general in Java?

View Replies View Related

How To Play MP3 Files From Java Program

Dec 26, 2014

I wanted to build an mp3 player as a Java project. One crucial part of the project involves being able to play an mp3 fie. I am not able to find the right api (if one exists) and am not able to find a suitable answer when searching on the web. A simple code snippet illustrating the playing of mp3 file using Java program. Also, I am using Eclipse IDE and how to import files if any importing of files is required.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved