Csound, ChucK (and other things) for newbies

June 22, 2009

Short attention span blues: Java and Csound

Filed under: Computer Music, Csound, Csound frontends, Intermediate — A. Person @ 6:04 pm

I wanted to find a small program I could run to give me statistics about audio files. I can get the data from Sound Forge but thought it would be nice to be able to run a custom app. After a lot of research, I thought I would give Java a try.

All the tools you need to develop it are free (similar to many Gnu tools and Microsoft Visual Express systems). But Java appeals to me since it’s pretty open, mature and runs pretty well on all platforms. And the clincher is that there are Java wrappers for the Csound API. There are a couple sample programs in the Csound distribution but (once again) the documentation is nonexistent. I hit on a website of a guy writing a modular synth program in Java to run Csound underneath it, and the excellent blue composition environment appears to be in Java. So there is some precedent that can be mined. Hopefully I’ll be able to provide some pointers for people who want to do this.

May 4, 2009

Returning the favor

Filed under: Computer Music, Csound, Intermediate, Software synthesis — A. Person @ 7:50 am

The folks at thumbuki graciously linked over to here for Csound beginners. Once you’re a little comfortable with writing and reading Csound instruments and scores, you should study the stuff on his site as well. It’s chock full of interesting experiments and tips. And besides that it’s a WordPress blog which is nice.

April 30, 2009

QuteCsound and blue experiences…

Filed under: Beginner level, Computer Music, Csound frontends, Intermediate — A. Person @ 10:58 am

Browsing through the Nabble Csound forum, I see frequent mentions of the Csound frontend QuteCsound. A version 0.4.1 was recently announced so I thought I’d plunge in. I added some notes about my current experiences trying to get this to run on my Windows XP system which you can read about here .
The frontends I’ve been using have all been partially OK, but no single one really fills the bill for me.
A very powerful system, really incorporating a timeline for musical events and everything, is Steven Yi’s blue, which I’ll set up a page for separately. But for now I just want to get some placeholders down for adding to as I find out.
I regard myself as a typical Csound “hobbyist” level. Amateur, not connected with any academic institution, some background and knowledge of software synthesis and electronic music.

February 3, 2009

Csound 5.10 is ready for Win32

Filed under: Computer Music, Csound, Software synthesis — A. Person @ 4:30 pm

Well, we MS Windows users have no excuse not to take a look at this now. This has been out since late 2008/early 2009. There’s another page on this site that has the links to the Sourceforge downloads.

An issue that’s been batted around quite a bit on the mailing list is that of external libraries whose licensing status is not clear/not OpenSource, but Csound and/or its various components rely on. To include the compiled versions makes things very complicated, but there might not be permission to include the source code. I’m not sure where that all stands at the moment.

In a way I don’t want to know too much about the internal guts of Csound; but it is a huge and vast collection of software tools and it probably is good to have sort of an overview of it.

Someone, somewhere ought to make a big list of all the names associated with Csound and explain, on one line, what they are, what their status is, for instance to name a few off the top of my head:

  • QuteCsound
  • blue
  • Cecilia
  • FLTK
  • WinXound (?)
  • ATS Opcodes
  • Loris opcodes
  • Tcl/Tk interface
  • etc. etc. etc. etc.

and so on…

last edited 20090619

December 12, 2008

Holy cow…the Mac G3 still works.

Filed under: Computer Music — A. Person @ 11:23 am

Digging into the tim p scott archives, I found a CD-R from 1996 or so that I wanted to look at. I wrote it back when I was using MacOS, and it wasn’t readable under Windows, which I’ve been using exclusively for several year.

I did save my ADB keyboard and the display adaptor (so I could plug it into a standard VGA display). I blew the dust off it, plugged everything in, and pressed the power key. Lo and behold, it started right up (”*!chime!*”). And I was able to read the disk I wanted. I also cruised around and was actually able to bring up old PageMaker 6 versions of the CD artwork of the first tim p scott release (”Jack of Shadows”) so I could put the PDF of the insert poster online…Hopefully I’ll be able to do that in the CCMW blog/website now that I’ve bought the media/space/CSS upgrades from WordPress.

Anyway, I was just pleased that the old Mac still runs. I was worried that leaving it sit there, the hard drive would be frozen or maybe an internal battery would have run down and it wouldn’t start up (I know some of the older Macs I had had that problem.)

October 29, 2008

Creative Commons: what’s the point?

Filed under: Computer Music — A. Person @ 9:19 am

Man, I must be really, really stupid. I have read about CC for years. I’ve read magazine articles, been to their website, tried very hard to understand the whole thing, but it still eludes me.

