Giter Site home page Giter Site logo

eigmip6's Introduction

eigmip6 - Exploration in generative music in Perl 6

DISCLAIMER

I'm dabbling. The current state works as described below, but the implementation of this module is far from finished. There will likely be noticeable jittering in playback in the current state. Also, it's probably rather loud. Also you currently probably have to terminate a Perl 6 REPL running with eigmip6 with ^C instead of ^D.

What?

This repository contains my humble attempts at building something along the lines of Extempore or SuperCollider in Perl 6, albeit (in contrast to Extempore at least) focused on music. The name is admittedly badly chosen, seeing as neither Extempore nor SuperCollider limit themselves to generative music, but pride themselves with being useful for live coding, which I am trying to emulate.

OK, what's possible?

At the moment eigmip6 supports only the JVM backend of Rakudo. Running eigmip6 works with the following command line execute from the root of this repository

CLASSPATH=3rdparty/jportaudio.jar:3rdparty/jsyn-20150105.jar perl6-j -Ilib -Meigmip6

assuming you have a Rakudo release 2015.01 or newer built for JVM in your path.

Right, so I get the Perl 6 prompt. Great...?

eigmip6 currently exports exactly two subs, two types and an enum. (This is likely to change.) The subs exported are &setGlobalTiming(Num) and &getNoteChannel(Num).

&setGlobalTiming(Num) takes a Num (write literals with scientific notation or coerce with .Num) and sets a global timing for synchronisation of note channels. This function at present always returns True.

&getNoteChannel(Num) takes an interval in milliseconds and creates a Supply which pulls data (i.e. frequencies) from a Channel. This Channel is returned and can be filled with frequency data by the user with the .send() method. Note that incoming data is coerced to Num internally.

The exported enum is Notes, containing the Str literals C Db D Eb E F Gb G Ab A Bb B, which correspond to western musical notation.

The two types currently exported are eigmip6::Note and eigmip6::Scale. Suffice it to say that Note takes :name and :freq, the former is expected to be an element of the enum Notes, the latter a Num. Scale takes a :root, which has to be a Note and :steps which has to be an array of note steps that make the scale including a 0 step as the first step except if you want to leave out the root for some reason.

An example session:

$ CLASSPATH=3rdparty/jportaudio.jar:3rdparty/jsyn-20150105.jar perl6-j -Ilib -Meigmip6
> setGlobalTiming(1000e0);
Jan 25, 2015 2:08:21 AM com.jsyn.engine.SynthesisEngine start
INFO: Pure Java JSyn from www.softsynth.com, rate = 44100, RT, V16.7.4 (build 457, 2014-12-25)
True
> my $chan = getNoteChannel;
Channel.new()
> start { $chan.send($_) for (440, Any) xx * }
Promise.new(scheduler => ThreadPoolScheduler.new(initial_threads => 0, max_threads => 16, uncaught_handler => Callable), status => PromiseStatus::Planned)
>

The above is a transcript of feeding a lazy infinite list consisting of the Numeric literal 440 alternating with the type Any into a freshly created note channel. Reproducing this example on your machine should, provided a working audio interface exists and is not otherwise occupied, result in playback of 1 second of a 440hz sawtooth synth, followed by 1 second of silence, repeating.

eigmip6's People

Contributors

peschwa avatar vendethiel avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

eigmip6's Issues

inheritance

how can we extend java classes in perl6? i'd like to do...

class Foo is Applet {
...
}

thanks for your work on perl6 java interoperability. also, i like the work you're doing on the noise gang. i'd like to help when i can find the time. i'm on #perl6.

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.