Welcome to %s forums

BrainModular Users Forum

Login Register

Csound 4 Usine

Discussions about add-ons, announcements
Post Reply
caco
Member
Posts: 306
Contact:

Unread post by caco » 07 Apr 2011, 09:40

I have uploaded a preliminary release of a new user module that allows you to run Csound within Usine. For anyone unfamiliar with Csound, it is a simple text-based computer programming language developed for creating and processing sound. It is very CPU efficient for realtime use and comes with over 1500 sound processing algorithms built in to it, so with Csound running inside Usine the only limit now is your imagination...

To use it you need to have Csound installed on your computer - instructions are included in the download and also in the wiki.

Csound 4Usine has stereo audio in/out, MIDI in/out, six generic parameters allowing data in/out and is also OpenSoundControl compatible, so there are lots of ways to use Usine to control Csound or to use Csound to control Usine.

For example, Csound can be used to create polyphonic synths, audio effects, midi effects or be used as a modulation source e.g for creating envelopes, LFOs, random numbers etc.

There are a few basic examples included in the download to help get you started. These are intended to provide an introduction to various aspects of Csound's syntax, such as using OSC to control Csound or how to generate MIDI etc rather than be the word's greatest effects. However, over time I will add more complex examples to really show what a Csound/Usine combination can achieve.

Nay-Seven has also filmed a video demonstration of using multi-touch in Usine to control Csound in realtime:
http://vimeo.com/21762828 / http://www.youtube.com/watch?v=LjQ1SjTzAEQ

If you have any problems the wiki page has links to lots of tutorials/resources for Csound to help you and there is also a tutorial by Nay-Seven in the wiki too.

Let me know how you get on :)

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 07 Apr 2011, 09:57

wonderful job!!!!!

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 07 Apr 2011, 10:22

congrats Caco !



Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 07 Apr 2011, 13:01

Just to let you know, the Csound's spanish wiki page for Usine is Here

The spanish tutorial is Here

:)

waolelaid
Member
Posts: 339
Location: Ecouen 95
Contact:

Unread post by waolelaid » 07 Apr 2011, 19:57

hello caco ,
it's really fantastic job
now we have to learn csound
yet a new experience
Regards :D
Avant l'effet on croit à d'autres causes qu'après
Friedrich Nietzsche

soundmind
Member
Posts: 236
Contact:

Unread post by soundmind » 08 Apr 2011, 12:54

This is pure awesome and adds so much functionality to usine. Thank you for taking the time to do this.

headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 08 Apr 2011, 21:24

Hi,

i begin to test csound4usine

wonderful

for example i made a freezephasevocoder last year, the same with csound cost half cpu!

i made my freeverb with csound easely with the help of opcode!

just a problem with the harmonizer.pat which freeze usine:)

caco
Member
Posts: 306
Contact:

Unread post by caco » 08 Apr 2011, 22:53

Yes CPU is very efficient in Csound, I am using it for convolution reverb and CPU is really low :)

Is it the MIDI controlled harmonizer that is causing you issues or the standard audio effect one?

headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 08 Apr 2011, 23:19

It's the standard audio effect harmonize.

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 11 Apr 2011, 09:25

For those who are interested, French discussion about Martin's work :

http://codelab.fr/2400#p12109

caco
Member
Posts: 306
Contact:

Unread post by caco » 11 Apr 2011, 13:03

@headphoner - I cannot reproduce the bug so please could you download it again and just check whether it still happens incase there was a corruption somewhere?

headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 11 Apr 2011, 13:46

Hi,

ok just downloaded it again.

The probleme is still the same,

if i dont wire "audio in" module no problem, If i wire an "audio in" module then 100% cpu.

User avatar
cmodica
Member
Posts: 606
Location: Pélissanne
Contact:

Unread post by cmodica » 13 Apr 2011, 15:14

Great job. Very low cpu and sound very very good !! Thank you !
Now i had to learn Csound ... :mad:

I have a problem with the harmoniser too. Usine didn't freeze, no 100% cpu but there is no sound coming in Csound module ? If i turn off Csound (with the on/off swtch) i ear sound. but when i turn on Csound there is no sound in usine and no sound in the audio in of Csound Module ???

