Questions tagged [javax.sound.sampled]

Provides interfaces and classes for capture, processing, and playback of sampled audio data.

98 questions
0
votes
1 answer

What does the raw data in a .wav file mean?

So I'm trying to extract the amplitudes of different samples from a .wav file to be able to reconstruct the waveform with regards to time. While researching the format of a .wav file, I found some very useful information. However, I was confused…
0
votes
0 answers

Can't fund file location

I am trying to play the .wav file but for some reason, I am always getting the error of can't find the error. Below is my code: package Program; public class YuanVideoGameStore { //VARIABLES: static final String BACKGRUONDMUSIC =…
Alex Yuan
  • 35
  • 5
0
votes
2 answers

Is there a consistent way to keep track the position in a Clip (or audio file) in Java?

I'm trying to code a rhythm game in Java. I'm playing an audio file with a javax.sound.sampled.Clip and I want to know the exact position where I am. Following my researches, a good practice for a rhythm game is to keep track of the time using the…
0
votes
0 answers

I can not find the sound folder in the executable but if it finds it in the IDE

I have a script that does not find the sounds folder when I created the .exe. On the other hand, in the IDE it locates the .wav files without problems. My sound folder is on the same level as the source folder. I do not have errors in the IDE. What…
Fernando López
  • 184
  • 1
  • 11
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
0
votes
1 answer

Java audio won't init TargetDataLine with correct arguments

I have a mic that uses exactly 48000 sample rate, 24 bits, and 1 channel. So I feed this data into AudioSystem.isLineSupported() and get a false. I try feeding in 8 bits instead of 24, and it works. But there's a weird background hiss in the audio,…
Dmitri Nesteruk
  • 23,067
  • 22
  • 97
  • 166
0
votes
0 answers

SourceDataLine buffersize resulting in clicks and stops in playback

I am trying to play back audio I create in realtime in my application with a SourceDataLine. When opening the SourceDataLine with sdl.open(format), it creates a default buffer of 32000 (my sample rate), so effectively one second. But since my…
0
votes
0 answers

How do I stop audio lag in java?

I am making a skype like program. I have a "VoiceChat" class to handle the voice chat connections. I have a "ClientAudio" class to handle the client audio output. I also have a "ClientAudioRec" to handle receiving audio from the server and…
Marcus Mardis
  • 59
  • 1
  • 8
0
votes
0 answers

Why can't I import javax.sound.sampled. when they seem to show in my libraries?

I am trying to use some of the classes from the javax.sound.sampled libraries. But even though, to my novice eyes, the files are there, AndroidStudio won't import them. Is something not set properly? Image of libraries as shown in AndroidStudio
Daniel K
  • 195
  • 1
  • 1
  • 11
0
votes
1 answer

Generated sound played with SouceDataLine is fuzzy

I am trying to generate a set of simultaneous tones in realtime. But all of the sounds the program produces are "fuzzy", or have "static", or even sound like "squealing" in the background. This is especially noticeable in lower pitched sounds. Here…
Daniel Williams
  • 635
  • 7
  • 14
0
votes
1 answer

Java Voice Chat Lag

I am making a voice chat/messenger program and I got voice to work with one person in the chat but when i add a second to it the voices are laggy and cut up. I think the problem is in the Client Audio Receive class. If you don't think it is I will…
Marcus Mardis
  • 59
  • 1
  • 8
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
0 answers

java.lang.NoClassDefFoundError: in javax.sound.samples dependent library Android Studio

I am developing an android based app which process speech. My app references a .jar dependency and I have successfully added that jar as a library in my project but as I run the project it gives me java.lang.NoClassDefFoundError: for an class file…
0
votes
1 answer

Looping Java Audio

I've got my Clip loaded. I can start the Clip using the method clip.start(). However, once the song ends, the clip stops playing (duh). How do I make it loop continously until I call clip.stop()? Clip clip = AudioSystem.getClip(); URL url =…
Lucien
  • 776
  • 3
  • 12
  • 40
0
votes
2 answers

Play audio files in Java

I am trying to play a simple audio file which is in the same directory near the class file. I tried many examples from the internet, but all the others gave me errors which I couldn't even understand. Then I found this, and I am using it now.…
Roshana Pitigala
  • 8,437
  • 8
  • 49
  • 80