For the PythonObject, instead of using a print command to stdout to bring things back into blue, you simply assign the variable


to the text string of your generated notes. when the PythonObject is done processing, blue gets whatever value is assigned to that variable and parses it as a text score, then proceeds to do the standard operations of scaling and translating the notes in time, then applying any noteProcessors which may have been added to it.

Also, should you need, the variable


is assigned the value of the subjective duration of the PythonObject on the timeline.

So, within your scripts, you have access to the duration of the SoundObject should you want to make your script use that for any purpose you might have. one example might be that you have a score generating function that depends on duration, maybe if it has less duration it produces notes with louder amplitude and than if it has a longer duration.