Jim Aikin's Oblong Blob

Random Rambling & Questionable Commentary

Posts Tagged ‘Csound’

Lingua Franca

Posted by midiguru on November 11, 2010

So you’re describing the human species to a xenosociologist named Erbq, who comes from a planet somewhere near Aldebaran. You tell him (actually, Erbq is a him/2, but let’s not get into that) that we humans use tools and communicate using spoken words, which signify objects, actions, and relations. Also, we have a glandular system that releases chemicals into the bloodstream to stimulate quick action — emotions, in other words.

From this data, Erbq might reasonably conclude that humans will express their emotions by making sculpture and paintings. (I suppose we’d better tell him we have color-sensitive eyes too. That’s important information.) He might also be able to predict that in order to depict our social relations, we will tell stories, write poetry, and enact dramas, either onstage or in a film/video medium of some sort. All of this seems pretty natural, given the raw material of the human organism.

But would Erbq be able to predict the existence of music?

Music is a very odd art form. It’s almost entirely abstract, and yet it communicates. Music is a language whose words and sentences are, technically, meaningless. But somehow, the listener Read the rest of this entry »

Posted in evolution, music | Tagged: , | 3 Comments »

QuteCsound 0.6.0 Released

Posted by midiguru on July 26, 2010

Good news — Andres Cabrera has officially released version 0.6.0 of QuteCsound. It’s available for download at SourceForge. If you’ve never used Csound, this won’t mean anything to you … unless you’re tempted to try it.

QuteCsound is a very friendly, usable front end for Csound. Steven Yi’s program blue is also an excellent front end, but it’s deeper and not quite so transparent, especially if you’re not yet familiar with Csound programming.

QuteCsound gives you a code editor with auto-complete and syntax coloring, a pane that displays the Csound manual, mouse-controlled graphic widgets, tutorials, and other handy features. After creating a Csound file, just click on the Run button and you’ll hear your work — no command line interface to wrestle with, no hopping back and forth between apps.

Csound would perhaps not be a great choice for creating pop music. It’s free and has an amazingly clear sound quality, both of which are strong features, but to write music you have to type the event list yourself, note by note. For experimental music, though, it just about can’t be beat.

Posted in music, technology | Tagged: | Leave a Comment »

Code

Posted by midiguru on June 10, 2010

If it was easy, everybody would do it. That’s a motto that I’ve found to apply to quite a lot of human endeavors. Playing the cello, certainly — but also putting together a portable, yet highly functional workstation for playing microtonal electronic music. (Portable because I have some devious idea about being able to take this music out and play it for people.)

After struggling with the concept for a few days, I may have a first, very rough approximation. I’ve found that Csound can respond to MIDI input on the MacOS with low latency and good stability. In Windows, it’s a little glitchy, at least on my system. I haven’t yet tested whether it will play multiple notes on complex instruments in the Mac without spitting up. We’ll see.

One advantage of Csound is that it’s free and cross-platform. Another: It’s a very sophisticated audio programming environment. Yet another: Csound doesn’t try to enforce a 12-notes-per-octave tuning. You can devise whatever strategy you’d like for deploying pitches. The downside is, to create synthesizer sounds you have to write code. Likewise with composing: You get to type an event list. This is not an instantly gratifying activity.

I’m starting to see why drone music is so popular — not among listeners, perhaps, but among composers. You can generate a long piece more quickly if there’s a lot of repetition. Plus, it’s easier to conceive of a piece of music as an entirely intellectual process if it’s drone-based. Trying to remember a catchy melody long enough to type it into an event list is just a wee bit awkward.

Still, with the plentiful real-time inputs to Csound, a drone piece could be made very interactive. Hook up a bank of sliders and then stop and start loops by assigning them to MIDI buttons or keys. Yeah, this could be interesting.

The problem of mapping microtonal scales to a MIDI keyboard remains. I’ve written a simple Csound routine to trigger whatever pitches I’d like from the keyboard, and I can remap the keyboard to different pitches instantly, while playing. That’s the easy part. The hard conceptual work is figuring out what combinations of pitches I want to play from the keyboard, in pieces that I haven’t even written yet.