But perhap's it is happen because there is no ''usine_harmonizer.csd'' in your Zip file ?

There is a ''usine_midi_harmonizer.csd'' but no ''usine_harmonizer.csd'' ...

thank you for this great job.

caco
Member
Posts: 306
Contact:

Unread post by caco » 14 Apr 2011, 08:48

I have removed the harmonizer patch and csd while I try and work out why some people are having issues. It works fine for me however. It is only a basic example so you are not missing much. I will replace it with an alternative example when I get some more time.

Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 09 Jun 2011, 15:55

hello,
I just used some of the examples of csound into a track:
three band eq and three band distortion. they are working great alone...but not one after another. it gave me an error message:

[32] Csound environment variables identified
[33] Csound version 5132
[34] Csound API version 205
[35] CSound .csd file loaded successfully
[36] Csound environment variables identified
[37] Csound version 5132
[38] Csound API version 205
[39] Error:pgUser CallBack Access violation at address 67EC63B6 in module 'lo.dll'. Read of address 0000000C
[40] Error:Internal in pgUser CallBack
[41] Workspace C:Program FilesUsine Pro StandAloneFilesWorkSpace.wkp loaded

why is that? how can I load two identical modules of csound one after another while at the same time avoiding the error? for example, two delays modules in two consecutive lines in a same track?

thanks for your advices :)

caco
Member
Posts: 306
Contact:

Unread post by caco » 09 Jun 2011, 17:01

Are they using OSC? I think with OSC you can only have one receiver per port number so if you have multiple Csound4Usine instances then they will each need to send/receive on different ports.

Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 09 Jun 2011, 17:13

That's right! they use the same osc port.
Now I just changed the osc port in the osd file and all is working now.:)

thanks!

Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 09 Jun 2011, 17:26

I was wondering, about osc, any workaround that could be used to avoid this?
for example, what should I do if I want to add the same csound eq filter module to , say, 8 different usine tracks?:/

caco
Member
Posts: 306
Contact:

Unread post by caco » 10 Jun 2011, 09:10

I have had the same problem and used different csd files with different port numbers but this is not a good solution having 8 different EQ scripts etc.

I am open to suggestions of how to improve this, I have not tried this but one idea maybe to pass the port number to the module through one of the paramter inputs. You could then open the same module numerous times and set each instance to a different port.

Another option I never got around to trying was to have one csound module as a central OSC hub that received all the OSC messages and then forwarded them to specific ports for different modules to receive on.

Neither of these are perfect solutions so feel free to suggest alternatives :)

Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 10 Jun 2011, 15:06

Your first suggestion seems easier to me. What about automatically assigning a random port (in a range) for each loaded csound module?

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 10 Jun 2011, 15:25

maybe you can use the current track+current line modules...?

Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 10 Jun 2011, 15:39

as a unique id number? that seems good enough!

caco
Member
Posts: 306
Contact:

Unread post by caco » 10 Jun 2011, 18:59

Good ideas, I will investigate it as soon as I get some free time.

caco
Member
Posts: 306
Contact:

Unread post by caco » 05 Jul 2011, 09:23

If anyone is interested, the latest edition of the Csound Journal has been published with my article in it about using Csound inside Usine. It was aimed more at Csound users who have never used Usine before but it may still be of use to anyone interested in having a go with Csound :)

http://www.csounds.com/journal/issue15/index.html

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 05 Jul 2011, 09:56

Cool, great news , gone to try to contact CDM for an article

Clearscreen
Member
Posts: 482
Location: Australia
Contact:

Unread post by Clearscreen » 06 Jul 2011, 02:49

I'm a total novice as far as programming goes, but after a quick glance at your article (and again, I have to say great work caco!!) is there any reason a similar thing can't be done to integrate processing via it's SDK and API? I'm guessing there probably is a reason it won't work, but I thought it was worth asking the question...

caco
Member
Posts: 306
Contact:

Unread post by caco » 06 Jul 2011, 09:25