The bottom line on intellectual property (IP) seems to me to be this: from my understanding, anything you write, or any music you record, automatically inheres copyright from the moment of its creation. The minute you make it available; either on the internet or through any other kind of publishing, it’s vulnerable to being copied; and indeed it will be if there is a demand for it, or one develops (the demand will be already exist if you’re a celebrity or have other works that are best sellers.)

If you want to prosecute improper copying of your IP you need two things: to prove that the IP is your property, to locate the perpetrators and to successfully bring legal action against him or them. I see the problem as being exclusively the latter. Unless you have a tremendously huge budget and will, like the RIAA or Church of Scientology, you can hardly succeed. As a band, you will be better off trying to make money through live appearance, licensing, added value in your products, etc. DVDs make money because of distribution: it’s easier to buy them at Wal-Mart than to go to the swap meet and paw through stacks of ugly copies of doubtful quality.

So–what’s the point of a CC license? You’re granting some “limited” amount of legal access to your IP? Sorry, the person who wants to use your IP can already do so with very little chance they’ll be prosecuted in any way. They can attribute to you if they want, or even claim the entire production is their own. Certainly that’s not what an “ethical” person would do, but an ethical person would respect your creation even without a CC license.

I’m obviously missing something here.

August 26, 2008

Csound and FLTK

Filed under: Computer Music, Csound, Intermediate — A. Person @ 2:36 pm

FLTK GUI Toolkit for Csound

My subject today is the Csound FLTK (stands for “Fast Light ToolKit”) opcodes. FLTK gives you a method to build simple, fast, lightweight GUIs for your Csound instruments.

It contains commands to build panels with sliders, knobs, buttons or banks of the above. At the end of this post is a simple example that creates a little tool that lets you change the frequency of your sine oscillator using a GUI.

Some of the nice things about this are: you don’t need Java or some other layer of software to accomplish it, and it ought to be relatively portable between Mac, Windows and Linux users.

Just to give a feeling for it, here’s an overview of the FLTK opcodes and system pretty much lifted from the v5 Csound manual:

Containers

FLTK Containers are widgets that contain other widgets such as panels, windows, etc. Csound provides the following container objects:

  • Panels
  • Scroll areas
  • Pack
  • Tabs
  • Groups

Valuators

The most useful objects are named FLTK Valuators. These objects allow the user to vary synthesis parameter values in real-time. Csound provides the following valuator objects:

  • Sliders
  • Knobs
  • Rollers
  • Text fields
  • Joysticks
  • Counters

There are other FTLK widgets that are not valuators nor containers:

  • Buttons
  • Button banks
  • Labels
  • Keyboard and Mouse sensing

Also there are some other opcodes useful to modify the widget appearance:

  • Updating widget value.
  • Setting primary and selection colors of a widget.
  • Setting font type, size and color of widgets.
  • Resizing a widget.
  • Hiding and showing a widget.

There’s also a simple example in the manual showing how to make use of a FLTK control (I hope this displays properly; wordpress does filter out certain character combinations.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out Audio in No messages
-odac -iadc ; -d ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o linseg.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>
;*******************************
sr=48000
kr=480
ksmps=100
nchnls=1
FLpanel "Panel1",450,550,100,100 ;***** start of container
gk1,iha FLslider "FLslider 1", 500, 1000, 0 ,1, -1, 300,15, 20,50
FLpanelEnd ;***** end of container
FLpanel "Panel2",450,550,100,100 ;***** start of container
gk2,ihb FLslider "FLslider 2", 100, 200, 0 ,1, -1, 300,15, 20,50
FLpanelEnd ;***** end of container
FLrun ;***** runs the widget thread, it is always required!
instr 1
; gk1 and gk2 variables that contain the output of valuator
; widgets previously defined, can be used inside any instrument
printk2 gk1
printk2 gk2 ;print the values of the valuators whenever they change
endin
;*******************************
</CsInstruments>
<CsScore>
f 0 3600 ;dummy table for realtime input
e
</CsScore>
</CsoundSynthesizer>

Lately (May 09), I’ve been trying to understand a new tool called QuteCsound that has a facility for manipulating widgets. Also, I think blue has this capability.

August 13, 2008

ChucK meets Csound

I also have experimented with converting a Csound instrument (#1706) to ChucK which seemed to work:

I had to upload the files with .doc format since I’m using this free blog software. Hopefully you can decode them.

1706-noteszip

This is really a zip archive I renamed with a .doc extension so I could upload it in wordpress. It has the original csound files, and my chuck version.

Some months ago, there was a great discussion on the ChucK discussion list (http://www.electro-music.com/forum/forum-140.html) called “One-line ChucK Crazy.” People contributed their own tiny ChucK programs to make interesting sounds/music as long as it fit on only one line.

One of the most active and creative contributors to the list is user “kijjaz” from Thailand. He submitted an amazing little program that used three oscillators hooked up in an FM configuration that created a bizarre drone if left to run for several minutes (or longer).

I’ve been tinkering with that algorithm, and want to experiment with various parameters and variables. And as an exercise, I’m also going to try to rewrite it as a Csound instrument.

I don’t have the Csound .orc finished yet, so I’m just going to give the ChucK program here. If you don’t know about ChucK, you need to learn! See other posts on this blog for pointers.

Note once again that I had to upload the file with a “.doc” extension to make wordpress happy. I don’t think ChucK cares very much what the file is named that you launch, but for consistency I always name executable ChucK programs with a .ck

scary_droneck

August 8, 2008

The THX™ sound from Csound

Filed under: "Other" music..., Computer Music, Csound, Intermediate, Software synthesis — A. Person @ 10:45 am

I don’t have very much time to do this, but I’ve been wanting to get this post out there.

Over the past year or two, I’ll been listening to and studying the thousands of Csound instruments and examples that are out there.

In a folder of examples written by Hans Mikelson, I found a little example (with no comments in it, as is usual with most of them) called gran2.orc (and its associated score gran2.sco). On executing it, I was amazed to see that it created a 6 second emulation of the famous THX sound you hear before movies that use that technology. It wasn’t perfect (sort of short and ended abruptly, etc.) so I tinkered with it and wrote a lot of comments for my own benefit.

The original version wouldn’t run in real time. In fact it took like 90 seconds to compute the 6.4 second output. So I converted it from using the “grain” opcode to using “grain3″. When I did that the example would run in real time so I could tweak it.

There are still lots of explorations one could do with the parameters of this, but for the time being I just want to present it to you for your consideration. (I’ve wrapped the original files into a .csd).

(P.S. I’ve uploaded a copy of the file as well in case this text gets garbled due to line wraps, etc. Because of wordpress limitations I had to call it a .doc file, but it’s really just a .csd. You can get it at this URL: 06-gran3-02csd) )

<CsoundSynthesizer>
/*
06-gran3-02.csd
 
Granular Synthesis using grain3 instead of grain
BASED ON: gran2.orc/.sco ORIGINALLY BY: H. Mikelson
 
20080723 tps Does a credible job of approximating the THX sound!
This was also originally from the Mikelson collection
Uses the grain3 opcode. This version is stereoized by computing
the left and right audio outputs separately using a different
seed for each side.
 
v01 20070713 tps
OK, now that we have gran2.csd working, let's try to replace the
grain opcode with grain3. With grain, ksmps = 2 and computing l and
r channels separately, it takes about 170 sec. With grain3 the
computation can easily run in real time with CPU load less than 50%.
Obviously this is a fruitful way to experiment...
My first cut at this does not sound quite as good as the gran2
example; will have to tweak some parameters and envelopes. 
v02 20080808 tps
 
Added parameters so a different fade in and fade out can be used
for the envelope. Lengthened the sound from 6.4 to 8 sec.
 
*/
<CsOptions>
--messagelevel=231
</CsOptions>
<CsInstruments>
sr        =         44100
kr    =   4410
ksmps     =         10
nchnls    =         2
/*
 Try using the grain3 opcode instead of grain...
*/
instr 2  ;  Granular Synthesis using the grain3 opcode
idur       =       p3    ; length in sec (as always)
iamp       =       ampdbfs(p4)  ; amplitude in dB
ifqc       =       cpspch(p5)  ; pitch (in octave.note)
igrtab     =       p6    ; graintable to use (only #7 for now)
iwintab    =       p7    ; window to use (table #4 for now)
ifrngtab   =       p8    ; frequency range table (10,11 or 12)
idens      =       p9    ; grain density
ifadein     =       p10    ; fade in time (sec)
ifadeout =  p11    ; fade out time (sec)
ibndtab    =      p12    ; pitch bend table (20,21 or 22)
igdur     =     0.20   ; grain duration (sec) 
kamp  linseg  0, ifadein, 1, idur-2*(ifadein+ifadeout), 1, \
      ifadeout, 0
kbend      oscil   1, 1/idur, ibndtab ; could a phasor do this?
kfrng      oscil   1, 1/idur, ifrngtab
; grain3 defaults
imode  =  0
iseedl  =  0
iseedr  =  0.17
imaxovr  =  20    ; grain overlap limit
kphs  =  0.5
kfmd  =  0
kpmd  =  0.5
kfrpow  =  0    ; power distribution factor
kprpow  =  0    ; (0=uniform)
;               AMP  FQC         DENSE  AMPOFF PITCHOFF    GRDUR 
;     GRTABLE WINTABLE  MAXGRDUR
aoutl  grain3  ifqc*kbend, kphs, kfmd, kpmd, igdur, idens, imaxovr, \
   igrtab, iwintab, kfrpow, kprpow, iseedl, imode
   
; stereoize it by computing another grain with all the same
;  parameters but a slightly different seed
aoutr  grain3  ifqc*kbend, kphs, kfmd, kpmd, igdur, idens, imaxovr, \
   igrtab, iwintab, kfrpow, kprpow, iseedr, imode
/*
; Note:
; I'm not sure if there's a simpler way to do this. In any case
;  grain3 is faster enough than grain that you can hear the output
;  of this in real time. Using grain takes about 90 sec to computer
;  just 8 seconds of sound
*/
kscale  = kamp*iamp ; save a few multiplies
  outs    aoutl*kscale, aoutr*kscale
/*
 Could get fancy and add a reverb/chorus/etc here... but not for
 now perhaps
*/
endin ;  instr 2
</CsInstruments>
<CsScore>
; SCORE is similar to that used in the other granular synth examples...
f2 0 1024  7 0 224 1 800 0
f3 0 8192  7 1 8192 -1
f4 0 1024  7 0 512 1 512 0
f5 0 1024 10 1 .3 .1 0 .2 .02 0 .1 .04
f6 0 1024 10 1 0 .5 0 .33 0 .25 0 .2 0 .167
/*
 The table used as the basic for granulating was a GEN10 table
 consisting of the sum of n harmonics where n=[1..12] where the
 level of harmonic n is 1/n (approximately).
 
 For some reason, n=8 is omitted. A typo or intentional?
*/
; f7 0 1024 10 1 .5 .333 .24 .2 .1667 .14286 .1111 .1 .09091 .08333
f7 0 1024 10 1 .5 .333 .24 .2 .1667 .14286 .125 .1111 .1 .09091 .08333
; FREQUENCY RANGE TABLE
f10 0 1024  -7 .21  512 .01 512 .001
f11 0 1024  -7 .31  512 .01 512 .001
f12 0 1024  -7 .21  512 .01 512 .001
; PITCH BEND TABLE
f20 0 1024  -7 8     512 .99  512 1.00
f21 0 1024  -7 .125  512 1.01 512 1.00
f22 0 1024  -7 .5    512 1.02 512 1.00
;  Start  Dur  Amp  Freq  GrTab  WinTab  FqcRng  Dens  Fade-In -Out PBend
i2   0.0  8   -25   6.00  7      4       10      100   .01   .3  20
i2   0.0  8   -25   8.00  7      4       11      100   .01   .3  21
i2   0.0  8   -25  10.00  7      4       12      100   .01   .3  22
i2   0.0  8   -25   6.07  7      4       10      100   .01   .3  20
i2   0.0  8   -25   8.07  7      4       11      100   .01   .3  21
e
i2   0.0  10   -25  10.07 7      4       12      100   .01   .3  22
</CsScore>
</CsoundSynthesizer>

July 24, 2008

Hacks and cruft: SciTE, Csedit, csound5gui…

Filed under: Computer Music — A. Person @ 3:19 pm

SciTE (Scintilla Text Editor) is nice for looking at and writing clean Csound code. It does opcode and comment highlighting and has good basic editing features. You can customize it with a properties file. It has a neat “Go” feature that lets you actually run a program and see the output in another window. BUT ON THE OTHER HAND for some reason, running any but the simplest Csound piece really hogs the CPU, and can cause crackling and distortion.

The Csound Editor (Csedit.exe) is not being supported anymore. It also has syntax highlighting and a number of other cool features, such as a command to create a csd file out of an orc and sco file in the current directory/folder. It has an option to launch a csound instance in a shell window, but unfortunately on Windows, after the piece runs the window disappears…which make it difficult to examine the performance log. Well, impossible, actually.

Finally there’s csound5gui. This is a pretty cool little tool. It has an simple integrated editor, and allows you to run csd or orc/sco file pairs. It does have a window for printing messages which is handy. For simple running of smaller pieces that don’t require extensive editing it’s a good choice.

Older Posts »

Blog at WordPress.com.