Skip to content

Sound only working the first time a sketch is run #23

@Richard-Mullan

Description

@Richard-Mullan

Hi, I have a weird problem with sound in processing.py, I'm not sure if it's a bug or if I'm doing something wrong, but I've had a look around and can't find anyone else mentioning it.
When I first open a sketch, it works perfectly as intended, I hear a nice beating tone. However if I exit and then run the program again, no sound is ever heard. It only works again if I close and reopen processing, regardless of any changes made or not made to the code, ie: making it interactive or anything works perfectly fine so long as it's the first time the sketch has been run.

TL;DR: sound is only audible the first time running a sketch every time processing is opened
Any help greatly appreciated, thanks.

add_library('sound')
def setup():
    global ch_1, ch_2
    size(800,480)
    ch_1 = SinOsc(this)
    ch_1.play(400,1)
    ch_2 = SinOsc(this)
    ch_2.play(401,1)
    
def draw():
    global ch_1, ch_2
    background(255)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Processing.pyIssues specific to using the Sound library in Processing's Python modehelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions