Questions tagged [javax.sound.sampled]

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

98 questions
1
vote
2 answers

Trying to play sound in Java: NullPointerException

I'm trying to play sound in Java but it doesn't work and I got error message. Here is my Code public class PlaySoundClip extends JFrame { public PlaySoundClip() { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setTitle("Test Sound…
1
vote
1 answer

java SourceDataLine sine waves clicks

I want to generate plain sine waves using javax.sound.sampled.SourceDataLine. For one constant frequency, it works fine, but there is always a kind of clicking noise when changing frequency. What am I doing wrong, what can I do to avoid that ? …
Bug Fisher
  • 13
  • 3
1
vote
0 answers

Trying to mute sampled sound

I'm having a problem adding MUTE control. pardon me, I'm a beginner. private BooleanControl muteControl; private Clip audioClip; public void load(String audioFilePath) throws UnsupportedAudioFileException, IOException, …
1
vote
1 answer

mystified with javax.sound.sampled.Clip NullPointerException

mystified with javax.sound.sampled.Clip NullPointerException Running on Eclipse on a Mac. Input wave file exists, Constructor works fine. Object instance is created. Just can't access the instance methods, any of them. Probably a Java 101 issue…
1
vote
1 answer

Cannot do anything while writing to a SourceDataLine

I am somewhat new to audio in Java. What I am trying to do is as I am playing audio, I want to repaint my JComponent, but the SourceDataLine blocks all other lines of code including other Threads. Here is my play() method public void play() { …
user3062600
  • 59
  • 1
  • 5
1
vote
0 answers

Choose sound card channel for output

I am going to output some audio in a java program, to a sound card with multiple chanels (8 channels). For this I want to send different sounds on different channels on the sound card (so it can be played on different speakers) The audio being sent…
TorK
  • 567
  • 2
  • 10
  • 27
1
vote
2 answers

OutOfMemoryError when using Clip java

Solved: I solved it!! I had to increase heap size of my project properties in netbeans ide, not in the netbeans ide configuration itself I have a game application which is very simple, I use a Clip object from javax.sound.sampled package to play a…
katrina
  • 11
  • 2
1
vote
0 answers

Issues Streaming Certain mp3s Using Java Sound and MP3SPI

I'm writing an application in Java using the Java Sound libaray that will allow me to stream music from my personal library to whatever computer I'm on. It's going well. I've success streaming mp3s with the occasional crack or pop. However, on…
SethGunnells
  • 1,269
  • 1
  • 12
  • 19
0
votes
0 answers

converting byte array to alaw (wav) produced bad file in java

I have an existing logic to convert a byte array to alaw (wav) file. We have changed our backend. After this, the conversation starts producing file bad content (noise instead of proper voice) It works well if I save the byte array to an mp3 file…
Abdul Waheed
  • 63
  • 1
  • 10
0
votes
0 answers

I can't find a jar that has javax.sound.sampled

I'm trying to create an UDP voice chat by following an on-line tutorial that requires that I import javax.sound to my code. So I downloaded the javax lib from Java2S, but I can't find javax.sound in the jar file, since it goes from javax.servlet to…
brunocatao
  • 11
  • 1
0
votes
1 answer

Java UnsupportedAudioFileException when creating WAVE file from SourceDataLine

I am sorry about my English. I am trying to create a program that records my speaker audio and saves it to a file. to create a WAVE file from my SourceDataLine I followed the steps in this…
0
votes
1 answer

Converting mp3 to wav in Java

I'm writing a generalized utility for converting audio files to WAV. Works ok for WAV to WAV (I'm also changing some of the attributes), but I can't convert MP3 files. I have mp3spi in my classpath, so it seems to be able to read the MP3, but the…
Peter Kronenberg
  • 878
  • 10
  • 32
0
votes
1 answer

How do I avoid a NullPointerException when stopping and starting a Clip in Java?

I'm making a game in Java and I want a theme song to play in the background, but every time the user presses minus the volume decreases. No matter what I try, I can't do this from another method besides the one where I initialized the Clip because…
0
votes
1 answer

Calculate the level/amplitude/db of audio for two channels

I have read two posts about extracting samples from AudioInputStream and converting them in to dB. https://stackoverflow.com/a/26576548/8428414 https://stackoverflow.com/a/26824664/8428414 As far as I understand byte[] bytes; has structure like…
0
votes
1 answer

Playing audio from my Loop a single time without halting the rest of loop

Let's say I've a main GameLoop Inside this loop I have my Game Updates I'm handling my Events for Sprite collision testing with each Iteration If collision is true, play audio file Here's where the problem occurs The Audio clip will either play…