It’s like the old gag about the furnace repair man. He comes in, looks at the furnace, kicks it a couple of times, and it starts. He then hands the homeowner a bill for $100. The homeowner says, “That’s outrageous! A hundred dollars? All you did was kick it. I demand an itemized bill!” The furnace repair man takes the bill back and writes on it, “Kicking furnace, $5. Knowing where to kick, $95.”

Remapping pitches to the keyboard: easy. Knowing which pitches to play, and why, that’s more of a challenge.

Posted in music, technology | Tagged: , | 4 Comments »

More About Tunings

Posted by midiguru on June 1, 2010

Thanks to the improved workflow in QuteCsound, it’s getting easier to experiment with alternate tuning systems. Also, I’ve learned a couple of tricks for organizing Csound scores.

While enjoying the pure sounds of just intonation, I’ve been realizing that I don’t actually mind 12-tone equal temperament (12ET, for short). It has a beautifully developed harmonic language, which is not the case with any alternate tuning.

Also — and this is a subtle point — with equal temperament, you always know where you are. If you’re composing in just intonation, arbitrarily tiny micro-intervals can flit around like gnats, and every chord root will tend to grow a different forest of harmonic possibilities.

Csound has a very nice opcode (cpsxpch) for experimenting with equal temperaments. So last night I thought I’d play around  little with 31-tone ET. 19ET and 31ET are notable Read the rest of this entry »

Posted in music, technology | Tagged: , , | Leave a Comment »

It’s … Blue

Posted by midiguru on January 24, 2010

Creating music with Csound is a slow and fiddly process, granted.  But I’m still playing with it. The essential thing, it seem to me, is this: Conventional music software makes certain assumptions about your music — that it will have a time signature, for instance, and that notes will be arranged in a scale with 12 notes per octave.

These assumptions are valid for many, many people. That’s why manufacturers make the assumptions: If people don’t buy the software, the assumptions are wrong, and need to be changed. But nobody is buying Csound — it’s free.

If you sit down to play the piano, or to write piano music, the nature of the piano will steer your creative effort in certain directions. That’s not a bad thing, it’s just the nature of the instrument you’ve chosen. You won’t be writing tones that glide smoothly from one pitch to another, for instance.

Conventional music software is rather like a huge, complex version of a piano. The options you can use go much further, but ultimately, you’re still dealing with piano-like notes. And because you can buy synthesizers that have hundreds or thousands of sounds that are ready to play, you’ll often be able to craft finished pieces of music without needing to think in much detail about the sounds you’re employing. You can just grab a preset and play it from a MIDI keyboard.

Your synthesizer’s browser probably has categories for bass, lead, and pad sounds, for instance. This makes perfect sense, but it embodies an assumption, namely, that your music will probably include a part that is functionally a bass.

Csound tends not to make that sort of assumption. It doesn’t even require that your music be constructed using a series of notes. Well, you need to put at least one note in your score, but it can be used to turn on an automated or interactive process that will run for hours.

Csound events are arranged in linear order on a timeline, because it’s the nature of music that it is heard over some span of time. But there’s no built-in concept of meter.

Nor will you find a large palette of pre-assembled sounds that you can use. Sure, there are lots of Csound instruments available online, and they’re worth study, but mostly they were created by a composer for one specific piece. They’re not likely to be something you’ll want to use without modifications. Or at least, that has been my experience so far.

In any event, Csound instruments are by definition almost completely modifiable by the user. With Csound, you really do have to think about every detail of the sound you want to create. That’s why it’s a slow, fiddly process. If you want a string pad, you start by listening to the sound in your head and noticing details. Then you use Csound’s tool palette to craft that sound. There are usually several ways to do whatever you’re wanting to do, but none of them is nearly as easy as grabbing a preset in a browser.

Csound is a blank canvas. Conventional, commercial software is like a paint-by-numbers set. It’s an amazingly complex and versatile paint-by-numbers set, but it’s not a blank canvas.

I’ve been learning the basics of blue, a feature-rich “front end” for Csound. Blue doesn’t eliminate the need to write your own code line by line, but among other amenities, it has a timeline with multiple tracks, much like what you’d see in a conventional sequencer. This speeds up the composition process, but without introducing too many assumptions about your music. At a basic level, blue is simply a multi-windowed interface with easy block copying.

