Questions tagged [javax.sound.sampled]

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

98 questions
32
votes
5 answers

javax.* cannot be imported in my Android app?

I'm trying to import some javax.* classes in my android app, but I keep getting compiler errors inside Android Studio. I'm using Ubuntu Linux 13.04. Here are my imports: import android.os.Bundle; import android.app.Activity; import…
Tux
  • 1,896
  • 3
  • 19
  • 27
20
votes
2 answers

How do I use audio sample data from Java Sound?

This question is usually asked as a part of another question but it turns out that the answer is long. I've decided to answer it here so I can link to it elsewhere. Although I'm not aware of a way that Java can produce audio samples for us at this…
Radiodef
  • 37,180
  • 14
  • 90
  • 125
18
votes
1 answer

Sudden delay while recording audio over long time periods inside the JVM

I'm implementing an application which records and analyzes audio in real time (or at least as close to real time as possible), using the JDK Version 8 Update 201. While performing a test which simulates typical use cases of the application, I…
Fabian B.
  • 321
  • 1
  • 2
  • 9
8
votes
2 answers

How to calculate the level/amplitude/db of audio signal in java?

I want to create a audio level meter in java for the microphone to check how loud the input is. It should look like the one of the OS. I'm not asking about the gui. It is just about calculating the audio level out of the bytestream produced by n =…
AliceInChains
  • 167
  • 1
  • 1
  • 9
8
votes
2 answers

Any supported sound formats for Java on Windows 7?

We'll, I've been beating my head against a wall trying to get Java to play some simple wav files without any luck. I've tried this code: Clip clip = AudioSystem.getClip(); AudioInputStream inputStream = AudioSystem.getAudioInputStream(new…
3
votes
2 answers

Play 2 different frequencies alternatively in Java

I am a newbie in Java Sounds. I want to play 2 different frequencies alternatively for 1 second each in a loop for some specified time. Like, if I have 2 frequencies 440hz and 16000hz and the time period is 10 seconds then for every 'even' second…
Vibhav Chaddha
  • 431
  • 7
  • 15
3
votes
0 answers

javax.sound.sampled - trying to start audio sample repeatedly doesn't work

I am programming a little drum sequencer, a roland tr808 knockoff with 16 steps/measure and 16 instruments(=drum samples). User has a gui where he can thus create a 16x16 pattern. However, if a sample is played more than once in quick succession, it…
3
votes
1 answer

Capture 8kHz, 16-bit Linear Samples with 4 frames of 20ms audio in each RTP Packet

I need to write simple Java Client program to capture live audio streaming. Requirement RTP Audio Packets. 8kHz, 16-bit Linear Samples (Linear PCM). 4 frames of 20ms audio will be sent in each RTP Packet. After some search I found sample code on…
Ashish Jagtap
  • 2,799
  • 3
  • 30
  • 45
3
votes
1 answer

Exception in reading an MP3 file through AudioSystem.getAudioInputStream(file)

I am trying to read an MP3 file through class javax.sound.sampled.AudioSystem but I am getting an UnsupportedAudioFileException. My code trying to read the audio file looks like:- AudioInputStream audioInputStream = …
Vineet Tyagi
  • 300
  • 1
  • 15
3
votes
2 answers

Concatenation of two WAV files failed

I have this simple code to concatenate two wav files. Its pretty simple and the code runs without any errors. But there is a problem with the output file. The output file generated does not play, and surprisingly its size is only 44 bytes whereas my…
Nick Div
  • 5,338
  • 12
  • 65
  • 127
3
votes
3 answers

Java Voice Chat - Mixdown Incoming Data for Single Output

I am trying to write a Java voice chat application, and have achieved echo capabilities, but when trying to connect multiple clients, I am stuck. I understand that you cannot iterate through sockets and send the data to everyone connected without…
zgillis
  • 175
  • 3
  • 14
2
votes
1 answer

Updating the Application Thread in JavaFx to Draw Nodes

I'm developing a program that will be able to draw the audio waveform using the streamed amplitude data from a microphone or Line-in. The way I thought to do this would be to draw each point from the sample data at a rate equal to the sample rate,…
2
votes
0 answers

Control 8 channel surround sound on external USB audio card in Java, Windows 10

Summary: How do I access all 8 surround channels on my external USB Audio soundcard when I can't find them through the javax.sound.sampled Sound API in Java, but the underlying Windows 10 can use them? I need a strategy to access all 8 channels from…
spl
  • 510
  • 4
  • 15
2
votes
0 answers

Android sound processing

I have a Java application that computes the MFCC coefficients of an audio file by reading it into an AudioInputStream object and then writing it into a Byte array. public double[] convertsignal(File signalfile) throws UnsupportedAudioFileException,…
AkshayeAP
  • 17
  • 3
2
votes
1 answer

Reverse playback,java

I do need you help. How can I adjust the following code in order to play a .wav file backwards? Any help will be very much appreciated..Thanks. Carlos import java.io.*; import javax.sound.sampled.*; public class WavPlay { public static void…
carlos
  • 21
  • 1
  • 2
1
2 3 4 5 6 7