Sound Processing Language for Web Audio

Related tags

CoffeeCollider
Overview

CoffeeCollider Build Status Coverage Status Dependency Status

CoffeeCollider is a language for real time audio synthesis and algorithmic composition in HTML5. The concept of this project is designed as "write CoffeeScript, and be processed as SuperCollider."

Installation

node.js

npm install -g coffee-collider
coffeecollider -e "(->SinOsc.ar([440,442])).play()"

bower

bower install coffee-collider

Features

  • Over 150 unit generators which are almost same as SuperColldier's
  • Operator overloading
  • Syncronized task function
  • Client-Server architecture on WebWorker
  • Run anywhere. supporting Chrome/Firefox/Safari/Opera/IE(flashfallback), iOS/Android and node.js

Examples

Open the below links, and press the "Run" button.

Documents

https://github.com/mohayonao/CoffeeCollider/wiki/_pages

Contributing

  1. Fork me
  2. Create a branch for your changes: git checkout -b my-new-feature
  3. Add your changes, and please include tests: git commit -am 'Add some feature'
  4. Make sure the tests pass by running: grunt test
  5. Create a pull request :D

License

MIT

Inspired by

Issues
  • Function

    Function "stop" / "free" / "set" ?

    Is there a way of stopping a function after its playing ?

    opened by hems 5
  • [ja] SynthDef template

    [ja] SynthDef template

    template = SynthDef (out, osc)->
      (freq=440, amp=0.5)->
        Out.ar(out, osc.ar(freq) * amp)
    

    こう書いた場合は

    • 外側の out, osc は build の引数で渡す (SynthDefの作成)
    • 内側の freq, amp は OutputProxy となる
    def1 = template.build(0, SinOsc)
    def2 = template.build(1, LFSaw) 
    
    def1.play freq:880 # out 0 に SinOsc
    def2.play freq:660 # out 1 に LFSaw
    

    こう書けるので便利そう。

    テンプレート引数は省略できて以下の2つは同じように解釈されたほうが良い。

    def = SynthDef (freq, amp=0.5)->
      Out.ar(0, SinOsc.ar(freq) * amp)
    
    def = SynthDef ->
      (freq, amp=0.5)->
        Out.ar(0, SinOsc.ar(freq) * amp)
    
    opened by mohayonao 4
  • Upped dependency versions to work with node v4.1.2

    Upped dependency versions to work with node v4.1.2

    Tests pass and example works.

    Due to the following:

    [email protected] install /usr/local/lib/node_modules/coffee-collider/node_modules/ws (node-gyp rebuild 2> builderror.log) || (exit 0)

    CXX(target) Release/obj.target/bufferutil/src/bufferutil.o

    [email protected] install /usr/local/lib/node_modules/coffee-collider/node_modules/speaker node-gyp rebuild

    CC(target) Release/obj.target/output/deps/mpg123/src/output/coreaudio.o LIBTOOL-STATIC Release/liboutput.a CXX(target) Release/obj.target/binding/src/binding.o In file included from ../src/binding.cc:6: ../src/node_pointer.h:23:9: error: unexpected namespace name 'Buffer': expected expression node::Buffer buf = node::Buffer::New((char *)ptr, length, wrap_pointer_cb, user_data); ^ ../src/node_pointer.h:23:17: error: use of undeclared identifier 'buf' node::Buffer *buf = node::Buffer::New((char *)ptr, length, wrap_pointer_cb, user_data); ^ ../src/node_pointer.h:23:23: error: no matching function for call to 'New' node::Buffer *buf = node::Buffer::New((char *)ptr, length, wrap_pointer_cb, user_data); ^~~~~~~~~~~~~~~~~ /Users/robertbrewitzborg/.node-gyp/4.1.2/include/node/node_buffer.h:31:40: note: candidate function not viable: requires at most 3 arguments, but 4 were provided NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate isolate, ^ /Users/robertbrewitzborg/.node-gyp/4.1.2/include/node/node_buffer.h:43:40: note: candidate function not viable: requires 3 arguments, but 4 were provided NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate, ^ /Users/robertbrewitzborg/.node-gyp/4.1.2/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 4 were provided NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate, ^ /Users/robertbrewitzborg/.node-gyp/4.1.2/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 4 were provided NODE_EXTERN v8::MaybeLocalv8::Object New(v8::Isolate* isolate, size_t length); ^ In file included from ../src/binding.cc:6: ../src/node_pointer.h:24:10: error: use of undeclared identifier 'buf' return buf->handle_; ^ ../src/binding.cc:17:3: error: unknown type name 'uv_work_t' uv_work_t req; ^ ../src/binding.cc:25:27: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'? Handle Open (const Arguments& args) { ^~~~~~~~~ v8::internal::Arguments /Users/robertbrewitzborg/.node-gyp/4.1.2/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here class Arguments; ^ ../src/binding.cc:26:15: error: calling a protected constructor of class 'v8::HandleScope' HandleScope scope; ^ /Users/robertbrewitzborg/.node-gyp/4.1.2/include/node/v8.h:885:13: note: declared protected here V8_INLINE HandleScope() {} ^ ../src/binding.cc:28:77: error: type 'const v8::internal::Arguments' does not provide a subscript operator audio_output_t ao = reinterpret_cast<audio_output_t *>(UnwrapPointer(args[0])); ~~~~^~ ../src/binding.cc:31:30: error: type 'const v8::internal::Arguments' does not provide a subscript operator Local format = args[1]->ToObject(); ~~~~^~ ../src/binding.cc:33:38: error: no member named 'NewSymbol' in 'v8::String' ao->channels = format->Get(String::NewSymbol("channels"))->Int32Value(); / channels / ~~~~~~~~^ ../src/binding.cc:34:34: error: no member named 'NewSymbol' in 'v8::String' ao->rate = format->Get(String::NewSymbol("sampleRate"))->Int32Value(); / sample rate / ~~~~~~~~^ ../src/binding.cc:36:38: error: no member named 'NewSymbol' in 'v8::String' int bitDepth = format->Get(String::NewSymbol("bitDepth"))->Int32Value(); ~~~~~~~~^ ../src/binding.cc:37:39: error: no member named 'NewSymbol' in 'v8::String' bool isSigned = format->Get(String::NewSymbol("signed"))->BooleanValue(); ~~~~~~~~^ ../src/binding.cc:38:38: error: no member named 'NewSymbol' in 'v8::String' bool isFloat = format->Get(String::NewSymbol("float"))->BooleanValue(); ~~~~~~~~^ ../src/binding.cc:72:16: error: no member named 'Close' in 'v8::HandleScope' return scope.Close(Integer::New(r)); ~~~~~ ^ ../src/binding.cc:72:36: error: too few arguments to function call, expected 2, have 1 return scope.Close(Integer::New(r)); ~~~~~~~~~~~~ ^ /Users/robertbrewitzborg/.node-gyp/4.1.2/include/node/v8.h:2499:3: note: 'New' declared here static Local New(Isolate isolate, int32_t value); ^ ../src/binding.cc:75:19: error: unknown type name 'uv_work_t' void write_async (uv_work_t ); ^ ../src/binding.cc:76:19: error: unknown type name 'uv_work_t' void write_after (uv_work_t *); ^ ../src/binding.cc:78:28: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'? Handle Write (const Arguments& args) { ^~~~~~~~~ v8::internal::Arguments /Users/robertbrewitzborg/.node-gyp/4.1.2/include/node/v8.h:139:7: note: 'v8::internal::Arguments' declared here class Arguments; ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make: ** [Release/obj.target/binding/src/binding.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Darwin 14.5.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/local/lib/node_modules/coffee-collider/node_modules/speaker gyp ERR! node -v v4.1.2 gyp ERR! node-gyp -v v3.0.3 gyp ERR! not ok npm ERR! Darwin 14.5.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "coffee-collider" npm ERR! node v4.1.2 npm ERR! npm v2.14.4 npm ERR! code ELIFECYCLE

    npm ERR! [email protected] install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the speaker package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get their info via: npm ERR! npm owner ls speaker npm ERR! There is likely additional logging output above.

    npm ERR! Please include the following file with any support request: npm ERR! /Users/robertbrewitzborg/npm-debug.log

    opened by RobertBrewitz 4
  • [ja] Time Value Syntax

    [ja] Time Value Syntax

    Max/MSPのような時間値シンタックスを導入したい。

    http://www.cycling74.com/docs/max5/vignettes/core/maxtime_syntax.html

    Line.kr(0, 1, dur:"1.0.0") # 1小節かけて 0 から 1 に変化する
    

    実装案

    1. コンパイル時に文字列がシンタックスに合致していればその場で数値に変換する
      • 実行時のパフォーマンス good
      • 時間単位が異なる (UGen系は秒、タスクwait はミリ秒を使っている)
      • 周波数を期待する箇所で書けない
      • マスターBPMに対応できない
    2. 受け取る関数内で変換する
      • 実行時のパフォーマンスの問題 bad
      • 時間単位を柔軟に決められる
      • 周波数を期待する箇所で書ける (実行時に変換すればよい)
      • マスターBPMに対応できる
      • 実装量が増える
    3. コンパイル時に合致していれば関数呼び出しに変換する
      • 実行時のパフォーマンスの問題 bad
      • 時間単位が異なる (UGen系は秒、タスクwait はミリ秒を使っている)
      • 周波数を期待する箇所で書けない
      • マスターBPMに対応できる

    対応策

    • 時間単位の変換は手動で行う
    @wait "1.0.0" * 1000 # 1小節待つ
    
    • 周波数変換用シンタックスを作る
    SinOsc.kr("~1.0.0") # 1小節を周波数に変換する ( ~ はサイン波のイメージ)
    
    • マスターBPMへの対応は関数で処理しないと不可能

    記法 (案)

    • 周波数
      • 100hz → 0.01
    • ミリ秒
    • 50ms → 0.05
      • 10sec → 10
      • 1min → 60
    • 時:分:秒.ミリ秒
      • 00:03:25.230 → 205.230
    • サンプル数
      • 1000samples → (1000 / samleRate)
      • 1000samples/44100hz → (1000 / 44100)

    以下はマスターBPMとの連携が必要となり、省略した場合は定数として扱えない

    • ノート長
      • L4
      • bpm140 L4 → 0.42857142857142855
    • 小節/拍/ticks
      • 2.3.240
      • bpm140 2.3.240 → 4.928571428571428
    • ticks
      • 1 tick は四分音符の 1/480 とする
      • 480ticks
      • bpm140 480ticks → 0.42857142857142855
    opened by mohayonao 3
  • [ja] Task Template

    [ja] Task Template

    template = Task (a, b)->
      (i)->
        s = def.play()
        s.set freq:a * i
        @wait b
        s.set freq:a * i * 2
        @wait b
    
    task1 = Task.do(10, template(440, 0.50)).play()
    task2 = Task.do(10, template(660, 0.45)).play()
    
    opened by mohayonao 2
  • Buffer example from WIKI doesn't work

    Buffer example from WIKI doesn't work

    I can't get the example from Buffer page to work:

    https://github.com/mohayonao/CoffeeCollider/wiki/21-Buffer

    b = Buffer([-1, -0.5, -0.25, -0, +0, +0.25, +0.5, +1]) ( -> OscN.ar(b, 440) ).play()

    opened by hems 1
  • error SynthDef

    error SynthDef

    SynthDef ->
      Out.ar(0, Mix.fill(24, (i)->
        SinOsc.ar(440 * (i).midiratio())
      ) * 1/12)
    .play()
    

    compiled

    ((global)->
      (SynthDef(->
        cc.Out.ar(0, cc.Mix.fill(24, (i)->
          cc.SinOsc.ar((440.__mul__((i).midiratio())))
        ).__mul__((1.__div__(12)))))
      ).play(), [] # <- ERROR!!!!
    ).call(cc.__context__, this.self || global) 
    
    bug 
    opened by mohayonao 1
  • Single letter variants are modified in global scope

    Single letter variants are modified in global scope

    relate #58 (run selected lines of code)

    enhancement 
    opened by mohayonao 1
  • [ja] How send/receive a message between a client and a server?

    [ja] How send/receive a message between a client and a server?

    Like this?

    // in the client
    var cc = new CoffeeCollider();
    $button.on("click", function() {
      cc.send("button-click", 1000);
    });
    cc.recv("response-from-server", function(data) {
      console.log(data); //=> [100,200]
    });
    
    # in the server
    Message.recv "button-click", (data)->
      console.log data #=> 1000
    Message.send "response-from-server", [100, 200]
    
    • どういう用途で使うか?
      • busのデータを送信する
      • UIの操作を反映させる
      • 他は?
    opened by mohayonao 1
  • error adverb

    error adverb

    error

    [1,2,3] +S+ [1,2,3,4,5,6,7,8,9,10]
    

    compiled

    [1, 2, 3](S.__plus__().__add__([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))
    

    ok

    [1,2,3]+S+[1,2,3,4,5,6,7,8,9,10]
    

    compiled

    [1, 2, 3].__add__([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], cc.SHORT)
    
    bug 
    opened by mohayonao 1
  • Conversion to vanilla javascript?

    Conversion to vanilla javascript?

    Hi,

    I realize that this project is no longer being maintained but I wanted to see if there was any possibility of converting it for use without coffeescript. Maybe it's already possible and I just can't figure it out? I think a lot of other people would get use out of it also since there's nothing remotely like it that I have found so far.

    Thanks, Tate

    opened by tatecarson 1
  • Avoid clicks and pops when calling

    Avoid clicks and pops when calling "pause", "play", "resume"

    Any advice on how to avoid clicks and pops when doing "pause" and "play" ?

    Like somehow using a "Line" or "Env" to shape the main audio node and then bringing it back?

    Any suggestions on how to implement that fade in / fade out natively on the pause / play methods?

    opened by hems 0
  • Documentation on how to use tail ?

    Documentation on how to use tail ?

    Hello mohayonao,

    Could you please add some documentation on how to use "tail" ?

    For instance using a SynthDef as filter of another SynthDef ?

    For instance, on this example ( example link here ) i would like to use a SynthDef to filter the other synth def:

    As you can see, i'm using In.ar as an "imaginary" code, it doesn't work at the moment.

    Also i'm not sure if, .play( null, { cutoff: 300 }, "addToTail" ) is the right way to "chain" both SynthDefs

    opened by hems 0
  • Getting the current value of a

    Getting the current value of a "Ugen" and send to js?

    a = SinOsc.kr( 440 )

    Message.send "a:value", a.get() # <~ how do i get the "current value" of "a" ?

    
    Will i need to "play" it, to get it going?
    
    ( -> 
      $a = SinOsc.ar( 55 ) 
    ).play()
    
    console.log($a)
    
    Message.send "a:value", $a.get() # <~ how do i get the "current value" of "$a" ?
    
    
    opened by hems 1
  • UGen implements

    UGen implements

    opened by mohayonao 4
  • [ja] Custom Build

    [ja] Custom Build

    必要なモジュールだけ組み込んでビルドできると良い。

    opened by mohayonao 1
  • Write out an audio file

    Write out an audio file

    opened by mohayonao 6
  • Web MIDI API

    Web MIDI API

    opened by mohayonao 0
  • [ja] chat

    [ja] chat

    雑談用です

    opened by mohayonao 35
  • 🎚️ Open Source Audio Matching and Mastering

    Matching + Mastering = ❤️ Matchering 2.0 is a novel Containerized Web Application and Python Library for audio matching and mastering. It follows a si

    Sergey Grishakov 490 Sep 24, 2021
    Typographic Beat-Oriented Notation for music

    tbon Typographic Beat-Oriented Notation for music Tbon aims to be the fastest way to enter pitches, rhythms, meter and dynamic levels from a computer

    null 11 Jan 23, 2020
    Ear-bending noises and music

    Cecilia5 - the audio processing toolbox Cecilia is an audio signal processing environment. Cecilia lets you create your own GUI (grapher, sliders, tog

    Olivier Bélanger 129 Sep 21, 2021
    Music typeset with the Lilypond system

    Intro (from long ago) This repo contains sheet music typeset with the Lilypond typesetter. The music chosen is in favour of cello music (mostly chambe

    Enthusiastic about  the Cello 95 Sep 24, 2021
    A cross-browser javascript wrapper for the html5 audio tag

    audio.js audiojs is a drop-in javascript library that allows HTML5's <audio> tag to be used anywhere. It uses native <audio> where available and falls

    Anthony Kolber 2k Sep 22, 2021
    The git repository of the advanced drum machine

    Hydrogen drum machine Hydrogen is an advanced drum machine for GNU/Linux, Mac and Windows. It's main goal is to bring professional yet simple and intu

    Hydrogen 702 Sep 15, 2021
    Audio Editor

    Audacity is an easy-to-use, multi-track audio editor and recorder for Windows, Mac OS X, GNU/Linux and other operating systems. Developed by a group o

    Audacity 6.4k Sep 17, 2021
    A Music programming language. Translates source code into MIDI. Includes a player. Supports MIDI-Karaoke. Includes a MIDI analyzer.

    Get Started | Features | Screenshots | Programming | CLI | Contribute | License Midica is an interpreter for a Music Programming Language. It translat

    Jan Trukenmüller 47 Sep 17, 2021
    The fre:ac audio converter project

    fre:ac - free audio converter fre:ac is a free and open source audio converter. It supports audio CD ripping and tag editing and converts between vari

    Robert Kausch 619 Sep 24, 2021
    Python library for audio and music analysis

    librosa A python package for music and audio analysis. Documentation See https://librosa.org/doc/ for a complete reference manual and introductory tut

    librosa 4.8k Sep 25, 2021
    Full-featured CD/DVD/Blu-ray burning and ripping application

    K3b Version 18.04.0 Thanx for downloading K3b - The CD Kreator These are the features so far: - the most userfriendly interface ever ;-) - thema

    KDE GitHub Mirror 73 Sep 18, 2021
    Compose music and write score easily in your browser!

    inknote Compose music easily in your browser! http://www.michalpaszkiewicz.co.uk/inknote/ Store multiple files, tag them with colours. Made using Type

    Michal Paszkiewicz 145 Aug 18, 2021
    Sound Processing Language for Web Audio

    CoffeeCollider CoffeeCollider is a language for real time audio synthesis and algorithmic composition in HTML5. The concept of this project is designe

    mohayonao 209 Aug 18, 2021
    Streaming music player that finds free music for you

    Desktop music player focused on streaming from free sources Links Official website Mastodon Twitter Support channel (Matrix): #nuclear:matrix.org Disc

    null 6.8k Sep 17, 2021
    ChucK Music Programming Language

    ChucK Please note that the master branch has been renamed to main. The Internet Engineering Task Force (IETF) points out that "Master-slave is an oppr

    Stanford CCRMA 501 Sep 25, 2021
    Python CD-DA ripper preferring accuracy over speed

    Whipper Whipper is a Python 3 (3.6+) CD-DA ripper based on the morituri project (CDDA ripper for *nix systems aiming for accuracy over speed). It star

    null 554 Sep 19, 2021
    Music player and music library manager for Linux, Windows, and macOS

    Quod Libet: an audio library, manager & player Quod Libet is a cross-platform audio / music management program. It provides many ways to view your loc

    Quod Libet 1k Sep 16, 2021
    Fork of the original rubyripper from code.google.com/p/rubyripper + some bugs fixes

    Historical note Introduction Secure rip method How to install MacOS Support FAQ Running all tests Historical note This is an unofficial fork of the or

    null 91 Aug 11, 2021