There’s a lot more to it than that, which I haven’t explored yet. Blue allows you to make a few conventional assumptions about music if you want to. It has a piano-roll editor and even a tracker for building patterns and phrases the easy way. But I doubt I’ll find those very useful — and they’re not central to the interface, the way they would be in a conventional sequencer.

On the back end, blue hosts Python code, which can be used to generate Csound scores. Python is supported in native Csound as well. I have no idea how I would use it — yet. But using Python just seems a lot more interesting to me than inserting notes in a piano-roll editor.

Don’t ask me why. Something to do with brain chemistry, I suppose. Some people think it’s fun jumping out of airplanes, or watching football on TV. You gotta go with the juice.

Posted in music, technology | Tagged: , , | Leave a Comment »

Smooooth

Posted by midiguru on January 16, 2010

Computer programming is a fun hobby. (Yeah, I got straight A’s in math. You got a problem with that?) Actually writing a functioning Windows or MacOS application from the ground up would be way too much work. Fortunately, there’s no need to. Today we have lots of ways to poke around with programming languages and do fascinating creative stuff that builds on foundations laid down by more knowledgeable programmers.

That’s the fascination of interactive fiction. (And it’s one of the reasons I like TADS better than Inform. The tools are more sophisticated, and also better documented.) Writing IF is more fun for me than playing it, if you want to know the truth.

It’s also the fascination of Csound. Csound is an amazing resource, and you can get great results with only a modest investment in terms of study. Or … maybe not. I’ve been poking around in Csound for years, off and on. I probably know more than I give myself credit for. Plus, I have a copy of The Csound Book at my elbow, a copy I grabbed ten years ago when it was sent to Keyboard for review. It’s a $60 book, and it didn’t cost me a dime. (Just for the record: Yes, I wrote a review. I didn’t simply walk off with the book.)

Today I’ve been developing a better understanding of Csound’s method for producing legato. The trick with which one writes a series of notes in the score and hears them smoothly linked on playback is, like most things in Csound, rather tweaky. It involves giving a note a negative value for duration and then using a couple of special opcodes (tival and tigoto) in the instrument.

I had never understood the utility of the ppx and npx symbols in a score, but I get it now. They’re a convenient way of feeding data into an instrument from the previous or next note in the score, thereby giving the instrument the data it needs to generate a smooth transition into or out of a particular note. You could do the same thing by typing in the values using actual numbers, but that would be more laborious and more error-prone.

But as with most things in Csound, there are other ways to get the same result. My own method of generating legato lines is perhaps more primitive in some respects, but it has advantages. Using negative durations and special score symbols produces a legato line that is frankly (and audibly) made up of discrete notes. Each note remains responsible for calculating its own data values, generating its own envelope contours, and so on. You can do pitch portamento to make smooth transitions — or, indeed, amplitude portamento, pan portamento, or whatever sort of smooth transition you happen to need. But the notes are still beads on a string. This is good for certain types of music, less good for other types.

The method I developed myself, a few years ago, was to write one long note in the score and then use non-sounding “modulation” or “automation” score events to send the long note changing values using global variables. This is more work to set up (though the score may actually be a bit easier to read). The advantage is that it gives you arbitrary control over each sound parameter within the long note, at every moment. A transition from one pitch to another need not occur at the same time as a transition from one timbral characteristic to another. And pitch transitions, for instance, need not be simple ramps up or down from pitch A to pitch B: The legato instrument can begin an upward glide with a quick downward dip or vice-versa.

The legato line is now a single morphing entity, not a series of beads on a string.

You could do most of this with an off-the-shelf software synthesizer in a good host, using parameter automation. Not the pitch transitions, though. Conventional synthesizers are, almost without exception, designed to play MIDI notes. I’m not aware of any that can glide smoothly from one pitch to another across large intervals under automation control while continuing to sound a single note. You can automate the coarse pitch parameter of an oscillator, but it’s going to move in equal-tempered half-steps. (Ugh.) Pitch-bend data has its own horrible limitations. If you set the bend depth to two octaves, the resolution may be quite coarse, depending on the features of the software you’re using; and targeting the precise destination pitch that you want to reach at the end of the “bend” is likely to be impossible.

You can program a slow multi-segment pitch envelope, but the envelope’s breakpoint data won’t be in your score, it will be in the plug-in preset, and will have the same contour if you start another legato note/line with that preset later in the piece. So you store a different preset for each pitch contour you need, and then if you need to change the filter cutoff, you’ll have to edit that parameter for each of the presets. Plus, not all software synthesizers let you switch presets, so you may need to have several instances running, each with a different … no, let’s not go there. A multisegment pitch envelope may almost work, depending on the musical situation, but it’s certainly not a general solution to the problem, even assuming your synth has multisegment envelopes. (Many don’t.)

If you poke around for a while, you’ll find plenty of things that Csound will do that no commercial synthesizer will do. But that’s only half of the fun. The other half is the process of doing it yourself. The tools are rather obscure, so there’s an ego boost in listening to a phrase and saying, “Hey, I did it!”

Posted in Interactive Fiction, technology | Tagged: , , | Leave a Comment »

Getting Real (Time)

Posted by midiguru on January 4, 2010

One of tonight’s experiments was learning how to play Csound synthesizers from a MIDI keyboard. I recall vaguely having some problems a couple of years ago when I tried this, but for whatever reason, it was working okay tonight.

Not great — the latency on my new, fast computer was around 50ms, which is noticeable but not bad enough to drive me insane. With a more complex instrument, I might have to set it higher, and that would be a problem.

And of course, one of the charms (if that’s the right word) of Csound is that the user is responsible for scaling the amplitude so the output doesn’t clip. There are ways to do this, but you may not realize it’s approaching full level and about to clip with a 4-note chord … until you play a 5-note chord.

In sum, I don’t think I’d recommend Csound for playing keys at a lounge gig, not unless you’re really strapped for cash and can’t afford a program like FL Studio (which uses ASIO for low latency and has some very nice synthesizers as part of the package). But for slow, dreamy experimental music, where 150ms of lag between when you move a slider and when you hear the tone respond won’t even be noticed, I think Csound might work very well. Just be sure to include a master output volume slider in your design, in case the mix level inches up too high.

I also dug into The Csound Book today and read up on waveshaping. The algorithm for producing controlled, fat-sounding distortion turns out to be quite simple — about four lines of code. Getting good sound out of an instrument is a challenge for any musician. Being able to look up a formula in a book is certainly pleasant. (I’ll bet my cello students wish it were that easy!) But learning where and how to apply the formula to get good musical results — that will take a little more time.

Posted in music, technology | Tagged: , | Leave a Comment »

Too Many Notes

Posted by midiguru on January 3, 2010

It was 1983, or possibly the end of 1982. The first keyboard with MIDI, the Sequential Circuits Prophet-600, had just been released. The magazine where I worked (Keyboard) was keen to write about the new technology. So we prevailed upon Sequential to send us not one but two 600′s, so we could verify that this MIDI stuff actually worked.

I took them home and played with them. I recall making some tapes of double arpeggiator patterns by MIDIing one Prophet to the other. It’s entirely possible that someone who worked at Sequential tried them out at home before I got them, and of course other digital systems, from Roland and Oberheim, were being used at the time in numerous home studios.

But it’s possible that I’m the very first person who actually used MIDI in a home studio.

I got to thinking about this today because I’m not entirely sure I didn’t take a wrong turn there. MIDI is very good, you see, at playing notes. It was designed to play notes. Keyboard notes.

My studio at the time consisted of a Serge Modular synthesizer and a Tascam 8-track reel-to-reel tape deck. (I may have had a digital delay too. I know I had dbx noise reduction.) The Serge could be coaxed into playing notes — it had a 16-position touchpad “keyboard” with four analog knobs per pad, so you could program a separate four-note chord for each pad, if you didn’t mind spending 15 minutes getting the chords in tune. These were real analog knobs.

But notes were not really what the Serge was best at. It was designed to make pure, abstract electronic sound.

In January of 1985 or thereabouts, I acquired an Atari ST computer and got heavily into MIDI sequencing. I produced reams and reams of notes. I got rather good at it, I think.

Back before that, when the Serge and the 8-track were the whole show, I had envisioned a piece that I called “Standing Stones.” I never actually recorded or even composed it. The idea was to make a slow-moving abstract piece that consisted almost entirely of long, sustained bursts of rather dense tone — the aural equivalent of a photo collage of places like Stonehenge.

Maybe I was distracted by MIDI, or maybe the technology at my disposal wasn’t up to the challenge. The Serge was capable of making exactly the kind of tones I had in mind, but the prospect of trying to work out the complex relationships among dozens of dense, sustained tones using tape was just too daunting to contemplate for very long.

This week, when I started playing around with Csound again, I suddenly remembered “Standing Stones.” I now have, on my hard drive, precisely the technology that I was dreaming of 25 years ago. Sliding events forward or backward in time, adjusting their loudness, changing the color or position of one tone just slightly (after I’ve created it) so that it works better with the other tones that I’ve placed around it — this stuff is a stroll in the park with Csound!

This morning I designed some instruments. Modular synthesizer patches, if you will, a closely related suite of them. Tonight, over the course of two hours, I recorded ten “notes.” Every note required many, many tiny numerical adjustments — a slightly faster attack, a little more reverb, changes in some of the frequencies. The process is like painting or sculpture. It’s not “playing” music.

Some people might not consider the result music either. But they’d be wrong. It may not be great music; I’m not qualified to judge that. But there’s a lot more to music than just notes. In fact, when you remove notes and chords from the picture, all of the other qualities that make music interesting are thrown into high relief.

I do wish I still had the Serge, though. It would be fun to sample some real analog tones and slip them into the piece, just to see if they’d blend.

Footnote: The finished piece is now available as an mp3. The audio quality is of course very inferior, particularly as regards added noise, but in this particular piece added noise may not be an issue. Also available, in case anyone is interested, is the Csound file I used to create those sounds. I don’t claim to be an expert by any means, but there are two or three mildly interesting things in the instrument code.

Posted in music, technology | Tagged: , , | 1 Comment »

Vocal Synthesis

Posted by midiguru on January 2, 2010

Csound’s fof opcode synthesizes vocal formants very nicely. (Yeah, that’s what it’s called — fof. Don’t ask me why.) It can produce haunting “ahh” and “ooh” sounds that would be hard to generate with any commercial synthesizer. Well, maybe you could do it in Reaktor, but Csound is both less expensive and easier to use.

After playing around a little with the fof example from the manual, I decided to pry it open and make an “instrument” that had separate control of each formant during the course of the note. I’ve used this technique before, with other kinds of synthesis — it’s a form of automation. I can grab any formant within a sustaining note and slide it around in various ways. The vocal tone can morph from one vowel sound to another, and “vowels” that the human vocal tract can’t produce are just as easy to program.

I’m still not sure what I want to do with this musically. What I’m doing right now is the Csound programming equivalent of playing scales. I’m developing some techniques that may come in handy later. Csound truly is a musical instrument. And as Richard Boulanger points out in the book, as with any instrument, you have to practice!

Posted in music, technology | Tagged: , | 1 Comment »

Sounding Board

Posted by midiguru on January 1, 2010

A day of discoveries. This morning I decided that Csound’s built-in reverb generators are really just too awful for words, so I created a nice-sounding digital reverb from scratch. It wasn’t at all clear, when I started, that I had the DSP chops to manage it, but I looked up the recipe in The Csound Book, added a few refinements, and hey, it’s not bad!

Lexicon has nothing to fear from me, but I built a diffuser that gives me a nice stereo spread. What gave me a big head start was that computers are between 10 and 50 times as fast today as they were when the Csound reverbs were created. I don’t need to economize on CPU cycles.

After figuring out how to use Csound’s seqtime opcode to step through a table of note times, I built a little pattern generator to pull random notes out of a pitch table. Not much of a revelation, as I’ve done that kind of thing before, but I’m pleased with how it turned out.

You won’t hear the results on the My Music page of this blog, though. The little playback widget I use on that page won’t load and play .wav, and it won’t do .ogg either. It does mp3 just fine — but mp3 compression on Csound audio sounds like absolute crap. As far as I can tell, the mp3 codec is optimized for pop music. It operates by dropping out the stuff that pop music listeners won’t hear or notice. But if you give it something clean and spacious, it (the codec) has no alternative but to start tossing out stuff that can be heard.

Ogg is better.

Let’s see if your browser can load and play .ogg files. Probably not, but maybe you can download the file and then find a player. (iTunes doesn’t seem to like ogg, as far as I can tell.) This clip is not a finished piece of music, it’s just a sketch, but it’s kind of cute.

Posted in music, technology | Tagged: , | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 46 other followers