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
0
votes
1 answer

Java AudioInputStream skip with negative number of bytes always returns 0

I am trying to skip a negative number of bytes with AudioInputStream skip(long bytes) method . The problem is trying to (let's say a small number of bytes...) : int skipped = audioInputStream.skip(-bytes); always returns 0 .... i don't know what…
GOXR3PLUS
  • 6,877
  • 9
  • 44
  • 93
0
votes
0 answers

Clip can play mp3 but OpenAL just gives silence (Java)

When I test an mp3 file using sound.sampled.Clip, it plays just as expected. When I test it with OpenAL however, I get no sound, and no exception. (I'm using JMF's mp3plugin.jar as well as the OpenAL libraries) This is a difficult problem to…
Perry Monschau
  • 883
  • 8
  • 22
0
votes
3 answers

Why, when calling a method, does it say that I need to catch an exception when I have already caught it?

I have a class that loops some audio: public class PlayGameMusic { public static void main(String[] args) throws Exception { try{ AudioInputStream inputStream = AudioSystem.getAudioInputStream(new…
0
votes
1 answer

Send Byte Array form Spring boot to an angular application?

I have used a AudioInputStream , i get it from text to speech with MaryTTS . i want to send this audio to the client Angular in this case .How can i do this with http ? I have put the audio to an array of bytes and how can I send it ? this methode…
0
votes
1 answer

Can't delete file after creating AudioInputStream from the file

I am working on a program for a class which involves creating a temporary audio file, reading data from it, and then deleting it. I have everything working, except deleting the file. When I attempt to delete the file, file.delete() returns false. I…
weberer
  • 3
  • 3
0
votes
1 answer

Java AudioInputStream works on one project, but not the other

So I have been trying to add sounds in my game but I get an error when I initialize my AudioPlayer class when reading the resource stream. I tested this on another game project and it worked fine with no errors, so it is something weird. Here's my…
0
votes
0 answers

AudioSystem.getAudioFileFormat not working with mp3 Java

I am trying to convert an mp3 file into Audio Input Stream with Java. Following is the portion of my code. **File file = new File("/root/Desktop/files/Song1.mp3"); AudioFileFormat baseFileFormat = null; AudioFormat baseFormat =…
0
votes
0 answers

concatenate a multiple wave files into one file in java

public static Boolean concatenateFiles(String destinationFileName) throws Exception { Boolean result = false; AudioInputStream audioInputStream = null; ArrayList audioInputStreamList_2 = null; …
0
votes
1 answer

how to delete segments of a sound?

I have created a program for analyze a file.wav inserted in input. I want to know if I can remove the intervals of time from the original file.wav. I would cut a parts of the sound unnecessary for the analysis that fall within a definite time. After…
Margherita
  • 148
  • 11
0
votes
1 answer

AudioSystem Write, AudioInputStream from modified bytes obtained from InputStream, Java

I obtaining bytes from InputStream, but I need to modify and save them to Wav File. Here my code: Socket Sending Audio Obtained from Microphone. AudioFormat adfmt = new AudioFormat(8000.0f, 8, 1, true , true); int bufferSize = (int)…
user7339033
0
votes
1 answer

AudioInputStream to base64

I'm using some code to read some audio files from HTTP GET requests and mixing them up. I end up with an AudioInputStream. If I write it to a file (ais is the AudioInputStream) with the code bellow the file is created with success and if I try to…
JSantos
  • 1,698
  • 22
  • 39
0
votes
1 answer

Java - AudioInputStream - Cutting a wav file

I am trying to cut an audio file into a specific portion, given the second at which to cut and how long to extend it to. I found the code below, but as seconds are given as an int, it isn't precise. Can anyone help me manipulate this code to allow…
Joe Corson
  • 23
  • 1
  • 5
0
votes
0 answers

Unable to understand Javax Clip setMicrosecondPosition. What am I missing?

I am adding a minute (60*1000*1000 microseconds) to the audio clip and starting it and I achieve the desired result only the first time i.e, I'm reaching the correct point in audio file. Next time I call getMicrosecondPosition on the Clip object, I…
Srinivas
  • 332
  • 4
  • 18
0
votes
2 answers

AudioInputStream from InputStream ( load from resource directory)

I try to load my sounds from my resource folder when trying out my Application in the IDE. For images and other stuff that uses InputStreams I use this method: @Override public InputStream readAsset(String fileName) throws IOException { …
Yesyoor
  • 157
  • 1
  • 18
0
votes
1 answer

Why won't java play my .wav files?

Here is my very short test method: public static void main(String[] args) { try{ File sound = new File("./res/bird.wav"); AudioInputStream stream = AudioSystem.getAudioInputStream(sound); AudioFormat format = stream.getFormat(); DataLine.Info info…