Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
How to convert the sound recorded in to musical notes using MIDI.
Posted
Comments
Sergey Alexandrovich Kryukov 17-Jan-12 0:00am    
Please don't re-post. It cannot help you. We already discussed this problem when I answered your previous question. Now you are adding, DirectX, VS, etc. This is all irrelevant. This is a complex mathematical problem which you probably did not realize. Why adding unrelated poorly technical harness? This is the problem of spectral analysis and image recognition. Can you deal with that all? Quick Questions & Answers cannot help you in principle. This is a matter of education in mathematics and special fields.

As to MIDI, in this format the problem of musical notation is already solved. In fact, MIDI is simply a form of musical notation in equal temperament. It's not clear what's the problem here.
--SA
chaiein 17-Jan-12 4:06am    
SAKryukov I dont think u r understanding my requirement. When i select a song i should be able to write corresponding musical notes like c,c#,B,B# ...while playing that song.
Sergey Alexandrovich Kryukov 17-Jan-12 19:28pm    
I understand your requirement perfectly and already provided you an answer.
--SA

Sorry, your questions and comments (please see above) suggest that such problem is well above your head. You need to pick much simpler assignment.

Let's start from the input which is other than MIDI. The input is the digitized (sampled) dependency between the current in the coil of the speaker and time. In this output, there are no notes per se, there are no even frequencies. In the real-like musical samples, the situation is even very far from a set of mixed frequencies. It's a mess of different sounds and noises and virtually none of them sound for a prolonged period of time so you could simply analyze the set of frequencies. Even it the sounds were not digitized and you already had an instrument of perfect spectrum analysis, you would not have a spectrum with a finite set of frequencies and phases. Instead, you would get a continues spectrum, without discrete frequencies. This is a result of well-known theory of Fourier transform. Even if you try to create a perfect sine sound, it will have a continues spectrum with infinite set of frequency if you try to limit it in time. Digitization makes this problem more difficult. You need to try to recognize all this mess into a set of frequencies corresponding to the pure musical tones of equal temperament (or any other system). You need to get a picture abstracted from a lot of detail, suppress/ignore the noises, etc. Theoretically, this is not always possible (not every noise could be interpreted as musical). And even when it is possible from the point of view of human perception, it is extremely difficult. This is a very difficult combination of Fourier Analysis and image recognition, http://en.wikipedia.org/wiki/Fourier_analysis[^], http://en.wikipedia.org/wiki/Image_recognition#Recognition[^].

Are you familiar with any of these fields? Each is a whole piece of education, each is much more than reading of some articles and even a book. And even if you are educated in this fields, this is not enough to approach this problem. A while ago I tried several pieces of Open Source software trying to solve this problem and found that their quality is very poor, they could analyze only very simple record which a lot of errors. I can imaging that a very high quality product might exist and work well on many non-trivial samples, but that should really be a top-notch technology. You don't realize it, not even close, as you keep talking about "requirement" and "A, B, C#…".

The opposite end is MIDI. MIDI sequence of file has no sounds. It is practically already composed of notes. More exactly, this is description of the sequence of events. Imagine the description of piano play. Each MIDI event essentially describes which a piano key is pressed or released at what time and how loudly it is played. The whole play combines several instruments playing at the same time and can include more complex detail such as bending (like with a guitar or an electronic piano wheel), percussion and more. All you need to do is just the knowledge of MIDI format and ability to parse the file; it also requires basic knowledge of musical theory, just the trivial part of it. This problem is nothing compared to the recognition problem described above.

I have a feeling that I waste my time. I only hope some reasonable readers could find this elementary introduction to the problem interesting.

—SA
 
Share this answer
 
v2
Comments
Albert Holguin 17-Jan-12 20:11pm    
It is definitely a good description of the problem he's trying to face and how hard it really is for a new dev to try to take on... +5

I'm an Electrical Engineer, so I definitely understand the complexity of what he's trying to accomplish, not trivial by any means...
Sergey Alexandrovich Kryukov 18-Jan-12 1:01am    
Thank you, Albert.
--SA
chaiein 17-Jan-12 23:56pm    
Hi Thank you for all the information and spending time on this.it has not become waste but i got know complexity of the problem :)
Sergey Alexandrovich Kryukov 18-Jan-12 1:01am    
Excellent, I'm quite happy with that.
Thank you and good luck,
--SA
In musical terms....you might split the music stream into separate frequencies which relate directly to the key or scale hoping the data you require takes up a fair proportion of that band.
Or if you are really lucky the data you require might be a fair proportion of one stereo channel. But each case is still a needle in a haystack. Programs exist for this but not very effective. Usually you have to take out unwanted noise very low and very high frequencies clicks and percussion and sometimes remove unwanted stereo or quad channels first. Then remove low volume data so that hopefully you have the essence of the melody.
Ian
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900