csounddart 0.0.8 copy "csounddart: ^0.0.8" to clipboard
csounddart: ^0.0.8 copied to clipboard

outdated

Dart unified interface to Csound API for Web, Desktop and Mobile. It allows to use Csound audio synthesis engine, with a simple and unified API.

csounddart #

An Dart interface to Csound API. The intention of this project is to provide an unified API for creating applications with Flutter and Csound - whatever the target is (Linux, MacOS, Windows, Web, Android, iOS... and probably Fushia in the future). It is currently under development. It has been tested on Linux and Windows and Android, and should work easily on MacOS (with a few path resolution work). The web version is likely to be working soon.

On desktop platforms, it assumes Csound is already installed on your computer. On Android it will download and install Csound library in the application bundle.

Getting Started #

import 'package:csounddart/csound.dart';

//Create the Csound object
Csound _cs = Csound();
// Compiles Csound CSD text and gets the return value
int res = await _cs.compileCsdText(_myCsdText);

// Reads a piece of score
int res = await _cs.readScore(_myScore);

// Compiles from path
int res = await _cs.compileCsd(_myCsd);

// Compiles Orchestra
int res = await _cs.compileOrc(_orchestra);

// threaded performance
_cs.perform();

// pauses or restart performance
_cs.perform(bool);

// set a channel value
_cs.setControlChannel("channelName", (double)value);

// set a callback. The passed method will be called at every k-pass.
_cs.setControlChannelCallback("channelName",
    (double v) {
        // do something with callback
    }
);

// Audio callback
_cs.setAudioChannelCallback("audioChannelName", (){
    (ConcurrentBuffer buf) {
        for(int i = 0; i < buf.length; i++) {
            double value = buf.get(i);
        }
    }
});

// retrieves a control channel value
double channel = _cs.getControlChannel("channemName");

// Gets values from Csound
int ksmps = await _cs.getKsmps();
int nchnls = await _cs.getNchnls();
int sr = await _cs.getSr();
int dbfs = await _cs.get0dbfs();

// Stops Csound and resets it
// For memory management reasons, this method must be called (to free buffers memory)
_cs.stop();

Platforms : to do #

Linux #

  • All done

Windows #

  • Working fine.

MacOS #

  • Path resolution
  • Bundle audio_utilities (ConcurrentBuffer.cpp) library with the plugin
  • Make sure CsoundLib64 is loaded correctly

Web #

  • The project is working in a Flutter application, if the user adds CsoundObj.js and CsoundDart.js as scripts in the index.html file. Though, dynamic loading those files from the plugin still doesn't work.
  • It probably works if copying CsoundObj.js and CsoundDart.js in web folder of the application, and including them as <script> in html.

Android #

  • Working fine with Oboe.

iOS #

  • Not even tried yet.
9
likes
0
pub points
17%
popularity

Publisher

unverified uploader

Dart unified interface to Csound API for Web, Desktop and Mobile. It allows to use Csound audio synthesis engine, with a simple and unified API.

Repository

License

unknown (LICENSE)

Dependencies

ffi, flutter, flutter_web_plugins, js, path

More

Packages that depend on csounddart