Code Monkey home page Code Monkey logo

csoundapi-ruby's Introduction

Ruby bindings to the Csound API

Join the chat at https://gitter.im/nicb/csoundAPI-ruby Build Status Code Climate Test Coverage Issue Count

This is a Ruby binding gem to the csound sound software compiler API using FFI.

I wish somebody else had done it, so that I did not have to do it. However, so far nobody has undertaken this task, so I'll give it a try.

Requirements

Some applications are required to compile the csound library:

Instructions for Users

Installation

Add this line to your application's Gemfile:

gem 'csoundAPI-ruby', :git => 'https://github.com/nicb/csoundAPI-ruby.git'

And then execute:

cd csoundAPI-ruby
git submodule update --init --recursive
bundle install

After you have installed the csoundAPI-ruby gem, you have to run the following command:

$ bundle exec rake csound:build

which will compile the csound library for you.

Usage

We already got the basic command line working. You can write something like:

#!/usr/bin/env ruby
#
# csound_low_cli.rb: this is a command-line interface command that replicates
# the regular 'C' +csound+ command line.
#
require 'bundler/setup'
require 'csoundAPI_ruby'
require 'FFI/utilities'

include CsoundAPIRuby::Lib::Functions

cs = csoundCreate(nil)
argv = [$0] + ARGV # ARGV does not have argv[0] as in C, so we need to add it in front
res = csoundCompile(cs, argv.size, FFI::Utilities.set_argv(argv))
csoundPerform(cs)
csoundCleanup(cs)
csoundDestroy(cs)

exit(res)

(you can find this snippet here). Then you can run from a terminal:

$ ./share/doc/examples/csound_low_cli.rb -dWo ./test.wav spec/fixtures/csound/simple.csd

and this will produce the same result as if you called csound from the usual C command.

Details about the parts of the API already implemented may be found on the following pages:

Instructions for Developers

Help Wanted

HELP WANTED and most welcome.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/csoundAPI-ruby/fork )
  2. Clone it (git clone --recursive https://github.com/[my-github-username]/csoundAPI-ruby.git)
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

PLEASE NOTE: since we're using a submodule to pull in the csound library, you need to add the --recursive flag whenever you git clone or you want to update the csound repo, as in:

  git clone --recursive https://github.com/[my-github-username]/csoundAPI-ruby.git

or

  cd csoundAPI-ruby
  git submodule update --init --recursive

(I found these latter instructions here).

License

CsoundAPI-ruby Copyright (C) 2015 Nicola Bernardini Licensed under the terms of the GNU GPL version 2 License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

csoundapi-ruby's People

Contributors

aterza avatar nicb avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

csoundapi-ruby's Issues

use a logger to log spec csound output

Currently the (too verbose) output from csound is directed to /dev/null to avoid cluttering the spec output.

However, this is perhaps not the best solution. We might want to set up a logger object to perform appropriate logging of this output.

fix travis spec breaking

While some specs run perfectly on local machines, they break in the travis ci.

This is difficult to fix, because you need to simulate the travis environment locally. However, some instructions on how to do that may be found here. Maybe the second answer is appropriate.

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.