javasound

Convert audio stream to WAV byte array in Java without temp file

Given an InputStream called in which contains audio data in a compressed format (such as MP3 or OGG), I wish to create a byte array containing a WAV conversion of the input data. Unfortunately, if you try to do this, JavaSound hands you the following error: java.io.IOException: stream length not specified I managed to get it to work b...

JavaSound writing to audio file with a stream

I'm attempting to create an audio filter using the JavaSound API to read and write the audio files. Currently my code is structured as follows: ByteArrayOutputStream b_out = new ByteArrayOutputStream(); // Read a frame from the file. while (audioInputStream.read(audioBytes) != -1) { //Do stuff here.... b_out.writ...

How to sample multi-channel sound input in Java

I realised this might be relatively niche, but maybe that's why this is good to ask anyway. I'm looking at a hardware multiple input recording console (such as the Alesis IO 26) to take in an Adat lightpipe 8 channel input to do signal processing. As I have yet to acquire the device and need to work out whether this is feasible (budgetar...

manipulating audio and drawing waveform using java sound in real-time

I am currently developing an application that helps the user to tune his guitar and generate guitar effects. This is in real-time. I've been looking through java applications that could give an idea to generate guitar effects such as overdrive and delay but I couldn't find any. Also a source on creating a waveform in real time is needed....

how can I wait for a java sound clip to finish playing back?

I am using the following code to play a sound file using the java sound API. Clip clip = AudioSystem.getClip(); AudioInputStream inputStream = AudioSystem.getAudioInputStream(stream); clip.open(inputStream); clip.start(); The method call to the Clip.start() method returns immediately, and the system playbacks the sound...

Java AudioSystem and TargetDataLine

I am trying to capture audio from the line-in from my PC, to do this I am using AudioSystem class. There is one of two choices with the static AudioSystem.write method: Write to a file Or Write to a stream. I can get it to write to a file just fine, but whenever I try to write to a stream I get thrown java.io.IOException (stream length n...

Convert Midi Note Numbers To Name and Octave

Does anybody know of anything that exists in the Java world to map midi note numbers to specific note names and octave numbers. For example, see the reference table: http://www.harmony-central.com/MIDI/Doc/table2.html I want to map a midi note number 60 to it's corresponding note name (MiddleC) in octave 4. I could write a utility cl...

Noise in background when generating sine wave in Java

I'm getting a slight distortion (sounds like buzzing) in the background when I run the following code. Because of its subtle nature it makes believe there is some sort of aliasing going on with the byte casting. AudioFormat = PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, big-endian Note: code assumes (for now) that the data is ...

where can I submit a bug report concerning the FOSS Java Sound implementation org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine?

I'm pretty confused by the distinctions between Sun's OpenJDK, IcedTea, GNU CLASSPATH, and the version of OpenJDK distributed by Linux distros. So to keep it simple, where can I submit upstream bug reports on org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine? Thanks for your help. ...

Converting the sample rate on-the-fly when reading a WAV file into a samples array with Java

I've got a collection of short WAV files that I would like to process in Java using various digital signal processing algorithms. I need to get an array of int valued samples for this purpose, encoded at the 11025 Hz frame rate. The source files have several different sample rates, including 11025 Hz and 44100 Hz. Here's the code I'm tr...

Java playing sounds. Is there a default system sound?

Hi I am trying to write an application that will play morse code. I just wanted to know if there was a default system sound in java like some beep, or do I have to download some sound file from the internet? ...

Internet audio player from java swing client ?

Im trying to implement and realtime audio streaming swing desktop app . trying to get bytes of audio using java.net classes and then feeding it to play . Just trying blind punches undersea water thinking the water tank will crack :(( help or any suggestion ? ...

How to extract audio from a video file and make it as JavaSound AudioInputStream?

I know JMF needs to be used to deal with video, but the JMF api is very confusing and difficult to understand. I saw something like this but what I want to do is the opposite I think. ...

Converting raw bytes into audio sound

In my application I inherit a javastreamingaudio class from the freeTTS package then bypass the write method which sends an array of bytes to the SourceDataLine for audio processing. Instead of writing to the data line, I write this and subsequent byte arrays into a buffer which I then bring into my class and try to process into sound. M...

getAudioInputStream can not convert [stereo, 4 bytes/frame] stream to [mono, 2 bytes/frame]

Hello. I am using javasound and have an AudioInputStream of format PCM_SIGNED 8000.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian Using AudioSystem.getAudioInputStream(target_format, original_stream) produces an 'IllegalArgumentException: Unsupported Conversion' when the target_format is PCM_SIGNED 8000.0 Hz, 16 bit, mono, 2 bytes...

Audio clip getting stuck

I am seeing some strange behaviour with Clip instances in Java. The purpose of the class I am working on is to keep count of the number of Clip instances containing the same sound sample (indexed by URI.) When the application requests to play a clip and there are already three or more clips from the same source already playing, the fol...

Java game sounds in applications (as in, NOT applets)

Hi all, I have two questions - (1) How to play small sound clips, e.g. saucer flying, bullets shooting, things getting hit with bullets, etc. Very short, but real-time, sounds. I like the old arcade sounds, so they need not be largess .wav's. I want to run these in as little code as possible. Which leads to my second questio...

Acoustic echo cancellation in Java

I'm implementing a VOIP application that uses pure Java. There is an echo problem that occurs when users do not use headsets (mostly on laptops with built-in microphones). What currently happens The nuts and bolts of the VOIP application is just the plain datalines of Java's media framework. Essentially, I'd like to perform some digita...

Play variable tone with Java?

Hi, all. Back in my high school Pascal class, I had a fun little program that would take in an integer and then play a tone using the system speaker. The pitch of the tone would vary, based on the int. Does functionality like this exist in the Java world? Would an alternative be to pull in a wav or ulaw, and then change the frequency...

Problem with a Java thread that captures sound card data

Hello I have a program which creates a thread that captures data from the soundcard at 48 KHz and writes it to a buffer for collection. The heart of the thread code is as follows .. public void run() { // Run continously for (;;) { // get data from the audio device. getSample(); } } // Read in 2 by...