tags:

views:

143

answers:

1

Hi

I need to extract musical features (note details->pitch, duration, rhythm, loudness, note start time) from a polyphonic (having 2 scores for treble and bass - bass may also have chords) MIDI file. I'm using the jMusic API to extract these details from a MIDI file. My approach is to go through each score, into parts, then phrases and finally notes and extract the details.

With my approach, it's reading all the treble notes first and then the bass notes - but chords are not captured (i.e. only a single note of the chord is taken), and I cannot identify from which point onwards are the bass notes. So what I tried was to get the note onsets (i.e. the start time of note being played) - since the starting time of both the treble and bass notes at the start of the piece should be same - But I cannot extract the note onset using jMusic API. For each note it shows 0.0.

Is there any way I can identify the voice (treble or bass) of a note? And also all the notes of a chord? How is the voice or note onset for each note stored in MIDI? Is this different for each MIDI file?

Any insight is greatly appreciated. Thanks in advance

+1  A: 

You might want to have a look at this question: http://stackoverflow.com/questions/2467995/actual-note-duration-from-midi-duration

Where a possible approach to extracting notes from a midi file is discussed.

Consider that a MIDI file can be split on multiple tracks (a "type 1" midifile).

Once you have identified notes, identifying chords can still be tricky. Say you have 3 notes: C, E, G happening "at the same time" (i.e. having been identified as being sound at the same point in a measure). When are they to be considered the C major chord?

  • played on the same channel
  • played by the same instrument (even if on different channels)
  • played on the same channel even if they appear on different tracks

Midifile format is very simple (maybe even too simple!!) I suggest you have a look at its description here: http://duskblue.org/proj/toymidi/midiformat.pdf

Remo.D
Thanks for the insight Remo. I'm going through your links - need a little time to get it all right.I'm doing this only for the piano-so single instrument-same channel. So if 2 notes are played together (in treble and bass), are the 2 notes in the same channel? Then for a chord also-all notes in a chord-are they in the same channel/ track? Is this same for all MIDI files, or does it differ for each MIDI file-depending on how it's written into MIDI? Also what's the difference between track and channel? In the mean time, I'll read up on the MIDI spec.Advance thanks
Dolphin
The Midifile has no notion of "treble" or "bass" staves. Note 60 is the middle C (the one between the bass and the treble staves in a score) you place the other notes accordingly. Notes need not to be on the same channel nor in the same track, it depends on how the midifile has been created. It sounds more complicated than it really is. If you don't want to deal directly with bits and bytes, you can use a midi-to-text utility and do your analysis on a textual representation of the midifile. You can find one of such tools here: http://www.midiox.com/ (look for "text to midi" in the page)
Remo.D
Hi Remo - can you pls suggest a starting point to extracting note onset from midi? What you suggested - can this be approachable from Java Sound API? or do I have to code from scratch? I need to find a way for a start first. Apologies for the delay to comment on and for bothering. Thanks in advance.
Dolphin