Csound Csound-dev Csound-tekno Search About

Re: [Csnd] Csound for Ruby - new Gem

Date2019-12-28 21:23
FromJohann Philippe <000002c2c0737523-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] Csound for Ruby - new Gem
Attachmentscs_functoruby.rb  
I can see now it already exists : nicb/csoundAPI-ruby



 Well, at least there are now many possibilities !

Le samedi 28 décembre 2019 à 22:20:10 UTC+1, Johann Philippe <000002c2c0737523-dmarc-request@listserv.heanet.ie> a écrit :


Dear all,

As I've been working around Ruby those last few days, I needed a simple
project to start learning this language, and decided to create a simple Gem
to expose Csound API to Ruby.
You can find it here :  https://rubygems.org/gems/csound
And simply install it with the command "gem install csound". Installing
Csound will still be necessary.
And source code is here

There are two components :
- CsoundModule - a Ruby module embedding Csound C API (with exact same
names)
- Csound - a Ruby class - to manage Csound instance as an object.

A simple example of CsoundModule would be :
cs = csoundCreate(nil)
csoundCompileCsd(cs, "/my/csd.csd")
csoundStart(cs)
csoundPerform()


And the exact same with Csound class :
cs = Csound.new
cs.CompileCsd("/my/csd.csd")
cs.Start()
cs.Perform()


It has been done through the FFI Gem.
Most of this has been performed with a script, so it is very likely that
some methods won't work properly.
If you find any bug, you can email me at - johannphilippe@lilo.org

Bests






--

Csound mailing list
Send bugs reports to
Discussions of bugs and features can be posted here

Date2019-12-28 21:38
FromJohann Philippe <000002c2c0737523-dmarc-request@LISTSERV.HEANET.IE>
Subject[Csnd] Csound for Ruby - new Gem
Dear all, 

As I've been working around Ruby those last few days, I needed a simple
project to start learning this language, and decided to create a simple Gem
to expose Csound API to Ruby.
You can find it here :  https://rubygems.org/gems/csound
  
And simply install it with the command "gem install csound". Installing
Csound will still be necessary. 
And source code is here 
https://framagit.org/johannphilippe/csoundruby/tree/master
  

There are two components : 
 - CsoundModule - a Ruby module embedding Csound C API (with exact same
names)
 - Csound - a Ruby class - to manage Csound instance as an object. 

A simple example of CsoundModule would be : 
cs = csoundCreate(nil)
csoundCompileCsd(cs, "/my/csd.csd")
csoundStart(cs)
csoundPerform()


And the exact same with Csound class : 
cs = Csound.new
cs.CompileCsd("/my/csd.csd")
cs.Start()
cs.Perform()


It has been done through the FFI Gem. 
Most of this has been performed with a script, so it is very likely that
some methods won't work properly. 
If you find any bug, you can email me at - johannphilippe@lilo.org

Bests
 





--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-12-28 23:06
Frompete.goodeve@COMPUTER.ORG
SubjectRe: [Csnd] Csound for Ruby - new Gem
AttachmentsNone  

Date2019-12-29 00:05
FromJohann Philippe <000002c2c0737523-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] Csound for Ruby - new Gem
I'm glad if it can be useful !
The few tests and corrections I could run confirm that basic usages of API will work (Compile, Perform, PerformKsmps, SetControlChannel). For many other methods there is still some work to be done, mostly to get Csound types/pointers in Ruby (and all methods related to this, like ListChannels etc...).


Le dimanche 29 décembre 2019 à 00:07:00 UTC+1, pete.goodeve@COMPUTER.ORG <pete.goodeve@computer.org> a écrit :


On Sat, Dec 28, 2019 at 09:23:22PM +0000, Johann Philippe wrote:
>  I can see now it already exists : nicb/csoundAPI-ruby

Hah!  Well in any case I never knew about it!  I'm a fan of Ruby, so I expect
I can put it (either of them...!) to use.

Thanks a lot for your effort.

    -- Pete --



Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here