LISTSERV mailing list manager LISTSERV 16.5

Help for CSOUND Archives


CSOUND Archives

CSOUND Archives


CSOUND@LISTSERV.HEANET.IE


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

CSOUND Home

CSOUND Home

CSOUND  January 2016

CSOUND January 2016

Subject:

Re: Including own C++ code in Csound

From:

Victor Lazzarini <[log in to unmask]>

Reply-To:

A discussion list for users of Csound <[log in to unmask]>

Date:

Sun, 3 Jan 2016 20:18:33 +0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (250 lines)

If all you need is audio IO, just use one of the audio IO libs such as
portaudio, JUCE, jack. It would be over complicated to port a ready-to-go
C/C++ code as a Csound opcode, esp. if it involves memory management
etc, and have to learn Csound on top of that.

On the other hand, if you need any of oscillators, filters, delays, spectral 
processing, etc, then it might be worth your while. However, I don’t think
it makes tremendous sense to re-write stuff that already exists in Csound,
such as partitioned convolution, etc. It is best to take a step back, modularise
your code into unit generators, and re-implement only the things Csound 
does not have. This way you can re-use existing code, and allow for maximum 
flexibility to create your instruments. There will not be a 3-1 loss in performance,
because all the code will still be in C/C++ (the 3-1 figure is when we do all
the DSP mathematics in Csound code, rather than re-implementing it as
opcodes).

If you want to go down that route, unfortunately the FLOSS manual quick
intro into opcode writing will not be sufficient (as it does not cover more 
advanced things such as memory allocation etc.). However, you can contact me 
privately and I can send you my class notes on the subject.

