3

I'm new to this field, so kindly requesting your help. Are there any C# libraries that could extract piano chords from a polyphonic music file? I want to create a midi file using this piano chords. Is it possible? If you can point me to any open source software also fine.

Thanks in advance. Shereen

shereen
  • 39
  • 3

2 Answers2

2

This is not a trivial problem with a "the library you want is here" answer.

You are going to have to start getting familiar with what a Fast Fourier Transform is, and there are various libraries that implement those. FFTs can translate time-dimension data like a music file, to frequency-dimension data. You could use an FFT algorithm to convert the music file, look for frequency peaks, try to map them to notes and chords.

Here is a wikipedia entry showing what Fourier analysis is and examples of what it can be applied to.

Here is a SO answer for someone looking for a C# FFT library

Not easy at all - good luck.

Community
  • 1
  • 1
iandotkelly
  • 9,024
  • 8
  • 48
  • 67
1

EDIT: As recursive pointed out, you're not simply looking for a way to read/write midi files. I misunderstood. If you're trying to extract notes from a mp3/wav file, you won't have much luck finding any library that does that. It's not as simple, since you're working with essentially analog data instead of digital. I've seen some application that will at least show you a spectrograph of your audio, and if the audio is clean enough and only a single instrument, you can see what appears to be the notes. But you'd have to figure it all out manually. Izotope RX was the VST I was thinking of.

I had this problem maybe 5 or 6 years ago and eventually started writing my own (not as easy as it sounds). I got something working to read, but not write, but eventually ran out of time to work on the project.

I would try NAudio. I can't specifically vouch for it, as I haven't personally used it. However, the feature list says it has extensive support for reading and writing MIDI files.

Christopher Currens
  • 29,917
  • 5
  • 57
  • 77
  • I think the asker is looking to extract note data from digital audio sources, not MIDI. It is significantly more difficult. – recursive Jul 27 '11 at 16:41