[linux-audio-user] NoteEdit 2.6.0: MIDI-->multiple voices per staff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 17 Jun 2004, Chris Cannam wrote:

> music, I might get two staffs with eight or nine voices on each.  Not 
> ideal for piano music, then.  That's not too problematic because the 
> default mode in NoteEdit appears to be to edit all voices at once, 
> right?  Can I merge selected voices as well?

Just now I created Beethoven's Sonata No.8 in C-, Op.13 'Pathetique' 
(530 measures)  from:

  http://www.stormloader.com/users/beethoven/midi.htm

The result is: 2 staff with 4 voices each.
I used the TSE3 --> Merge... feature because the MIDI file has
5(!) tracks.

(Unfortunataly, this feature doesn't work in noteedit-2.6.0. I'll fix
this together with Dave Phillips' problems)

The main parts are playable. The problem is the MIDI file:

Beethoven wrote:
         |\            |\            |\            |\            |\            |\   
---------|\------------|\------------|\------------|\------------|\------------|\---
---------|-------------|-------------|-------------|-------------|-------------|----
--|\----/-------|\----/-------|\----/-------|\----/-------|\----/-------|\----/-----
--|\------------|\------------|\------------|\------------|\------------|\----------
--|-------------|-------------|-------------|-------------|-------------|-----------
 /             /             /             /             /             /            


But on MIDI file is:

         |\            |\            |\            |\            |\            |\   
---------|\------------|\------------|\------------|\------------|\------------|\---
----\----|-------------|-------------|-------------|-------------|-------------|----
---\/---/-------------/-------------/-------------/-------------/-------------/-----
---/--------------------------------------------------------------------------------
------------------------------------------------------------------------------------
  \             \             \             \             \             \           
  |             |             |             |             |             |           
  |             |             |             |             |             |           
  |-------------|-------------|-------------|-------------|-------------|

actually distributed over 2 staves. Of course, NoteEdit cannot comprehend this
and computes 2 voices :-(

The reason for the:

  NMidiTimeScale::findPathsInChunk" Error Code is: 1"

is certainly the the TSE3 sustain problem, because the 'Pathetique'
is certainly a good test example.


> How do you decide whether to run this algorithm at all?  I mean, how 
> can you know at the outset whether a track is expected to contain 
> one, two, or several voices?  I imagine you could find a division 
> into "voices" of pretty much any MIDI track with chords in it.
> 
> (pause while I try out the feature)
> 
> Yes, it looks like it runs on every MIDI file --

Yes, indeed: But if all works(?) there shouldn't be unnessesary
voices. Imagine the events are so:

 
pitch 4:          |---ev2--|                               |--ev6--|
pitch 3: |--ev1 --|                                |--ev5--|
pitch 2:         
pitch 1:                           |--ev4----------|
pitch 0:                   |--ev3--|

 |        |        |       |       |       |       | --> time
 0        4        8      16      24      32      40

And PITCH_DIST_COST_FAC = 2 and START_DIST_FAC = 20 then 
according to:

   if (MidiOnTime(j) - (MidiOffTime(i) < 0) {
      costs(i, j) = infinity
   }
   else {
      costs(i, j) = PITCH_DIST_COST_FAC * |(pitch(i) - pitch(j))| +
                    START_DIST_FAC  * (MidiOnTime(j) - (MidiOffTime(i))
   }

the cost matrix is: 


 To:     |  1   |  2   |  3   |  4   |  5   |  6   |
 --------|------|------|------|------|------|------|
 from: 1 |infty |   2  |  86  | 244  | 560  | 722  |
 --------|------|------|------|------|------|------|
 from: 2 |infty |infty |   8  | 166  | 482  | 640  |
 --------|------|------|------|------|------|------|
 from: 3 |infty |infty |infty |   2  | 326  | 488  |
 --------|------|------|------|------|------|------|
 from: 4 |infty |infty |infty |infty |   4  | 166  |
 --------|------|------|------|------|------|------|
 from: 5 |infty |infty |infty |infty |infty |   2  |
 --------|------|------|------|------|------|------|
 from: 6 |infty |infty |infty |infty |infty |infty |
 --------|------|------|------|------|------|------|


The first event is evt1, the last evt6. As you can see the shorest path
from evt1 to evt6 is:

   evt1 --> evt2 --> evt3 --> evt4 --> evt5 --> evt6

The sum is: 2 + 8 + 2 + 4 + 2 = 18

There is certainly no shorter path from evt1 to evt6
in the graph:

       |-------  e1 \----------
       |       / |            |
       |  -- e2--|--  e5 ---- |
       |  |  | \ | /  |     | |
       |  |  | / - \  |     | |
       |--|- e3 -|-- e6-----|-|
          |   \  |  /      /
          \ --- e4 -------

And this computes Dijkstra's shortest path algorithm. Because all
notes are marked in first loop there is no need for a 2nd
loop and all events belong to the one-and-only (and 1st) voice.



As explained above: (If all works correctly) the algorithm computes
multiple voices only if the MIDI events
overlap. If so, such score is produced:



       |\
  -----|-------------- 
  -----/--------------
  --------------------
  --------------------
  -----\--------------
       |
       |

How can I merge this ? Such a way:


       |\
  -----|---------------- 
  ----/|---------|\-----
  -----|---------|------
  -----|---------|------
  ----/---------/-------
        \-----/

Ok, but how to merge this:

      
       |\   |\   |\   |\   |\       |    |\
       |    |    |    |\   |        |    |
 ---|--/----/----/----/----/.-------/----/---|----
 ---|----------------------------------------|----
 ---|----------------------------------------|----
 ---|----------------------------------------|----
 ---|--\---------\-------------\.--------\---|----
       |         |             |         |
       |         |             |         |/

> btw, how does NoteEdit quantize on MIDI import? 

Dynamically! The snap value is computed from MIDI note length.

-- 
J.Anders, Chemnitz, GERMANY (ja@xxxxxxxxxxxxxxxxxxxxxxxxx)

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux