Page 1 of 1
Posted: 07 Apr 2011, 09:40
by caco
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

Posted: 07 Apr 2011, 09:57
by senso
wonderful job!!!!!
Posted: 07 Apr 2011, 10:22
by nay-seven
congrats Caco !
Posted: 07 Apr 2011, 11:23
by headphoner
Thanks for your work!
Posted: 07 Apr 2011, 12:19
by 23fx23
amazin!!
Posted: 07 Apr 2011, 13:01
by Floego
Just to let you know, the Csound's spanish wiki page for Usine is
Here
The spanish tutorial is
Here

Posted: 07 Apr 2011, 19:57
by waolelaid
hello caco ,
it's really fantastic job
now we have to learn csound
yet a new experience
Regards

Posted: 08 Apr 2011, 12:54
by soundmind
This is pure awesome and adds so much functionality to usine. Thank you for taking the time to do this.
Posted: 08 Apr 2011, 21:24
by headphoner
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:)
Posted: 08 Apr 2011, 22:53
by caco
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?
Posted: 08 Apr 2011, 23:19
by headphoner
It's the standard audio effect harmonize.
Posted: 11 Apr 2011, 09:25
by nay-seven
For those who are interested, French discussion about Martin's work :
http://codelab.fr/2400#p12109
Posted: 11 Apr 2011, 13:03
by caco
@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?
Posted: 11 Apr 2011, 13:46
by headphoner
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.
Posted: 13 Apr 2011, 15:14
by cmodica
Great job. Very low cpu and sound very very good !! Thank you !
Now i had to learn Csound ...
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.
Posted: 14 Apr 2011, 08:48
by caco
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.
Posted: 09 Jun 2011, 15:55
by Floego
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

Posted: 09 Jun 2011, 17:01
by caco
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.
Posted: 09 Jun 2011, 17:13
by Floego
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!
Posted: 09 Jun 2011, 17:26
by Floego
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?:/
Posted: 10 Jun 2011, 09:10
by caco
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

Posted: 10 Jun 2011, 15:06
by Floego
Your first suggestion seems easier to me. What about automatically assigning a random port (in a range) for each loaded csound module?
Posted: 10 Jun 2011, 15:25
by nay-seven
maybe you can use the current track+current line modules...?
Posted: 10 Jun 2011, 15:39
by Floego
as a unique id number? that seems good enough!
Posted: 10 Jun 2011, 18:59
by caco
Good ideas, I will investigate it as soon as I get some free time.
Posted: 05 Jul 2011, 09:23
by caco
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
Posted: 05 Jul 2011, 09:56
by nay-seven
Cool, great news , gone to try to contact CDM for an article
Posted: 06 Jul 2011, 02:49
by Clearscreen
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...
Posted: 06 Jul 2011, 09:25
by caco
Do you have a link to Processing's API / SDK?
Posted: 06 Jul 2011, 09:51
by senso
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.
Posted: 12 Jul 2011, 03:41
by Clearscreen
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.
Posted: 12 Jul 2011, 09:04
by caco
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.
Posted: 14 Jul 2011, 20:02
by Eskadrone
There is a free granular plugin, Hadron, downloadable - including Csound sourcecode (!) - here:
http://www.partikkelaudio.com/downloads
Posted: 15 Jul 2011, 09:54
by caco
Yes Hadron looks great and is open source so could potentially be tweaked to replicate the M4L version using Usine

Posted: 26 Oct 2011, 13:50
by caco
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...
Posted: 26 Oct 2011, 15:25
by nay-seven
great , gone to test this new baby !
Posted: 26 Oct 2011, 16:35
by nay-seven
ok, all examples seems to work fine here
only the 2 lfo patches don't send any data...do i miss something..?
Posted: 26 Oct 2011, 17:03
by caco
No, I have broken them
I will get them fixed as soon as I can though and update them

Posted: 27 Oct 2011, 10:11
by caco
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.
Posted: 11 Nov 2011, 15:02
by caco
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

Posted: 11 Nov 2011, 15:23
by senso
cool++++
Posted: 14 Nov 2011, 19:10
by lalo
great!!!
Posted: 29 Nov 2011, 12:10
by headphoner
Hi,
First thanks for the new features! really helpful
I have a question
Can we send and receive arrays or strings?
Posted: 29 Nov 2011, 15:38
by nay-seven
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
Posted: 30 Nov 2011, 13:13
by Floego
In order to use the new version, Is it necessary to update csound to 5.14.2?
Posted: 02 Dec 2011, 09:28
by caco
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

Posted: 04 Dec 2011, 10:37
by headphoner
Hi,
Thanks for the answer caco
An other question, How do you manage soundfiles in a csd?
I have problem with it
Posted: 05 Dec 2011, 09:17
by caco
headphoner - what is the problem you are having? Have you had a look at the convolution reverb example as that uses soundfiles?
Posted: 05 Dec 2011, 09:46
by headphoner
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 .
Posted: 05 Dec 2011, 10:16
by caco
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

Posted: 05 Dec 2011, 10:22
by headphoner
thanks a lot !
i will try today
Posted: 07 Dec 2011, 20:39
by headphoner
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:)
Posted: 09 Dec 2011, 12:17
by headphoner
Hi,
it seems that the problem was with init
I tried qutesound example with "browse audio file", i have to much understand it!
Posted: 12 Dec 2011, 15:12
by caco
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
Posted: 12 Dec 2011, 16:29
by nay-seven
cool !
Thanks Caco
Posted: 16 Dec 2011, 23:43
by headphoner
hi,
A "change soundfile" patch example would be welcome:D
Posted: 18 Dec 2011, 19:12
by headphoner
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: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?
Posted: 19 Dec 2011, 09:27
by caco
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

Posted: 19 Dec 2011, 10:25
by headphoner
hi,
ooops yes 44000 is a wrong typo
but still don't work for me
thanks for your help!
Posted: 19 Dec 2011, 12:34
by caco
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
Posted: 19 Dec 2011, 12:44
by headphoner
hooray!
your patch work!
thanks a lot caco

Posted: 30 Jan 2012, 11:22
by caco
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

Posted: 30 Jan 2012, 12:33
by nay-seven
Thank you very much caco for your involvement in this project and for regular follow-up !
Have you yet ideas for version 3 ...?
Posted: 30 Jan 2012, 13:32
by caco
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

Posted: 01 Feb 2012, 18:35
by headphoner
Hi,
thanks a lot for your work!
As i said before, it would be great to have the possibility to change the soundfile.
Posted: 01 Feb 2012, 21:21
by caco
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.
Posted: 07 Feb 2012, 03:49
by Floego
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>
Posted: 07 Feb 2012, 09:32
by caco
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

Posted: 07 Feb 2012, 10:19
by caco
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.
Posted: 07 Feb 2012, 18:24
by Floego
Ok, now it's working fine!
thanks caco!

Posted: 08 Feb 2012, 15:20
by caco
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.