Pitch detection and change java - java

I'm french so I'm sorry if you have trouble to understand some of my sentences.
Anyways, I saw in some topics that the pitch could be fetected thanks to the Fourier transform
but I didn't really understand how to implement it.
Moreover, I didn't find how to change the pitch of a wav file and if possibl ,a mp3 file
I am listening to music using javaSound for the wav and JLayer for the mp3.
Thanks

Sounds like you're just getting started with audio. Consider using MATLAB or Octave to learn about the Fourier transform. See their respective signal processing packages. The reason I'm suggesting MATLAB or Octave is because it will help you learn faster than Java will. You need to learn about what you want to code before you actually code it. The book DAFX would be a good place to start learning and it also includes sample MATLAB scripts for pitch shifting, and probably detection as well.

Related

How to record/capture audio from any input or program in Java?

I'm working on a little science project, and I really want to record audio from an audio input and a program running on my computer, how to do this in Java? It would be awesome if the bit rate for example is customizable somehow. Files like .mp3 or similar would be awesome, it shouldn't be a problem if it's any different file type, because it could be converted.
I've heard about a Java Sound API but I don't really get how to really record audio with this API.
Thanks in advance,
Tim Visée

How can I play and manipulate .wav files using Java?

I'm looking for a small library to play, merge and change pitch for .wav files.
I've tried JASS, beads, something from anyexample.com, basic javax.sound examples, Sonia Sound Library etc.
Can anyone help me? I just need change pitch, merge and play wav files in Java.
Have you tried the Java Media Framework? Even though it has its limitations, it may be an option. In addition, the wikipedia article (linked above) has a listing of alternatives - maybe one of them does the trick for you.

How to extract audio features in java?

My thesis project is on Audio Feature extraction, their classifcation and comparison.
I am unable to extract the audio features from the last 6months.
I just have an idea that may work.
The audio in any format is to be converted into pcm format and features like bandwidth, Zero Crossing Rate, Noise Frame Ratio, Pitch Strength and mel Frequency Cepctral Coefficients can be extracted from it.
Then a data set is prepared using these features and then various audio classifiaction algoriths are applied to it.
Kindly help how can i proceed further and extract audio features?
Thanx
Although it is a very old post but maybe someone would reach here after googling. Now there are some very good toolkits to use :
TarsoDSP https://github.com/JorenSix/TarsosDSP
OpenSmile http://www.audeering.com/research/opensmile
CMU Sphinx
This is probably too late to be of much help, but you should really look at the jmir project. It's a system for doing audio feature extraction and classification in Java. It's all open source and well documented.

Display sound (.wav/.mp3) as graph in Java

I need to display a graph of a sound file - i.e. a wave form as displayed by audio editors such as Audacity.
How should I go about this? Is there anything in the Java Sound API that can help me?
In Java Sound API poke around AudioSystem.getAudioInputStream
which will return AudioInputStream which shows you how to open audio files form within Java. It is good enough to read .wav files, but not quite so for mp3s.
It lets you read bytes one by one directly. Also getAudioFormat will return object that has sample rate, bit/sample, etc. After reading your waveform you can draw it in your favorite way on the screen (Swing, AWT, png file on the web, etc.).
In the end I found code to do exactly what I wanted in Chapter 10 of the book Swing Hacks.

Playing small sounds in Java game

For the computer game I'm making, I obviously want to play sound. So far, I've been using AudioClip to play WAV files. While this approach works fine, the WAV files tend to be gigantic. A few seconds of sound end up being hundreds of kB. I'm faced with having a game download that's 95% audio!
The obvious option here would be to use MP3 or Ogg Vorbis. But I've had limited success with this - I can play MP3 using JLayer (but it plays in the same thread). As for Ogg, I've had no luck at all. Worse, JLayer's legal status is a bit on the dubious side.
So my question is to both Java developers and generally people who actually know something about sound: What do I do? Can I somehow "trim the fat" off my WAVs? Is there some way of playing Ogg in Java? Is there some other sound format I should use instead?
You could use JOrbis library to play back OGG music. For working sample usage you can look at these files here.
I also experimented with some lossless audio compression, for example I had a 16 bit mono sound. I separated the upper and lower bytes of each sample and put them after each other. Then I applied a differential replacement where each byte is replaced by its difference from the last byte. And finally used GZIP to compress the data. I was able to reduce the data size to 50-60% of the original size. Unfortunately this was not enough so I turned to the OGG format.
One thing I noticed with 8 bit music is that if I change the audio volume, the playback becomes very noisy. I solved this problem by upsampling the audio data to 16 bit right before the SourceDataLine.write().
These may be outdated, but they are officially recognized by the Xiph.org team (who maintain Ogg and Vorbis, among others).
http://www.vorbis.com/software/#java
The problem you describe is addressed by the Service Provider Interface (SPI) for sound in Java. The result is that simply adding JAR files to your classpath will add functionality to the default Java Sound API. Thus enabling the handling of more sound formats without changing code.
Last time I tried this the Javazoom people offered a working MP3 SPI JAR. Which was based on the JLayer you mentioned.
For Vorbis OGG there now also seems to be an SPI library. Check out the docs on the Vorbis SPI on Javazoom.
If you decide to stay with wav format...
It is probably not very important to have high quality sound files. You can use your favorite wav editor to lower the bit rate, switch to mono, or both. That will save tons of space and you won't notice the difference in quality while playing the game.
Hope this helps.

Categories

Resources