denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] MIDI Import (Was Re: Release 2.0.6)


From: Richard Shann
Subject: Re: [Denemo-devel] MIDI Import (Was Re: Release 2.0.6)
Date: Tue, 29 Mar 2016 09:48:21 +0100

On Mon, 2016-03-28 at 23:33 -0500, Jeremiah Benham wrote:
> I have attached a file one example of what I would like to be able to
> import. It does not seem to have the rhythms correct and it did not
> set the staff midi properties to channel 10.
> 
> 
> Another type of file would have overlapping voices in the same
> channel. It would be the midi equivalent to you pressing and holding a
> note in your right hand 1 finger and then simultaneously playing other
> notes with your other fingers and then finally releasing the held
> note. I will see if I can dig one of these files up. 
> 
>   
> 
>  
>         Your current algorithm for automatic import already has some
>         quantization procedure in it IIRC.
> 
> 
> I remember doing something like that. We need a dialog to ask us what
> will be the smallest note value allowed. Also we have no way to detect
> triplets I don't think. 

I just looked over what the Guided MIDI Import does. The main script had
fallen victim to bit rot - it seems that a sequence of defines can no
longer be used to sequentially initialize stuff, instead let* is needed,
so I have updated that.
It looks like I pushed this stuff as far as trying to decipher the
durations - see this line

//#define formula(n) ((vals[n+1]+vals[n])/2) // ad hoc formula, nothing really 
works for guessing durations.

in src/export/guidedimportmidi.c
Using guided import I could see notes in track 6 of your .midi file, but
it gave tiny durations for them, not knowing what it should look like I
couldn't guide it by inputting durations.

This guided import code could be altered from a guided system to an
automatic system if some way of determining durations could be found. 
The general stategy is that tracks are imported from the MIDI file into
a structure called "recorded_midi_track". (So called because it is the
same structure that is used if you record MIDI from your MIDI controller
while playing back - the recorded MIDI events go into this
recorded_midi_track and this is attached to the smf for playback
purposes).
I see a whole bunch of scheme primitives defined
(src/scripting/scheme_identifiers.c):


  install_scm_function (1, "Takes an integer, Sets the number of ticks (PPQN) 
for the object at the cursor, returns #f if none; if the object is a chord it 
is set undotted", DENEMO_SCHEME_PREFIX "SetDurationInTicks", 
scheme_set_duration_in_ticks);
  install_scm_function (1, "Takes an index, returns the time in seconds, time 
signature and tempo in seconds per quarter note of the index'th MIDI tempo 
event in the recorded MIDI stream.", DENEMO_SCHEME_PREFIX 
"GetRecordedMidiTempo", scheme_get_recorded_midi_tempo);
  install_scm_function (1, "Takes an track number 1,2 ..., makes that MIDI 
track of the loaded MIDI stream the current recorded track.", 
DENEMO_SCHEME_PREFIX "GetImportedMidiTrack", scheme_get_imported_midi_track);
  install_scm_function (0, "Delete the current imported/recorded MIDI track 
fails if playing, returning #f.", DENEMO_SCHEME_PREFIX "DeleteImportedMidi", 
scheme_delete_imported_midi);
  install_scm_function (0, "Returns the MIDI track number of the current 
imported track.", DENEMO_SCHEME_PREFIX "GetCurrentMidiTrack", 
scheme_get_current_midi_track);
  install_scm_function (0, "Returns the number of MIDI tracks of the 
loaded/recorded MIDI.", DENEMO_SCHEME_PREFIX "GetImportedMidiTracks", 
scheme_get_imported_midi_tracks);
  install_scm_function (0, "Returns the duration in seconds of the recorded 
MIDI track or #f if none", DENEMO_SCHEME_PREFIX "GetRecordedMidiDuration", 
scheme_get_recorded_midi_duration);

But if someone has already invented this wheel, it might be better to
use their work...


Richard







reply via email to

[Prev in Thread] Current Thread [Next in Thread]