csounddart 0.0.9 copy "csounddart: ^0.0.9" to clipboard
csounddart: ^0.0.9 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.

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();

// 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
    }
);

// 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
_cs.stop();

Platforms : to do #

Linux #

  • All done

Windows #

  • Working fine.

MacOS #

  • Path resolution
  • Bundle audio_utilities 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.

Android #

All experiments drove me to Selinux policy issues "avc-denial". Still trying to figure out. It might be due to the output driver not being used (oboe, opensl, ...). One possibility could be to create a C++ class AndroidCsoundDart, that accesses both Csound and let's say Oboe, setting RtOutputCallback (etc). Then link this class with Cmake to libcsoundandroid, liboboe etc... The second possibility would be to wrap CsoundAndroid (Java) with Platform Channels in Dart.

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