Jump to content

Bug in snippet audition and notation of multiple statements?


Recommended Posts

Just an idea for an improvement, no idea how complex this is to fix.

 

Snippet output currently works nicely when selecting an expression that returns a supported format (e.g., OMN), like the following.

(vector-to-pitch '(c4 c5) (gen-white-noise 7))

 

It also works when selecting and then evaluating multiple statements for snippet output, as the following example demonstrates.

(setf pitches1 (vector-to-pitch '(g3 b4) (gen-white-noise 10)))
(setf pitches2 (reverse pitches1))

 

However, other cases result in an error. For example, the following two lines (creating random results, but allowing to fix the seed later in case we like the output) work fine when evaluating and showing their result in the listener.

(setf seed (random 1000))
(setf pitches1 (vector-to-pitch '(g3 b4) (gen-white-noise 10 :seed seed)))

 

By contrast, when selecting both lines together then snippet output results in an error like.

? audition-musicxml-omn-snippet
> Error: The value 976 is not of the expected type list.
> While executing: parse-chord-form-from-stream, in process Listener-3(11).
> Type cmd-. to abort, cmd-\ for a list of available restarts.
> Type :? for other options.

 

As the error message suggested, problematic are seemingly variables that do not bind a list. E.g., this example results in the same error as above when selecting both lines together and generating snippet output, while their normal evaluation and snippet output of only the last line just works fine.

(setf no 10)
(setf pitches1 (vector-to-pitch '(g3 b4) (gen-white-noise no)))

? audition-musicxml-omn-snippet
> Error: The value 10 is not of the expected type list.
> While executing: parse-chord-form-from-stream, in process Listener-3(11).
> Type cmd-. to abort, cmd-\ for a list of available restarts.
> Type :? for other options.

 

Could that perhaps be fixed? Thanks!

 

Best,

Torsten

Link to comment
Share on other sites

Dear Janusz and Stephane,

 

I understand both your points, thanks for your feedback.

 

Still, I think it would be useful if snippet output would work more like the normal evaluation, where after evaluating multiple statements/expressions only the last result is returned. Such an implicit progn is useful behaviour. Many Lisp forms therefore also have an implicit progn (e.g., the bodies of defun, lambda, and let, case, catch, when etc.).

 

It seems that if multiple expressions are selected, then snippet output instead tries to notate/play each of them, resulting in the errors reported above.

 

It seems a simple solution would be to enclose all code for snippet output with a progn, so that snippet output also supports an implicit progn. This would not break any existing functionality, but would fix the reported problem, which then saves time during coding (no need to evaluate multiple lines separates, or to write progn), and avoids unnecessary surprises by newcomers.

 

Best,

Torsten

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy