Cabbage Logo
Back to Cabbage Site

What's the best way to write extensions that are not in Cabbage nor in CSound?

What’s the best way to write extensions that are not in Cabbage nor in CSound?

Should I merely use the ability to embed Python into CSound?

What other options are there?

Perhaps I could write a new CSound opcode and then use it? That is, if it’s a DSP algorithm.

If you want to add functionality to Csound you can write a new opcode, either as a UDO or as an opcode plugin. To develop opcode plugins you will need to know C/C++. What is it you are thinking about extending? If you’re into developing DSP algorithms then I’d suggest writing a UDO first and seeing how it runs. If it is too slow you rewrite it as C/C++ which will insure that it runs faster, although it will depend a lot on what you are trying to do.

I want an opcode that streams from web radios.

There are C/C++ libraries for getting the data from the web to an audio file, but in order to use these in Cabbage I think I need to have the reading done in an Opcode, even if I used a C/C++ library.

That sounds correct. Writing a new Csound plugin seems like the best choice.

BTW, does there already exist tutorials on writing such Opcodes?

If not, then I might write a blog entry about my project.

Hi @mviljamaa,

For writing in C: take a look at http://csounds.com/articles/Extensions_to_Csound.pdf and http://write.flossmanuals.net/csound/extending-csound/

There is also a lot of things you will encounter just by using Google and hitting old posts to the csound-dev mailing list. Also, you can study existing plugins: https://github.com/csound/csound/tree/develop/Opcodes

For writing in C++ I used this Opcode as template: https://github.com/csound/csound/blob/develop/Opcodes/ftsamplebank.cpp. But now there is a better way through the C++ plugin opcode interface (https://github.com/csound/csound/blob/develop/include/plugin.h). Here is an example for the latter: https://github.com/csound/csound/blob/develop/Opcodes/arrayops.cpp

Cheers.