[CM] midifile import

Orm Finnendahl o.finnendahl at mh-freiburg.de
Thu Mar 19 07:38:19 PDT 2009


Ralf,

 I had similar ideas (expecially after reading the Seibel book), but I
abandoned it realising that the lisp code actually seems to get
autogenerated from scheme code. And I guess that can become quite
tricky...

--
Orm

Am Donnerstag, den 19. März 2009 um 15:23:59 Uhr (+0100) schrieb Ralf Mattes:
> On Thu, 2009-03-19 at 14:39 +0100, Orm Finnendahl wrote:
> > Rick,
> 
> Hi everyone,
> 
> > 
> > Am Donnerstag, den 19. März 2009 um 08:06:15 Uhr (-0500) schrieb Rick Taube:
> > > orm i would not want to add anything that actually imports non-standard 
> > > messages.
> > 
> > I certainly agree (and wouldn't do it either).
> 
> > > however perhaps adding control over whether cm actually signals an error 
> > > or just a warning for illegal messages would be useful?
> > > so to import a midifile with bogus messages dropped you would do   
> > > (midi-file-import ...   :strict nil)
> > 
> > Sounds like an excellent idea to me!
> 
> Sorry, but why not use the wonderful features of Common Lisp? Recovering
> from parsing errors/problems seems like the perfect job for conditions
> and restarts. Just define a condition like:
>  
>  (define-condition midifile-error (error)
>    ((message :initarg :message 
>              :accessor message-of 
>              :documentation "Some meaningful error message")
>     (tick-time :initarg :tick-time
>              :accessor tick-time-of
>              :documentation "When in the stream did the parsing error
> happen)
>     (part    :initarg :part 
>              :accessor part-of
>              :documentation "Waht part is messed up")))
> 
> (defun midifile-error (message &key tick-time part)
>    (error midifile-error :message message :part part :tick-time
> tick-ime))
> 
> and then later on use 
> 
>  (midifile-error "Parse time signature: expected 4 byte but only got
> 2" :ticks ticks)
> 
> 
> and add some useful restarts to the parsing code (like ignore-message,
> use-data, abort ...).
> 
>  Cheers, RalfD
>    
> 
> > --
> > Orm
> > 
> > _______________________________________________
> > Cmdist mailing list
> > Cmdist at ccrma.stanford.edu
> > http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist



More information about the Cmdist mailing list