Provides interfaces and classes for capture, processing, and playback of sampled audio data.
Questions tagged [javax.sound.sampled]
98 questions
1
vote
1 answer
How can I loop a sound without using 'clip' in java before writing it into a file
First of all thanks everyone for helping me with my previous questions.
In the following code I am taking two frequencies alternatively and writing them into a .wav format, to run it in my Windows Media Player, for a specific time given by the…

Vibhav Chaddha
- 431
- 7
- 15
1
vote
0 answers
How to write a generated audio into a .wav format in java
I am very new in Java Sound and therefore my concepts of it are not that strong. I want to understand that how to write the audio generated by the following code into a file of .wav format.
I had read a few posts and some questions on stackoverflow…

Vibhav Chaddha
- 431
- 7
- 15
1
vote
1 answer
javax.sound.sampled.LineUnavailableException on attempt to record sound
I am making a java voice chat program and the server side voice class is throwing this error
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 8000.0 Hz, 8 bit, mono, 1 bytes/frame, not supported.
at…

Marcus Mardis
- 59
- 1
- 8
1
vote
0 answers
Java Voice Chat Error
I am making a voice chat program. I have two servers one for voice and one for messages. When I connect two people I get this error, Thank you in advance. I attached the client code, ClientAudio code and the Client receive…

Marcus Mardis
- 59
- 1
- 8
1
vote
0 answers
Java Voice Server Not Working
I am trying to make a voice server and the server is throwing this error "javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 8000.0 Hz, 8 bit, mono, 1 bytes/frame, not supported.". Here is my code, Thank you in advance
…

Marcus Mardis
- 59
- 1
- 8
1
vote
1 answer
FATAL EXCEPTION: main java.lang.NoClassDefFoundError: external library.jar.class Android studio
I am developing an android app which process speech and I have speech basic project (dependency for android project) ready on JAVA so I compiled JAVA project in eclipse in JAVA 7 compiler and exported that java project as a runnable jar.
I put this…

Prafull
- 31
- 8
1
vote
1 answer
Preventing Java 7/8 sampled sounds from clicking when played (works in 6)
The following code works as expected when run in Java 6 on OSX (it makes NO sound - it plays a sample of silence several times), but when run in Java 7 & 8, at the end of each sample playback, a click appears. Can't fathom why; can't see any obvious…

Matt Gumbley
- 307
- 2
- 8
1
vote
1 answer
Multiple Mixer outputs in Java
I am trying to make Java play different stereo audio in two outputs (front and back audio jacks).
My sound card is configured as to treat both outputs independently, and in the Windows mixer I can make them emit a test sound separately, so it's not…

walljam7
- 343
- 2
- 11
1
vote
0 answers
Java Sound, Converting Percentage Volume to Decibels
I have the following code.
FloatControl volumeControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
// Set the value to modify by in decibels
volumeControl.setValue(float volume);
Get minimum modification value in decibels (e.g.…

Lucien
- 776
- 3
- 12
- 40
1
vote
0 answers
Java - Sounds occasionally play at extremely loud and irregular volume
So, I am making a game in Java and use the following code to play sound effects (gunfire, explosions etc). However, occasionally, a sound effect will play at a very irregular volume, way louder than I intended it to be, even if it normally plays at…

Syd Lambert
- 1,415
- 14
- 16
1
vote
1 answer
Unsupported control type: Sample Rate
So I am trying to get Java play a sound at certain rate in this respect I try to get a Controll for Sample rate for SourceDataLine:
`package com.pap.sound;
import javax.sound.sampled.*;
import java.io.IOException;
import…

Andrei Puf
- 81
- 9
1
vote
0 answers
How to choose mixer and line to get/set volume output?
In my application I want get and set output volume.
I saw examples in internet.
Base problem is find proper mixer and line. I use AudioSystem.getMixerInfo() and mixerInfo.getName(). I am from Poland and have Polish Windows and therefore names are…

AndrzejB
- 41
- 5
1
vote
2 answers
Clip sometimes does not play
I have a Sound class that contains a method that, when called, plays a sound using a Clip object (in this case, clip).
public static void play() {
clip.stop(); // The purpose of the first three lines
clip.flush(); …

null
- 2,060
- 3
- 23
- 42
1
vote
1 answer
Restarting a Clip object - flush() method
The Javadoc for DataLine.flush() states
Flushes queued data from the line. The flushed data is discarded. In some cases, not all queued data can be discarded. For example, a mixer can flush data from the buffer for a specific input line, but any…

null
- 2,060
- 3
- 23
- 42
1
vote
0 answers
Java sampled - Play Raw PCM Wav Data
I'm working with sounds at the moment.
I obtain my byte[]'s by reading a wav file and skipping the first 44 bytes (According to WAV Specification, the data begins at byte 44).
I use 22500Hz and export it via Audacity to 16 bit PCM.
My Method looks…

Raildex
- 3,406
- 1
- 18
- 42