Do you have a link to Processing's API / SDK?

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 06 Jul 2011, 09:51

caco wrote:If anyone is interested, the latest edition of the Csound Journal has been published with my article in it about using Csound inside Usine. It was aimed more at Csound users who have never used Usine before but it may still be of use to anyone interested in having a go with Csound :)

http://www.csounds.com/journal/issue15/index.html
great article!!!
Thanks for all you did for the community.

Clearscreen
Member
Posts: 482
Location: Australia
Contact:

Unread post by Clearscreen » 12 Jul 2011, 03:41

caco wrote:Do you have a link to Processing's API / SDK?
I might've got ahead of myself - here's a refernce for the API, but I haven't found an SDK link yet - I'll dig a bit more... The source code can be DL'd here if that helps? Given it's open source I assumed there would be more SDK/API resource somewhere...

[edit] Info about building libraries for processing is here. There's also a 'tools' section which may apply here. And a developer focussed site here.

caco
Member
Posts: 306
Contact:

Unread post by caco » 12 Jul 2011, 09:04

Thanks Clearscreen, they look like they are for creating addons to run inside Processing rather than allowing Processing to be run inside another program so don't think there is much I can do sadly.

Eskadrone
Member
Posts: 13
Location: Vienna
Contact:

Unread post by Eskadrone » 14 Jul 2011, 20:02

There is a free granular plugin, Hadron, downloadable - including Csound sourcecode (!) - here: http://www.partikkelaudio.com/downloads

caco
Member
Posts: 306
Contact:

Unread post by caco » 15 Jul 2011, 09:54

Yes Hadron looks great and is open source so could potentially be tweaked to replicate the M4L version using Usine :)

caco
Member
Posts: 306
Contact:

Unread post by caco » 26 Oct 2011, 13:50

Okay, here is a beta for the latest version of Csound 4 Usine - Download

- The main change is that you can now have up to 16 inputs/outputs and up to 128 parameters per instance.
- Parameters are no longer constrained to the 0-1 range so can be any value you want.
- I have also organised the add-on a bit more so that your .csd files now have their own directory
- There are also some updated examples to work with the new version
- Updated to work with Csound 5.14, which is the latest version so you can access the new opcodes, e.g. can now use Lua in your csd

There are still a couple of minor tweaks to make and I want to start improving the example patches now rather than just coding the addon itself :)

Let me know if you spot any bugs...

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 26 Oct 2011, 15:25

great , gone to test this new baby !

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 26 Oct 2011, 16:35

ok, all examples seems to work fine here
only the 2 lfo patches don't send any data...do i miss something..?

caco
Member
Posts: 306
Contact:

Unread post by caco » 26 Oct 2011, 17:03

No, I have broken them :(

I will get them fixed as soon as I can though and update them :)

caco
Member
Posts: 306
Contact:

Unread post by caco » 27 Oct 2011, 10:11

Okay should be fixed.

Hmm may need some additional thought though. The reason they stopped working is I had changed code in addon so that it automatically resizes output buffers to same size as input buffers. This is good because because it stops risk of glitch when inputs disconnected from addon. But it also means for a csound patch that does not require audio in, such as LFO or midi instrument, a valid audio input is required to set the output buffer size correctly. May need to change this behaviour, will have a think about it.

caco
Member
Posts: 306
Contact:

Unread post by caco » 11 Nov 2011, 15:02

Another update. You can now launch the Csound editor CsoundQT directly from the user module and it will load you current .csd file ready for tweaking. CsoundQT should be installed automatically as part of the Csound package.

This update resulted in me having to redo all the example patches so hopefully I haven't screwed them up as I haven't really had time to retest them :)



headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 29 Nov 2011, 12:10

Hi,

First thanks for the new features! really helpful

I have a question

Can we send and receive arrays or strings?

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 29 Nov 2011, 15:38

note this in the last version :

analog delay : feedback fader min = 0 , max = 0 ?
analog delay ping pong , same

could be cool to have feedback and mix in % (0_100), and gain in dB..?

size knob in freeverb and reverbsc is also min = 0 , max = 0

btw, love the spectral examples , thanks Martin

Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 30 Nov 2011, 13:13

In order to use the new version, Is it necessary to update csound to 5.14.2?

caco
Member
Posts: 306
Contact:

Unread post by caco » 02 Dec 2011, 09:28

headphoner - At the moment you would need to send the data via OSC

Floego - I haven't tried it with older versions, it may still work but I would recommend updating to the latest version of Csound

nay-seven - Thanks, I will fix the errors, it was inevitable I would break something somewhere. Will look at swapping gain etc to dB. Csound is awesome for spectral processing so will hopefully do a few more examples for it :)

headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 04 Dec 2011, 10:37

Hi,

Thanks for the answer caco

An other question, How do you manage soundfiles in a csd?

I have problem with it

caco
Member
Posts: 306
Contact:

Unread post by caco » 05 Dec 2011, 09:17

headphoner - what is the problem you are having? Have you had a look at the convolution reverb example as that uses soundfiles?

headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 05 Dec 2011, 09:46

Hi,

I would like to change the soundfile use in a csd with a string via oscsendtext


i will record a soundfile in a sampler module, so i will can name it, play it a csd ( a granular sampler) and visualize it with a display waveform module .

caco
Member
Posts: 306
Contact:

Unread post by caco » 05 Dec 2011, 10:16

headphoner wrote:Hi,

I would like to change the soundfile use in a csd with a string via oscsendtext


i will record a soundfile in a sampler module, so i will can name it, play it a csd ( a granular sampler) and visualize it with a display waveform module .
Ah yes this can get a bit tricky with csound as in many cases strings run at i-rate. It may be that your string gets initialized when your csd is loaded and then is not being changed. If this is the case then you can force csound to redo its init pass using the reinit opcode. I use this quite a lot in the examples to update i-rate variables in realtime. For example, in the lfo example the wavetable is only i-rate so I use reinit to update it when the uses changes waves. Take a look at it and so if it helps you, let me know how you get on :)


headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 07 Dec 2011, 20:39

hi,

I tried to change soundfile via OSClisten

it don't work but i maybe made a mistake

The possibility to change string with input parameter would be nice:)

headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 09 Dec 2011, 12:17

Hi,

it seems that the problem was with init

I tried qutesound example with "browse audio file", i have to much understand it!

caco
Member
Posts: 306
Contact:

Unread post by caco » 12 Dec 2011, 15:12

I have updated some of the patches to swap gain knobs to dB etc and fix a couple of minor bugs, without adding any more hopefully :)

Download

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 12 Dec 2011, 16:29

cool !
Thanks Caco

headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 16 Dec 2011, 23:43

hi,

A "change soundfile" patch example would be welcome:D

headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 18 Dec 2011, 19:12

Hi,

I just tried this

Code: Select all

<CsoundSynthesizer>

<CsOptions>



</CsOptions>

<CsInstruments>



sr = 44000

ksmps = 256



nchnls	=	1



0dbfs 	= 	1



instr 1

iolaps = 2

igrsize = 0.04

ifreq = iolaps/igrsize

ips = 1/iolaps



kstr chnget "param1"

kpitch chnget "param2"



a1 diskgrain "H&#58;usineUsine LibraryUserCsound4UsineAudio Samplesmary.wav", 32000, ifreq, kpitch, igrsize, ips*kstr, 1, iolaps



outch 1,   a1

endin



</CsInstruments>

<CsScore>

f 1 0 8192 20 2 1  ;Hanning function



;           timescale   pitchscale

i 1   0   32600    





e

</CsScore>

</CsoundSynthesizer>
It don't work


Why?

caco
Member
Posts: 306
Contact:

Unread post by caco » 19 Dec 2011, 09:27

I have not had chance to try your code yet headphoner but I have a couple of changes to it for you. First, I think you have set your samplerate wrong as you have sr = 44000. I am guessing this is a typo and should be 44100? Also, in your diskgrain code you are scaling the output's amplitude by 32000 so try changing this to 1 instead. After that I think it should work but I will try and test later today as soon as I get some free time :)

headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 19 Dec 2011, 10:25

hi,

ooops yes 44000 is a wrong typo

but still don't work for me


thanks for your help!

caco
Member
Posts: 306
Contact:

Unread post by caco » 19 Dec 2011, 12:34

Strange, seems to work okay for me. Here is an example .csd file and a patch to test it with :)

You will need to update the csd file with your own file location for the diskgrain opcode and make sure it has the correct number of output variables for it.

http://www.sensomusic.com/forums/upload ... phoner.zip

headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 19 Dec 2011, 12:44

hooray!


your patch work!


thanks a lot caco


:D

caco
Member
Posts: 306
Contact:

Unread post by caco » 30 Jan 2012, 11:22

Updated Csound4Usine so that it is now compiled against the latest version of Csound (v5.15).

I am not planning on making anymore changes to this version now so provided nobody finds any bugs over the next few days this will become to official version and I'll update the add-on section, wiki etc with the new information.

Now to think about v3 :)

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 30 Jan 2012, 12:33

Thank you very much caco for your involvement in this project and for regular follow-up !
Have you yet ideas for version 3 ...?

caco
Member
Posts: 306
Contact:

Unread post by caco » 30 Jan 2012, 13:32

I would like to be able to extract tables from Csound into Usine as an array, plus I am open to any other requests too :)

headphoner
Member
Posts: 225
Contact:

Unread post by headphoner » 01 Feb 2012, 18:35

Hi,

thanks a lot for your work!

As i said before, it would be great to have the possibility to change the soundfile.

caco
Member
Posts: 306
Contact:

Unread post by caco » 01 Feb 2012, 21:21

It is on my to do list for a future version of csound4usine. It is technically tricky though as strings only run at i-rate so updating them from usine will be hard and will involve some work I think but at some point I will work it out.

Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 07 Feb 2012, 03:49

Hello caco,

I have been experiencing fatal freezing/hanging in windows when using some really simple csd files into csound for usine. I'm using win7 x86, asio4all, usine pro standalone 5.8 and the latest csound 5.15 binary.The problem seems to be ocurring once the score is finished, not at loading, not at the middle.

Honestly I'm not good at all with csound and maybe I'm doing something wrong? :/

The csd files works OK when using the csound standalone by the commandline.

This is one of the simple csd file (taken from a csound tutorial by Joachim Heintz , Alex Hofmann and Iain McCurdy )

<CsoundSynthesizer>
<CsOptions>
-odac -m0
</CsOptions>
<CsInstruments>
;example by joachim heintz
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
instr 1
prints "Playing %d Hertz!n", p4
asig oscils .2, p4, 0
outs asig, asig
endin
</CsInstruments>
<CsScore>
i 1 0 2 10
i . + . 100
i . + . 1000
i . + . 10000
i . + . 20000
</CsScore>
</CsoundSynthesizer>

caco
Member
Posts: 306
Contact:

Unread post by caco » 07 Feb 2012, 09:32

Hello Floego,

No you are not doing anything wrong :/

I get the same problem with your example but it disappears when I increase ksmps to 43 or above. I think this must be a bug with Csound itself as ksmps doesn't really affect anything from the Usine side of csound4usine. There has been a lot of changes to Csound over the past few versions so it could be a bug has crept into it during that which affects the api at low control rates. I will double-check my code but I think you may just need to use larger ksmps for the moment :(

caco
Member
Posts: 306
Contact:

Unread post by caco » 07 Feb 2012, 10:19

Okay, I did find a small bug in my code where at small ksmps csound4usine requested more samples than csound was prepared to give so it might have been my fault rather than Csound's :/

I have updated the download with the new version, this might fix things for you.

Floego
Member
Posts: 319
Location: Venezuela
Contact:

Unread post by Floego » 07 Feb 2012, 18:24

Ok, now it's working fine!
thanks caco! :)

caco
Member
Posts: 306
Contact:

Unread post by caco » 08 Feb 2012, 15:20

Okay this is now the official release version :)

I have uploaded the new version to the add-on section and started to update the wiki.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests