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

Javascript/WebAudio generation requires editing HVCC python source #15

Closed
vulcu opened this issue Dec 5, 2023 · 2 comments
Closed

Javascript/WebAudio generation requires editing HVCC python source #15

vulcu opened this issue Dec 5, 2023 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@vulcu
Copy link
Owner

vulcu commented Dec 5, 2023

Note: this may not be true for all systems/OS, but is true on Windows under the following conditions:

  1. HVCC is run in a virtual environment. The virtual environment is dedicated to the Dahlia project only, and only contains HVCC and its dependent packages.
  2. Only a single Python instance is installed on the system. The PATH contains only a single .../Python/Python<ver> and .../Python/Python<ver>/Scripts directory entry.
  3. The system Python version is 3.12

If HVCC returns Error c2js: [WinError 193] %1 is not a valid Win32 application when running source ./dahlia.sh js, the existing documentation suggests a hotfix by opening the Python script c2js.py located in dahlia/.venv/Lib/site-packages/hvcc/generators/c2js/. Find the three instances where subprocess.check_output() is called in that script, and append shell=True as a second argument to all of those calls. Example:

# First instance, around Line 101 in HVCC v0.9
subprocess.check_output(cmd, shell=True)

# Second instance, around Line 108 in HVCC v0.9
subprocess.check_output(cmd, shell=True)

# First instance, around Line 140 in HVCC v0.9
subprocess.check_output(  # WASM
    cmd + [  # type: ignore
        "-s", "WASM=1",
        "-s", f"EXPORT_NAME='{output_name}_Module'",
        "-o", wasm_js_path
    ], shell=True)

It may be possible to debug the issue further by adding a traceback call in an except block following the first call to subprocess.check_output(), as follows:

# First call to 'subprocess.check_output()', around Line 101 in HVCC v0.9
try:
    subprocess.check_output(cmd)  # run emscripten
except Exception:
    print(traceback.format_exc())
    return
@vulcu vulcu added bug Something isn't working help wanted Extra attention is needed labels Dec 6, 2023
@dromer
Copy link

dromer commented Dec 16, 2023

Happy to accept a PR for this :)

@vulcu
Copy link
Owner Author

vulcu commented Dec 17, 2023

Done! Wasted-Audio/hvcc#151

I think I found the root cause, so we can avoid using 'shell=true'

@vulcu vulcu closed this as completed Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants