Questions tagged [audioinputstream]

AudioInputStream is a class in the Java package javax.sound.sampled. It's used for reading raw audio data from e.g. typically a file or microphone.

AudioInputStream is a class in the Java package . It's used for reading raw audio data from e.g. typically a file or microphone.

49 questions
1
vote
1 answer

Java audiostream platform independent

I have the following method to play audio clips: public static synchronized void playSound(final String path) { new Thread(new Runnable() { // The wrapper thread is unnecessary, unless it blocks on the // Clip finishing; see…
Wt Riker
  • 514
  • 12
  • 24
1
vote
0 answers

Java program not recognizing two equal sections of wav file as equal?

In a section of my program, I read the first 4410 frames of a .wav file. Which I have checked in Audacity and those 4410 frames contain nothing but a blank audio space. Image of the audio in Audacity The bit of code in question takes the other blank…
Cigol
  • 11
  • 2
1
vote
0 answers

AudioInputStream for AudioPreProcessor

I'm working with comirva library and trying to implement getAudioPreProcessor method that takes the file and gets the InputStream. The problem is that Android doesn't support AudioSystem nor AudioInputStream. There is a class implemented in comirva…
kenkulan
  • 147
  • 4
  • 14
0
votes
1 answer

Thread not finishing - Sound Event Dispatcher Java

I am creating a game in Java and I am trying to implement music playing but I am running into issues ending the program. The primary hierarchy of my program is 3 classes I have written; InputHandler, GameState, and Map. The InputHandler contains a…
0
votes
0 answers

Java: Converting Audioinputstream BACK to InputStream?

Ok, this is going to sound odd, but hear me out. I've been using Mendix to deal with an app that manipulates wav files. I love how easy Mendix makes the front end. I have a FileDocument with a WAV file in it. I use the custom java below to read the…
Brian Lorraine
  • 153
  • 1
  • 1
  • 17
0
votes
1 answer

file not found or syntax incorrect when using Main.class.getResource("notification.wav").getFile()

I am trying to play a .wav file but having trouble doing so with a relative path function. public class Main { public static void main(String[] args) { playSound(); } public static void playSound() { try { …
Leschge
  • 146
  • 3
  • 11
0
votes
1 answer

How to stop audio through clips with a seperate method

So this is my code. I have it in a seperate class, so I can simply call start and stop music and what I'm trying to do is actually find a way to stop the music, by calling the stopMusic method. I have no clue how to work with clips and InputStreams…
AeciaI
  • 13
  • 3
0
votes
1 answer

AudioInputStream from file conversion gives "frameLength=-1"

I am trying to obtain an AudioInputStream from a file in a specific format. When I open the file in fileStream I get a positive frameLength meaning the file can be read and the AudioInputStream effectively has data. Now I want to convert it with…
0
votes
1 answer

AudioInputStream is throwing NullPointerException

I have been looking for a way to export a JAR file from my project that manages to always play the sound files no matter where it is located. For this I wrote the following code that returns an exact path to the file. public MouseHandler() { …
Luqus
  • 109
  • 1
  • 11
0
votes
0 answers

Can't increase decibels (working on mute option) in Java

I'm working on a mute button in my GUI and until now have not figured out a way that i can do this so i thought decreasing the decibels and increasing them back with each click. So when i click the mute button i have: for (int i=1; i
0
votes
1 answer

How is it possible to navigate to wav.file in src (for playing sound in java)

I've looked at different solutions at Stackoverflow to play a sound in Java. The example given below (from another topic) is the one I would like to use. import java.io.*; import java.net.URL; import javax.sound.sampled.*; import javax.swing.*; //…
Joost
  • 42
  • 7
0
votes
0 answers

Error with playing sound. java.lang.NullPointerException

I created A tictactoe (creategame class) game on my mac, uploaded it to GitHub, downloaded on windows 7. Then this error occurred while running the eclipse project. On researching, I think its a software/driver issue or it's not detecting the sound…
0
votes
1 answer

Make audio loop faster

Simply put, I am using .ogg files in my application, and there are several background audio tracks I need to loop. However, the way I approach looping the audio files is simply reloading the audio files and playing them again. This approach creates…
Gigi Bayte 2
  • 838
  • 1
  • 8
  • 20
0
votes
0 answers

Java - What do the Bytes Recieved by Reading from an AudioInputStream Correspond to?

Can someone explain what the bytes you get by reading an AudioInputStream correspond to? Things like volume or frequency/pitch. I have this code that reads the bytes from the entire file. int BUFFER_SIZE = 1024; AudioInputStream audioStream =…
Jacbo
  • 13
  • 6
0
votes
0 answers

How does the AudioInputStream.read(byte[] b) function work?

I have a problem with this method. In the following i have written a test code that reads an audio stream into a byte array (and does a convertion [i have mp3plugin.jar as external jar, if you should wonder why this works] and some other stuff, but…
doej1367
  • 311
  • 2
  • 12