Code Monkey home page Code Monkey logo

faust2sc.py's Introduction

This is now part of faust

See grame-cncm/faust#689

For more info. Any contributions and issues on this should be addressed in the faust repo.

faust2sc.py

This repo contains a script - faust2sc.py - for compiling https://github.com/grame-cncm/faust files to SuperCollider plugins.

It is a rewrite and replacement of the original faust2sc (for converting faust files to SuperCollider-class files) and faust2supercollider (for compiling scsynth and supernova object files). The main goals have been to make the script easier to use and to maintain by rewriting it in Python (as opposed to Ruby+Bash) using standard Python modules. Additionally, this script combines what was formerly split into two scripts into one script that does both things and tries to be smarter about the converted plugins' names, supercollider header paths etc.

This will eventually end up as a pull request to be included with faust

Requirements

The script uses only built in Python modules, but python version =>3.8 is needed.

Usage

Download this repo.

Change permissions of the script:

chmod +x faust2sc.py

Here's an example where the faust file testfile.dsp is compiled as a scsynth and supernova plugin and placed in the userExtension directory of a linux machine:

./faust2sc.py testfile.dsp -s -t $HOME/.local/share/SuperCollider/Extensions/Faust/

See the help screen for more info:

./faust2sc.py -h

faust2sc.py's People

Contributors

jpburstrom avatar madskjeldgaard avatar smrg-lm avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

faust2sc.py's Issues

declare'd names with - and _ in them lead to wrong objects

declare name	"Sirius_5h5p_allrad";

leads to this error in Supercollider once the server is booted and the UGen is instantiated:

exception in GraphDef_Recv: UGen 'Sirius5h5pallrad' not installed.
*** ERROR: SynthDef temp__0yo-1600951377_1008 not found
FAILURE IN SERVER /s_new SynthDef not found

Document minimum python version

While trying to get this to work, I found my python version was outdated. Apparently python 3.8 is needed for the shutil.copytree commands to work (more specifically the dirs_exist_ok argument).

So a fix would be to either document that python 3.8 is needed, or make a workaround to support older versions. Here's a discussion about how to work around this pre-3.8 limitation of copytree: https://stackoverflow.com/questions/1868714/how-do-i-copy-an-entire-directory-of-files-into-an-existing-directory-using-pyth

Question

Hi Mads

Would you like me to change the "%s" % variable format by f"{variable}" along the code? It would be more concise and readable code. I already did that while trying to change the use of os.path to make path to work on Windows, but Faust generated paths themselves aren't scaped or converted to that platform (and generated code don't check libraries availability and alternatives).

Audio input missing from class file

I'm not sure if this is me doing something wrong, but I can't get the generated class files to include the inputs to the faust process. The faust file below generates *ar/*kr-methods with only one argument, cutoff. The faust2supercollider script from the faust distribution prepends an in1 argument. What can be the problem here?

Faust file:

import("stdfaust.lib");
freq=vslider("cutoff",500,20.0,20000,1);
process= _: ve.wah4(freq) : _;

Generated class file:

Wah4 : UGen {
    *ar{|cutoff(500)| 
      ^this.multiNew('audio', cutoff)
    }

    *kr{|cutoff(500)|
      ^this.multiNew('control', cutoff)
    }
...
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.