Musical Transcription of Wav Files in Java

I have a project on transcribing music using Java. The fact is that I created an applet that records sound and saves it to a WAV file. The player should play only the part that he / she would like to decrypt, after which I am stuck in this question: I need to get information from the saved WAV file and use this information to create a MIDI file, and after creating the MIDI file I need to create a musical score (notes) and all of these should be done in Java.

I searched everywhere to get a clear explanation of how these things can be done, but I did not find anything direct: (since I am new to Java, I would like someone to help me with this, please, topics that I have programming problems:

  • Getting information about notes played in a WAV file.
  • Knowledge of Notes.
  • Create a MIDI file equivalent to a WAV file.
  • Create a SCORE from a MIDI file.

I also tried the fast Fourier transform after doing the segmentation on the data being read, but I think this happened in a completely different direction :(

Please, if someone can help me on the above topics and how to program them only in Java, this would be very much appreciated :)

By the way, the project:
The player plays the notes on the piano → Records his game → The player receives a SCORE of his game.

+8
java music pitch-tracking
source share
5 answers

I am by no means an expert in this field, so I apologize in advance if this is all rubbish.

To get notes from a file, I think you need to do FFT (Fast Fourier Transform) in a WAV file, but with as little as 10 ms of sound at a time. Then you will find the highest peak on the FFT for this time interval and proceed to the next 10 ms “frame” or the like. You perform FFT again, and if the highest peak is different from the previous peak frequency, then it will say this new note. To find out how long a note is, count the number of peaks within each other's specific threshold and multiply them by the time you use for each frame (10 ms, etc.).

I will say again that I am not an expert, and maybe there are other ways to do this.

Aside, I hope this helps ... even a little.

+3
source share

I am not an expert in this field, but as soon as I played a little with Xuggler (java ffmpeg wrapper). This library is able to extract a lot of interesting data from a media file, allows you to transcode files and many other interesting functions. Here is the link: http://www.xuggle.com/xuggler/

+1
source share

What you want to do is currently impossible. The volume of what you described exceeds any current professional music programs, and they have literally hundreds of man-years of time spent by programmers.

You can achieve something if you radically cut off your demands.

  • to find pitch, use FFT; this is the easiest part; you will have to limit yourself to individual notes here, you will not be able to clean chords.

  • You won’t be able to find out what the signature or speed (bpm) of the melody is - your only chance to include some metronome in your application and make the player stick to the rhythm. If you want to maintain swing time, it must also be configured by the player.

  • When creating midi, summarize all notes (= move their start and end values ​​to the nearest 1/4, 1/8 or 1/16 measurements)

  • use a ready-made dialing system to create an account; music can work for you; generating a tex file will be much easier than drawing for yourself; if I were you, I would ignore some typing rules (I would, of course, cast off the rays, there are many rules regarding them)

If you are limited to a single melody, choose to ignore most of the set of music files, make the piano use your own metronome and limit its rhythmic options, you can succeed.

+1
source share

I had the same idea and tried a very simple but incomplete solution. As noted by fdreger mail, even professional software cannot actually complete this task correctly. (I tried some demos of IntelliScore, AudioScore, and some other programs, and none of them seemed particularly effective when working with polyphonic music)

But if you want to try yourself, I used the source code found here: http://www.psychicorigami.com/2009/01/17/a-5k-java-guitar-tuner/ which helped me figure out how to determine the frequency. (FFT will be more accurate, but more complicated).

To display notes on the screen, I used the abc4j library, which can be found here: http://code.google.com/p/abc4j/

But, as stated above, it only works with monophonic music (one voice).

Good luck

+1
source share

There is a very good open source sound editor called Audacity . Yes, it is written in C ++, but you can find the answers you are looking for in your source code. Translating C ++ code into Java is not so difficult.

0
source share

All Articles