Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to p5.sound #31

Open
2 tasks
berinhard opened this issue May 9, 2019 · 0 comments
Open
2 tasks

Add support to p5.sound #31

berinhard opened this issue May 9, 2019 · 0 comments

Comments

@berinhard
Copy link
Owner

berinhard commented May 9, 2019

Pyp5js doesn't support p5.sound. The ideal world would be to have the same API from Javascript "mirrored" to Python. So, for example, the following Javascript code:

function preload() {
  soundFormats('mp3', 'ogg');
  mySound = loadSound('assets/beatbox.mp3');
}

function setup() {
  mySound.play();
}

could be written with Python as:

from pyp5js import *

mySound = None

def preload():
    global mySound
    soundFormats('mp3', 'ogg')
    mySound = loadSound('assets/beatbox.mp3')

def setup():
  mySound.play();

There's an older PR that added support to p5.dom. It can works as a possible guide on how to implement this.

  • Transcrypt mode
  • Pyodide mode
@berinhard berinhard added this to the Release 0.0.5 milestone May 9, 2019
@berinhard berinhard removed this from the Release 0.1.0 milestone Jun 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant