Happy Days

I have electricity again and the carillon near my house (in the shopping mall, I think) is playing The International.

So the electrician, who came here before the sun was up (which is to say before around 10 AM), spoke very little English and I speak very little Dutch. I described the problem over the phone to a coworker of his who told him what I said in Dutch. But then I realized I left out something important, so I waved my hands around a lot while repeating phrases in English, French and German. Most Dutch people understand German, although it tends to make them unhappy when I answer their Dutch with it. The languages are very close, so it’s confusing. Anyway.
There were sparks and stuff. It was exciting.
I created a profile for Other Minds on Myspace. The profile needs friends, but I’m worried about requesting friends because I don’t want to make people think they’re being considered for a festival as I have very little say in such things. So people should friend request OM and I’ll accept them as friends and good times will be had by all.
Speaking of OM, the festival is coming up tomorrow and if you are in or near the Bay Area, you should really go. I wish I could go.
Tags: ,

Electricty: not so fun

So the power went out in most of my apartment. After checking all the fuses (European fuses are weird), I called the landlord who double checked all the fuses and gradually revealed that he is entirely clueless about electricity and wiring. Finally, he called an electrician who will come around in the morning. The electrician said that we didn’t need to worry about fire if we didn’t hear sparks, smell smoke or sense heat. So we borrowed a long extension cord to get us from a working power outlet to the fridge and the heater and sat down for a nice evening at home in the one lit room.

And then about 5 minutes ago, all the lights came back on. wtf? The power being flaky seems like a potential hazard to me, so I just went downstairs and switched all the breakers off except for one. And I discovered that some of the lights that were working all evening were on a circuit that was mostly out. So before two electrical plus and a lamp were working. Then everything was working. Now that I’ve switched off all the breakers that had faulty sections, only one outlet is working.
Um, is this dangerous? Is my house going to burn down while I sleep tonight? Can I just turn everything back on and tell the landlord to cancel the electrician? What is going on? I just bought a couple of smoke detectors from a store nearby, but the test button only flashes a light but doesn’t make an ear splitting squeal, so I have no idea if they actually work or not. (French and American smoke alarms squeal when you hit that button).
I am not happy. Also, tomorrow is a holiday.
Tags: ,

Fat flying dog

My landlord has agreed to let me have my dog here and Cola’s parents have agreed to give her to me. All I need now is a “Pet passport” and some paperwork and to book her to be shipped with me. Hooray! Cola’s parents are going to buy Xena a flying crate tomorrow, so I’ll talk to a KLM agent on Monday with the exact crate dimensions and weight.

Speaking of weight, Cola’s mom wrote back with Xena’s current dimensions. She weights 63 lbs right now (29 kil0s). She should be around 40 – 45 lbs (20 kilos) ideally. She has to lose about a third of her weight. I’m kind of annoyed. I used to be able just to leave her food out and she would self-ration how much to eat, but I’m guessing those days are over. She didn’t actually like that dog food very much. It was super-healthy expensive hippy dog food. It had rosemary and artichoke hearts in it. I wonder if I can get it here. I saw at my local natural food market that they sell vegetarian dog food. Normally, I’m against such things because more fiber for my dog means more work for me (eww). Maybe it’s a good idea for now, though.
she also has kennel cough right now. I used to get her vaccinated for that, but I guess the vaccine must have worn off. I’m guessing she picked it up at her last vet appointment. She should be over it before January and ok to fly. I need to email her (Oakland) vet and make an appointment for diplomatic paperwork and also to see when I should get her the kennel cough booster. Poor dog is taking antibiotics right now. I wonder if they screw up dog stomachs as much as they do human stomachs? Should dogs eat yogurt while taking them?
I should be able to bike with the dog on the front rack of my bike, even at her obese size, although I’m not looking forward to going uphill in the wind with her being 10 kilos overweight. Her weight right now is like the equivalent of me weighting 200 lbs. Every time somebody keeps her for a long time for me, she gets kind of fat. I need to find the dog food that I guess she doesn’t like.
Speaking of my local natural food market, I was happy with them because I saw that they abstained from putting golliwogs in their windows. But then I saw the wrapping paper they have on hand. bah.
Tomorrow, a local flyer promises folks in blackface hanging out at the Grote Kerk (in my neighborhood), but I’m planning on going to Den Bosch (pronounced “dane boss”) to retrieve Cola’s new camera from the gay bar where it got left two weeks ago. I’m sure there will be plenty of folks in blackface there too. bah. On the plus side, they have a regional specialty called Bosche Ballen (pronounces “Boss-uh Ball-en”) which are chocolate covered fried cream puffs. Yum.
Tag:

Time domain frequency tracking for voice and tuba

A voice-like waveform, lovingly rendered in drawing software
There are certain timbres which are most easily pitch tracked in the time domain, rather than the frequency domain. The tuba is one such timbre. It, like the human voice, tends to have one large impulse followed by several smaller impulses. The large impulse is the fundamental frequency. The following little hills are overtones and formants and what not. For the tuba, every large impulse is caused by a single buzz of the lips. Lips flap open, impulse happens, impulse echos, lips flap open again, another impulse, more echoes inside the horn. Similarly, your vocal chords work in the same way. The vibrate like buzzing lips and echo in your head. So the fundamental frequency of your voice is the frequency of the large impulses, not the smaller ones that follow.

So to know the pitch, all you have to do is know how often those peaks come. How do you recognize the peaks? Well, they certainly spike up above the average amplitude, while also raising the amplitude. A good amplitude following algorithm is the Root Mean Square. Since the tuba and the voice have low fundamental frequencies (220 Hz for a typical female voice and the tuba gets down around 40 Hz and possibly below), it’s important to have a long enough window length for the RMS. You want to get enough samples such that you don’t have false positives.
Then, you can subtract the RMS from the original frequency. All but the high peaks will drop below 0. Then count the zero crossings. You’ll have to divide by two, since each peak crosses zero twice: once on the way up and once on the way down.
If you suspect that all of your pulse energy is negative for some reason, you have two options: You can try multiplying your original signal by -1 before subtracting. Or you can take the absolute value of the signal and use that.
Here’s some sample code for SuperCollider. Use headphones to prevent feedback and then sing into your computer. If your voice is low, you may need to adjust the window size. Note that it’s given in samples.

  SynthDef("test-time-domain-freq-tracker", { arg in, out, rmswindow = 200;
 
  var rms, xings, inner, peaks, sin;
  
  inner = AudioIn.ar(in, 1);
  
  rms = (RunningSum.ar(inner.squared, rmswindow)/rmswindow).sqrt;
  
  peaks = inner - rms;
  
  xings = ZeroCrossing.ar(peaks);
  
  sin = SinOsc.ar(xings/2);
  
  Out.ar(out, sin);
  
 }).send(s);

Tags: ,

Recent Events in My Life

On November 18th, I went to Den Bosch to hear the world premiere of The Game of Life’s Wave Field Synthesis doo-dad. It has 192 speakers. Some of the pieces were quite interesting, but all tended to over-focus on how you can do really nifty panning with so many speakers.

On Monday, I played in the Composition department concert at the Korzo Theatre in Den Haag. I played jaw harp in a sort of piece by Jerimiah. It was an odd and long piece that ended with Jerimiah burning the hell out of his arm with dry ice. Jackass-esque. He had to go to the hospital to get bandaged up at the end. I don’t know about performances that involve the composer injuring him or herself. I also don’t know about that performance artist guy who had his friend shoot him in the arm. anyway, some of the pieces in the concert were nice. Many were boring, alas. Almost all were too long. 17 minutes seems to be the magic length for the composition department. You need 3 or 4 ideas to fill that length. Less than 6 ideas, though, unless they’re all closely related to each other. Most folks had too few ideas. Jerimiah had too many, but he was the only one to error in that direction. The concert lasted about 4 hours. It’s very nice that marijuana is legal here. I enjoyed the second half of the concert immensely.
On Wednesday, I went again to the Korzo to hear a concert that had been done also the previous night for the Gaudeamus Festival. Tom Thalim had a piece in it which I liked very much. Also enjoyed the piece of Barbara Ellison especially. (she was also the composer of one of the better Wavefront pieces on the Staurday previous). Overall, the quality of performance was quie high. It was a good concert.
On Thursday, a bunch of folks came over for Thanksgiving dinner. We had lots of food and fun. Also, we now have a an oven.
On Friday, the department of Sonology put on a little concert backstage at the Theatre at school. It was a short concert. Only 45 minutes. Hooray for short concerts. Also, the pieces presented were very good. Most especially impressive was the first one, which featured speakers having down overhead on hinged boards. Two guys with long polls set the speakers going in a pendulum motion. Audience members walked underneath the swinging speakers. the composer of the piece (I wish I remembered who that was) very wisely picked short sounds with high pitches for a lot of his material. This kind of sound is easier to localize and so the effects of the swinging were very apparent. It was quite nice.
On Saturday, Cola and I went to Amsterdam to hang out a bit. We took in the tulip Museum. The most interesting part was the section on the tulip market crash, when irrationally exuberant day traders bid tulip bulb prices up to astonishing heights. You could have a collection of castles for what one bulb went for. Then the market crashed and all the day traders were screwed. My dad told me about this when I was a little kid. I spent a lot of the dot com boom trying not to think about it, card houses or naked emperors, lest I be perceived as one of those who “just didn’t get it.” Aside from that, the museum was kind of boring and I don’t recommend it.
We also went to a store called “Female and Partners.” I have no idea why this place is world famous. Good Vibrations and Toys in Babeland put it to shame. I was disappointed. However, on the way back to the train station, I did find a really warm, nice jacket. It’s made of hemp and so has some silly features like a special pocket which can dispense rolling papers and a few hidden pockets. It’s got a faux fur lining and is water proof. My life is now that much better / warmer.
On Sunday, we went to Brussels. It’s a day trip to Belgium from here! We went to the Musical Instrument Museum there. The museum is one of the best I’ve been to. A very smart curator came up with the idea of giving people radio headphones. If you stand in front of a display case wearing the headphones, you hear typical pieces of music featuring the displayed instrument. Looking at instruments in glass cases is interesting, but it’s better to hear them too.
The museum has a complete set of Saxhorns. Adolphe Sax was the guy who standardized the tuba family. The actual horns made by Sax! I’d never seen them before. The also had Russian bassoons and something called a Monsterophecliede – a ophecliede with a dragon’s mouth. Think of a sort of bassoon-like instrument, but played with a tuba mouthpiece and instead of coming up like a stove pipe, it comes up like a monster.
Lurking hidden away in the basement, are 20th century inventions, like synthesizers and electric guitars. Also relegated to the forgotten floor are bells. Bells are great and deserved more space.
Anyway, the museum is great and should be seen. Don’t forget the basement.
We then wandered around town for a bit and saw the Hôtel de Ville, which is amazing. And then some overly hyped fountain called Manneken Pis. It’s a boy peeing. Across the street, Cola bought snails from a street vendor. We walked around a bit more and then came home.
Tags: ,

New Phone Numbers

Hello all, I have some new phone numbers. +31(0)614132676 works right now. The other number, +31(0)708888187 will start working by the end of the week. My French number still works also: +33(0)667382191

If you are calling from within the Netherlands (or France, for the French number), you leave off the +31 (or +33 for France) and dial the 0 in the parenthesis. If you are calling from another country, like the USA, you dial 00 31, skip the zero, and dial the rest of the numbers. I pay roaming charges for the French phone, so I’d prefer if you call the Dutch numbers unless you’re in France, or if you know that I’m in France when you call.
Tags: ,

Women Take Back the Noise

The new anthology, Women Take Back the Noise is now available via http://ubuibi.org/wtbtn. It looks really cool. Alas, I am not on it because I was confused by the context of the call for works.
The blurb on the webpage says that the CD case actually makes noise when you touch it. I think these little circuit things people are starting to do for distribution are the future. Anway there are only 1000 of these available (well, 999, since one is mine), so order quick if you want one.

Tags: ,

How to write a SC plugin / Biquad filter!!!

The tutorials in the SC distro are not really great on how to do plugins, so here’s my version. After you get the SC source code (an exercize left to the reader), you’re going to want to build your own copy of SC. This should not be the same copy that you use for doing your music, because development tends to break things and you don’t want to break your instrument. First build the Server, then the Plugins, then the Lang.
Once you’ve done that, open the plugin project with Xcode. In the Project Window, pick a target and ctrl-click on it to duplicate it. Then option click the new target to rename it to [whatever]. Double click on it to bring up the target inspector. In the summary, rename Base Product Name to [whatever].scx .  Then click on “Settings” in the list on the left. Change Product Name to [whatever].scx .  Close the target inspector menu and go back to the project menu. Drag your new target into the list for All, so it gets built when you build all.

Ctrl-click on your new target again to Add. Add a new C++ file. Don’t generate a header file for it. This is my example, a biquad filter:

/*
 *  LesUGens.cpp
 *  xSC3plugins
 *
 *  Created by Celeste Hutchins on 16/10/06.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

// all plugins should include SC_Plugin.h
#include "SC_PlugIn.h"

// and this line
static InterfaceTable *ft;

// here you define the data that your plugin will need to keep around
// biquads have two delayed samples, so that's what we save

struct Biquad : public Unit
{

    // delayed samples
    float m_sa1;
    float m_sa2;
};


// declare the functions that your UGen will need
extern "C"
{
 // this line is required
 void load(InterfaceTable *inTable);

 // calculate the next batch of samples
 void Biquad_next(Biquad *unit, int numsamples);
 // constructor
 void Biquad_Ctor(Biquad* unit);
 
}

//////////////////////////////////////////////////////////////////////////////////////////////////


// Calculation function for the UGen.  This gets called once per x samples (usually 66)

void Biquad_next(Biquad *unit, int numsamples) 
{

 // pointers to in and out
 float *out = ZOUT(0);
 float *in = ZIN(0);
    
 // load delayed samples from our struct
 float delay1 = unit->m_sa1;
 float delay2 = unit->m_sa2;

 // the filter co-efficients are passed in.  These might change at the control rate,
 // so we re-read them every time.
 // the optimizer will stick these in registers
 float amp0 = ZIN0(1);
 float amp1 = ZIN0(2);
 float amp2 = ZIN0(3);
 float amp3 = ZIN0(4);
 float amp4 = ZIN0(5);
 
 
 float next_delay;
 
 // This loop actually does the calculation
 LOOP(numsamples,

  // read in the next sample
     float samp = ZXP(in);

  // calculate
     next_delay = (amp0 * samp) + (amp1 * delay1) + (amp2 * delay2);

  //write out result
     ZXP(out) = next_delay - (amp3 *delay1) - (amp4 * delay2);

  // keep track of data
     delay2 = delay1;
     delay1 = next_delay;
     
 );
 
 // write data back into the struct for the next time
 unit->m_sa1 = delay1;
 unit->m_sa2 = delay2;
 
}


// The constructor function
// This only runs once
// It initializes the struct
// Sets the calculation function
// And, for reasons I don't understand, calculates one sample of output

void Biquad_Ctor(Biquad *unit)
{

 // set the calculation function
    SETCALC(Biquad_next);
    
 // initialize data
    unit->m_sa1 = 0.f;
    unit->m_sa2 = 0.f;

 // 1 sample of output
    Biquad_next(unit, 1);

}

// This function gets called when the plugin is loaded
void load(InterfaceTable *inTable)
{

 // don't forget this line
    ft = inTable;

 // Nor this line
    DefineSimpleUnit(Biquad);
}

Ok, when you build this, it will get copied into the plugin directory. But that’s not enough. The SCLang also needs to know about your new UGen. Create a new class file called [whatever].sc .&nbsp You can stick this in your ~/Library, it won’t mess up your other copies of SuperCollider. This is my file:

Biquad : UGen {

 *ar { arg in, a0 = 1, a1 = 0, a2 =0, a3 =0, a4 =0, mul = 1.0, add = 0.0;
  ^this.multiNew('audio', in, a0, a1, a2, a3, a4).madd(mul, add)
 }
 
 *kr { arg in, a0 = 1, a1 = 0, a2 =0, a3 =0, a4 =0, mul = 1.0, add = 0.0;
  ^this.multiNew('control', in, a0, a1, a2, a3, a4).madd(mul, add)
 }
 
}

The multiNew part handles multiple channel expansion for you. The .madd ads the convenience variables mul and add. Your users like to have those.
I don’t know if a biquad filter comes with SC or not. I couldn’t find one. They’re useful for Karplus-Strong and a few other things. For more information, check out the wikipedia article on Filter Design
Tags: ,

HID, SuperCollider and whatnot

My HID classes are now in version 1.0 and I’m not going to change them again without good reason. The change is that the call back action passes the changed element back as the first parameter, followed by all the other parameters. It’s redundant, but it matches how the subclasses work. This should be usable for HID applications. a helpfile will be forthcoming.
I am trying to write a Biquad filter UGen and also to compile a FFTW UGen that my friend wrote. Jam fails when I try to compile, on both files. I think there is a step missing in the howto document on Ugen writing. My code is simple and the syntax looks ok. I’ve done every step (as far as I know) in the howto. bah. I could use a better error message than “jam failed.” sheesh. I like XCode, but it’s got nothing on the Boreland compilers I used to use back in the 90’s as far as usability and usefulness of error messages.
Workaround: Take an existing target and duplicate it and use that for your target. Rename it and replace the files in it with your own. Ctrl-click on the target to bring up a menu with the option to duplicate.
Tags: ,