========================
Dr Victor Lazzarini
Dean of Arts, Celtic Studies and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 3 Jan 2016, at 20:00, Rory Walsh <[log in to unmask]> wrote:
> 
> Why bother rewriting all the perfectly ready-to-go C code in C++? 
> 
> On 3 January 2016 at 19:35, Michael Gogins <[log in to unmask]> wrote:
> Why should Karin reduplicate all the stuff in Csound that works fine
> already (audio IO etc)? As I said it makes perfectly good sense to use
> Csound as a framework, and to write performance critical code in C++
> as plugin opcodes.
> 
> There is waaay too much re-invention of the wheel in this field...
> 
> Best,
> Mike
> 
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
> 
> 
> On Sun, Jan 3, 2016 at 2:00 PM, Victor Lazzarini
> <[log in to unmask]> wrote:
> > Not sure why you need Csound in this case. Just keep it all in C.
> >
> > Victor Lazzarini
> > Dean of Arts, Celtic Studies, and Philosophy
> > Maynooth University
> > Ireland
> >
> > On 3 Jan 2016, at 18:42, MarieCurie <[log in to unmask]> wrote:
> >
> > this is what I expected.  The code is ready in C. Modifying  it to C++ and
> > calling it from Csound seems to me easier that starting from scratch in
> > Csound. As I tried to explain in my previous answer and as you can see in
> > the example this may become difficult to get it completely flexible in
> > Csound. But as I also said, I just started with Csound a few days ago and
> > don’t know all it’s capabilities. In my C code I need to define only the
> > virtual room (size & reflectivity) + sweet spot in the initialisation and
> > then if the position/path of a given sound source is passed to the code
> > everything  turns out automatically.
> >
> > And as I explained in the other thread computing power could be a
> > limitation.
> >
> > On 3 Jan 2016, at 19:22, Michael Gogins-2 [via Csound] <[hidden email]>
> > wrote:
> >
> > Efficiency is a goal. C++ runs about 3 times faster than Csound. Using
> > Csound as a framework and writing critical opcodes in C++makes sense to me.
> >
> > Regards,
> > Mike
> >
> > On Jan 3, 2016 12:21 PM, "Victor Lazzarini" <<a
> > href="x-msg://51/user/SendEmail.jtp?type=node&amp;node=5745861&amp;i=0"
> > target="_top" rel="nofollow" link="external" class="">[hidden email]> wrote:
> >>
> >> You can do doppler and the other things in Csound by using variable delay
> >> lines, filters,
> >> etc. What I would suggest is this:
> >>
> >> 1) write the audio processing code in Csound.
> >>
> >> 2) Access Csound via its API in your C++
> >> program, controlling the instruments that
> >> you created. The C++ code can calculate all
> >> the parameters / trajectories and pass it
> >> to Csound to do the processing.
> >>
> >> Of course this makes sense if you are starting the project. If you have
> >> all
> >> the code already written in C++, redoing
> >> things in Csound might be duplication. In that case just keep to C++.
> >>
> >> Victor Lazzarini
> >> Dean of Arts, Celtic Studies, and Philosophy
> >> Maynooth University
> >> Ireland
> >>
> >> > On 3 Jan 2016, at 15:09, MarieCurie <<a
> >> > href="x-msg://51/user/SendEmail.jtp?type=node&amp;node=5745861&amp;i=1"
> >> > target="_top" rel="nofollow" link="external" class="">[hidden email]> wrote:
> >> >
> >> > well, I just learnt about Csound shortly before Xmas when I was
> >> > discussing
> >> > some problems with my project with a sound engineer from the TV. For the
> >> > framework which I used so far which is primitive compared to Csound (and
> >> > not
> >> > supported since long) but had the capability of being accessed via
> >> > script
> >> > which is needed for my project. For this software I’ve written C code
> >> > which
> >> > does the simulation of a virtual room producing multichannel (surruound
> >> > 5.1)
> >> > output. This code allows for different multichannel panning schemes
> >> > (similar
> >> > to those in EXAMPLE 05B1 and eqn. 3 from V. Pulkki's article for the
> >> > stereo
> >> > case) and calculates the reverberation to a desired order of reflections
> >> > depending on the dimensions of the virtual room, the reflectivity and
> >> > the
> >> > positions of the source and the sweet spot. The path of the source can
> >> > be
> >> > steered by a string for a valid arithmetic expression (standard
> >> > arithmetics
> >> > including the standard C-functions) such that the source can be moved
> >> > almost
> >> > freely in (x,y) coordinates of the virtual room. This code yields
> >> > information on
> >> >
> >> > - the angle (or position) of the source,
> >> > - the distance dependent volume,
> >> > - the position dependent time delay between direct and reflected
> >> > signals,
> >> > - the position dependent volume ratio between direct and reflected
> >> > signals,
> >> > - the informations on the room contained in the reflections,
> >> > - the information on the movement (Doppler effect and beats which differ
> >> > for
> >> > the different channels because of different relative velocities w.r.t.
> >> > the
> >> > different walls).
> >> >
> >> > As far as I understand by now the multichannel packages VBAP and
> >> > Ambisonic
> >> > address the first two points only. As far as I've understood Puckki's
> >> > article and the source code of VBAP in Csound it does the panning of the
> >> > phantom sources only between neighbouring loudspeakers which means you
> >> > are
> >> > not able to put a phantom source at any position. This should be
> >> > possible
> >> > with Ambisonic however it also does not include item 3-6 from the list
> >> > above. I certainly will have a look to this code.
> >> >
> >> > An example of a source @440Hz moving with a velocity of 4m/sec in a room
> >> > with (x,y) 20m x 50m (speed of sound 343,2 m/sec) for 5.1 channels
> >> > (L-R-C-LFE-SL-SR) is shown below. One nicely sees the source passing the
> >> > sweet spot until it reaches the wall behind the listener then it slowly
> >> > moves until it reaches the right back corner, where it stops. (For
> >> > visualisation I've used Praat)Doppler and beats 440 Hz, 4m/sec
> >> >
> >> > <http://csound.1045644.n5.nabble.com/file/n5745837/440HzDopplerSchwebung.jpg>
> >> >
> >> >
> >> >
> >> > -----
> >> > cheers,
> >> >
> >> > Karin
> >> > --
> >> > View this message in context:
> >> > http://csound.1045644.n5.nabble.com/Including-own-C-code-in-Csound-tp5745799p5745837.html
> >> > Sent from the Csound - General mailing list archive at Nabble.com.
> >> >
> >> > Csound mailing list
> >> > <a
> >> > href="x-msg://51/user/SendEmail.jtp?type=node&amp;node=5745861&amp;i=2"
> >> > target="_top" rel="nofollow" link="external" class="">[hidden email]
> >> > 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
> >>
> >> Csound mailing list
> >> <a href="x-msg://51/user/SendEmail.jtp?type=node&amp;node=5745861&amp;i=3"
> >> target="_top" rel="nofollow" link="external" class="">[hidden email]
> >> 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
> >
> > Csound mailing list <a
> > href="x-msg://51/user/SendEmail.jtp?type=node&amp;node=5745861&amp;i=4"
> > target="_top" rel="nofollow" link="external" class="">[hidden email]
> > 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
> >
> > ________________________________
> > If you reply to this email, your message will be added to the discussion
> > below:
> > http://csound.1045644.n5.nabble.com/Including-own-C-code-in-Csound-tp5745799p5745861.html
> > To unsubscribe from Including own C++ code in Csound, click here.
> > NAML
> >
> >
> > cheers,
> >
> > Karin
> >
> > ________________________________
> > View this message in context: Re: [Csnd] Including own C++ code in Csound
> > Sent from the Csound - General mailing list archive at Nabble.com.
> > Csound mailing list [log in to unmask]
> > 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
> >
> > Csound mailing list [log in to unmask]
> > 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
> 
> Csound mailing list
> [log in to unmask]
> 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
> 
> Csound mailing list [log in to unmask] 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

Csound mailing list
[log in to unmask]
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

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015

ATOM RSS1 RSS2



LISTSERV.HEANET.IE

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager