Skip to content

Problems on the execution of BaseHandwrittenPostprocessor #3

@RosiYo

Description

@RosiYo

When using the code provided in this documentation, but replacing the NullPostprocessor with a BaseHandwrittenPostprocessor, two errors arise due to default augmentations applied by the handwritten postprocessor.

  1. Scribbles Augmentation (scribbles.py, Augraphy)
    The scribbles augmentation attempts to use random fonts, which causes a file-writing error if the required fonts directory does not exist. I resolved this by manually creating the fonts directory beforehand.

  2. Ink Generation (inkgenerator.py, Augraphy)
    In the generate_noise_clusters function of the InkGenerator class, the std_range values must be explicitly cast to int before being passed to random.randint. Otherwise, a type mismatch error occurs.

I don't know whether these issues should be addressed within this library or reported upstream to Augraphy. Regardless, here’s the code that triggers the errors:

model = BaseHandwrittenModel()
postprocessor = BaseHandwrittenPostprocessor(rng=random.Random(42))
compositor = DefaultCompositor(postprocessor)
renderer = BitmapRenderer()

# Assume `raw` is a string containing MusicXML data
scene = model(data=raw, format=".musicxml")
compositor.run(scene.pages[0].view_box, dpi=120)
renderer.render(final_layer)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions