Since reading about why we should focus less on tuna+salmon+cod and eat more from the bottom of the seafood chain, I've been trying out lots of seafood that I haven't really had before. Here's some good and bad ones:
So what are the winners out of that lot? I liked the scallops, mackerel, tilapia and sardines, although the scallops were more expensive: £2.70 was a reduced price for a single portion with the chorizo etc, which is loads more than the other things, none of them cost even that much for two portions. The tilapia was a really nice white fish and the Marine Conservation Society says tilapia is good eating so I'll definitely try and buy that again when I can.
I haven't had kedgeree for ages, but somehow it felt like the right thing for a hot summer evening's teatime yesterday. This was partly based on memories of my mum's kedgeree and partly on some online recipes. Serves 3 or 4 people.
In a pan, heat up some oil. Chop the onion up and add it to the pan, with the curry powder. Fry the onion gently until softened, then pile the rice on top. Stir it all around, then add boiling water to come about half a centimetre above the top of the rice. Bring to the boil, stir once, then put the lid on and turn the heat right down. You'll be leaving this for about 25 minutes to cook gently, adding the frozen peas in the last five minutes so that they warm up.
In the meantime, hard-boil the eggs. (I put them in a pan of boiling water, took them off the heat, left them for 12 minutes to cook, then plunged them into cold water to stop them cooking.) Give them time to cool down a bit.
Break the mackerel into flakes, trying to pick out any noticeable bones as you do so.
When the rice+onions+peas is done, stir it with a fork to fluff the rice up. Peel and quarter the eggs, then gently mix the mackerel and eggs into the mixture.
Our Demon broadband service has been good for years, but over the past few weeks it's been really bad. We have had the same wifi router for ages (a D-Link) and it's been reliable, but in recent weeks the ADSL service has cut out completely, three or four times per day.
The wifi is still working (I can communicate from one local computer to another) but the connection to the outside (in either direction) is totally gone, and the "ADSL" light on the router is flashing indicating a problem. I can "solve" the problem by rebooting the router, but rebooting the router three or four times a day is completely impractical and a right pain - and, of course, 100% impossible if I'm away from home and trying to log in remotely.
(I'm actually having problems posting this blog article, since my connection only lasts about two or three minutes at a time this evening. Have rebooted router five times while writing this post. Cor blimey this is a bad service....)
I rang Demon customer service and I could tell I wasn't the only one having the problem - they've recently added a message saying "if you're having broadband problems try rebooting your router before ringing". I see from a recent news article that it is definitely affecting lots of people.
The first thing Demon told me to do was move my router so it was plugged into the main landline socket (not an extension) and try changing the microfilter. So eventually I found the kit for that and did it, but the problems were exactly the same.
Then I rang back, spent another 45 minutes waiting for an answer from the tech support, and after going through the same questions, the only thing they could tell me was "buy a new router". Hmm, so if the problem is that my router is crap, how come everyone's having the exact same problem as me, all at the same time? Everyone's router has broken at once? Not particularly likely. Apparently Demon have done some kind of "upgrade" to their broadband service, the details of which I don't know, but it looks like something might have gone badly wrong with that because lots of people seem to be having the same problem as me - a service that worked perfectly well and pretty much rock-solid for five years is now "upgraded" to a totally awful state.
IF YOU HAVE PROBLEMS: First reboot the router - turn it off, wait 20 seconds, turn it on. If you have the same as me (rebooting fixes it but not for long), try making sure your router is plugged into the primary landline wall socket (with no extension cables), and try changing the microfilter. Tech support will refuse to help you until you do those steps. Then if you ring tech support, they might say that your router must be faulty and try a different one. I certainly don't know of a wifi router I can borrow. But if everyone is having the same problem then it isn't our routers that are at fault but Demon's service.
One of the classic rave synth sounds is the "hoover", a sort of slurry chorussy synth line like the classic Dominator by Human Resource. I decided to recreate that sound from scratch, by reverse engineering the sound and recreating it in SuperCollider. Here's how to do it:
Analytical listening doesn't come naturally but it gets easier with practice. Listen to the target sound again and again, and try and get a feel for the different technical aspects of it. Does it sound bright or dull? Is there vibrato, tremolo, chorusing?
When I listened to the opening sound in Dominator I made the following notes:
There are various programs that can visualise the contents of audio. I like Sonic Visualiser. Just download it, use it to open an audio file, and then you have lots of nice tools like spectrograms, chromagrams, spectrums, pitch trackers....
So that's what I did. By visualising the original ("time-domain") signal and its spectrogram, I could first estimate the durations of things. The vibrato in the sound was indeed about 3 Hz: 0.335 seconds per cycle in my measurement. The duration of the main line was 1.929 secs, or 0.2412 per note if you divide that time into 8 equal measures. (I decided that the line was probably sequenced froma series of 8 notes, although it's hard to tell.)
If you find a pitch detector in the Transform menu you can get an computerised estimate of the fundamental frequency ("f0") and how it changes over time. In the following I've used two different pitch trackers (Yin, and Yin-with-fft) and completely coincidentally, the one marked in green seems to be finding the bass note while the one marked in purple seems to be finding the main synth note (with a few errors):
OK, so it's quite likely that our bass notes are around 70--80 Hz and our synth notes are around 280--300 Hz. This fits with my expectations after having some experience in this, but try synthesising specific tones for yourself if you're unsure:
x = {SinOsc.ar(290, 0, 0.1)}.play
In the picture above, notice how both curves seem to run closely in parallel, and also, imbetween the repetitions they seem to do a "scoop" right down to some very low pitch indeed.
OK. Next let's look at harmonics. If you choose Pane > Melodic Range Spectrogram you get to see this frequency analysis:
The lowest, thickest, yellowest band at the bottom is the fundamental of the bassline. It matches up with the curve we got from the pitch-tracker.
If the bassline were a pure sinewave then it would have no harmonics stacked above it, but that's not the case here. The next line above is fainter, and the one above it fainter still, and these are the first two harmonics of the bass tone (having pitch f0 * 2 and f0 * 3, respectively).
Just above there we see the fundamental of the main synth sound, at about 290 Hz, which has plenty of harmonics stacked above it too.
How do we know which is a fundamental, and which harmonics belong with it? I had a bit of luck with the pitch-trackers, but it's not always that easy. The fundamental is usually the lowest, the strongest, and the harmonics have a frequency which is an integer multiple of the fundamental. In this case it becomes a little more complicated, because I've asserted that there are two different synth tones (the bass does sound separate, to me). The trace at about 290 Hz is pretty strong, making it a good candidate for being the fundamental of our main mid-range synth.
If you look at the 290ish trace you can also see that the strength of that note seems to be wibbling in and out in a very stable pattern (about 3 Hz) - in other words it looks like a pattern of blobs rather than a steady yellow curve. So there must be some kind of modulation happening. From a spectrogram I wouldn't be sure if this was due to tremolo, chorusing or vibrato. But in combination with listening, I feel pretty confident that the chorusing is doing most of that.
So what do we know so far? Looks pretty clear that we have a main synth playing notes around the 290-300 Hz mark, with chorusing and probably some vibrato, and plenty of harmonics. We also have a bass synth whose fundamental is one-quarter of that frequency, i.e. two octaves below, and which also has some harmonics.
We know we're having a Saw wave with chorusing at 3.87 Hz. So how do we do that? Simply take the main frequency and add/subtract multiples of 3.87 to create a set of different frequencies. The following simple SuperCollider patch does that, as well as printing the frequencies for you to see:
x = {
var freq = 400;
freq = freq + (3.87 * [-1, 0, 1]);
"Frequencies: %".format(freq).postln;
Saw.ar(freq).mean * 0.1
}.play
Listen out for the regular pulsing sound, which should be happening 3.87 times per second.
In the above we created 3 Saw oscillators, using the array expansion starting from [-1, 0, 1]. Try using [-2, -1, 0, -1, 2] to increase it to 5 different oscillators, and see how the sound changes.
This chorussy sound is going to be the basis of the main synth but it'll need some tweaking before it sounds like the Dominator...
You know, I thought at first that I was sure there was some vibrato in there. You can add vibrato easily in the above patch, by inserting this line just before the Saw line:
freq = freq + LFPar.kr(1, 0, 10); // strong vibrato @ 1 Hz
...but I'm actually not sure if I was right, or if it's actually just chorusing that causes the wobblyness in the sound. Anyway, we will add a little bit and see how we go.
The pitch needs to slide around so that when we change midinote (e.g. hit a different note on a midi keyboard), it converges to that note within 0.1 seconds or so instead of changing instantly. It also needs to slide down to zero and back up again in that characteristic way which contributes so strongly to the overall feel of the synth line. (Sliding down to zero is probably what happens when you release the key on the original synth?)
In SuperCollider there are plenty of ways of doing portamento but I haven't quite hit the perfect one yet for this sound. The standard way is to use the "lag" message, e.g.
freq = freq.lag(0.1, 0.2);
which would apply an exponential lag so that the frequency takes 0.1 seconds to reach a new target if we're increasing the frequency, or 0.2 seconds if we're decreasing the frequency. There's also Ramp.kr() which can apply a linear lag rather than exponential. But so far, I haven't quite found a lag shape/time that quite seems to match what the original is doing. However, either of these two ways works fine and certainly gets us very close.
Here's a simple example of portamento:
x = {
var freq = Duty.kr(0.3, 0, Dseq([50, 55, 56, 52, 56, 28].midicps, inf));
//freq = freq.lag(0.4, 0.3);
Saw.ar(freq) * 0.1
}.play
Play it once, then un-comment that middle line to activate the portamento and play it again.
I wasn't sure if the bassy part was made with a simple siney bass oscillator, or with a similar saw wave as the main synth, so I had to try both out.
As a simple example, here's a saw wave with a bassline added one octave below (freq * 0.5) using a second Saw:
x = {
var freq = Duty.kr(0.3, 0, Dseq([50, 55, 56, 52, 56, 28].midicps, inf));
Saw.ar(freq) + Saw.ar(freq * 0.5) * 0.1
}.play
Now, change the bass oscillator from Saw to SinOsc and see what difference it makes to the sound. To my ears, one of these options kind of merges the two sounds while one of them produces parallel sounds with two different characters.
The pitch-tracker stuff from earlier can be useful in deciding which notes to play. If we have a frequency like 290 Hz, we can use that directly in SuperCollider, or we can convert it to a midi note number using 290.cpsmidi and we get an answer of about 62.
Another nice feature in Sonic Visualiser is the Chromagram, which takes spectrogram data and warps+wraps it so that you can see how much energy there is at frequencies corresponding to traditional western musical notes:
From this image we can be quite confident that D is the note that our sustained sound reaches, during the phrase. And this matches up with what we guessed from the pitch - midi note 62 is the note named "D3".
So, with a lot of guesswork I ended up with the following list of 8 midi notes:
[40, 67, 64, 62, 62, 62, 62, 62]
The "40" is an almost-arbitrary low note which drags the pitch down so it can slur back up again. Then we slur up to 67 ("G3"), then 64 ("E3") before our held note at 62.
If you put all the above components together you can create something approximating the sound at the start of the Dominator track. I did this, then I recorded the result to an audio file and loaded that into Sonic Visualiser as well. Then I could visually compare the results: Do the pitch traces look similar, curve similar? Do the harmonic strengths on the spectrogram seem to match up, or are some too strong? Is the overall "spectral slope" (relative strength of low vs high frequencies) OK? Does the chromagram show that I'm producing the same notes?
Of course you can then iterate this. Take your results and improve your model. The main tweaks I had to make, on top of my first attempt, were:
1: Bass not loud enough. I hadn't realised how much the bass amplitude really almost dwarfs the amplitude of the main synth. Probably this is because the main synth captures my attention more easily, so in my listening I give it prominence despite it being relatively weak.
2: Choice of bass oscillator. Generating the bass sound via the Saw oscillator (the same as the main synth) just sounds totally wrong. Simply synthesising using a sine-oscillator, plus a couple of quieter sine-oscillators for the harmonics which I saw on the spectrogram, gets it much better. (This is the classic additive synthesis approach, BTW: whatever you want, add sinewaves together until you've got it...)
3: EQ. The EQ balance is slightly different - my version needs more mid-range boost. Of course, most records have EQ added to their sound during production, they don't just use whatever comes straight out of the synth, so a little bit of this tweaking was likely to be needed.
4: Vibrato too soon, too much. The vibrato was a bit heavy, so I lowered the depth of the vibrato. In particular, it sounds good on the "held" note but when applied to the changing note it just sends the pitch wibbling around in an out-of-tune-sounding way, so I needed the vibrato to only come in after the main pitch has been held steady for a while.
5: Portamento. I haven't managed to get the portamento just right yet. As described above, the pitch curve seems to happen slightly differently in the original, compared against my version. There must be some simple combiantion of parameters that gets it, but I haven't quite hit it yet.
6: Goes bad when goes deep. The sound was pretty good on the notes and the way it slurred downwards, but after it had slurred downwards it became a rough kind of sound completely absent from the original. How to fix? Well in the end I added a low-pass filter connected to the main frequency, such that as the frequency drops right down, this low-pass filter squashes everything until at the bottom of the trough there's no sound remaining.
It isn't perfect but it's got most of the elements there.
There's some difference in the onset which I haven't yet got right: when the note kicks in and the pitch slurs up from zero, the original sound has more punch to it, as if perhaps there's some resonance happening in the filters due to the freq sweep, or perhaps just some ADSR shaping or suchlike.
(
SynthDef(\dominator, { |freq=440, amp=0.1, gate=1|
var midfreqs, son, vibamount;
// Portamento:
freq = freq.lag(0.2, 0.6);
// you could alternatively try:
// freq = Ramp.kr(freq, 0.2);
// vibrato doesn't fade in until note is held:
vibamount = EnvGen.kr(Env([0,0,1],[0.0,0.4], loopNode:1), HPZ1.kr(freq).abs).poll;
// Vibrato (slightly complicated to allow it to fade in):
freq = LinXFade2.kr(freq, freq * LFPar.kr(3).exprange(0.98, 1.02), vibamount * 2 - 1);
// We want to chorus the frequencies to have a period of 0.258 seconds
// ie freq difference is 0.258.reciprocal == 3.87
midfreqs = freq + (3.87 * (-2 .. 2));
// Add some drift to the frequencies so they don't sound so digitally locked in phase:
midfreqs = midfreqs.collect{|f| f + (LFNoise1.kr(2) * 3) };
// Now we generate the main sound via Saw oscs:
son = Saw.ar(midfreqs).sum
// also add the subharmonic, the pitch-locked bass:
+ SinOsc.ar(freq * [0.25, 0.5, 0.75], 0, [1, 0.3, 0.2] * 2).sum;
// As the pitch scoops away, we low-pass filter it to allow the sound to stop without simply gating it
son = RLPF.ar(son, freq * if(freq < 100, 1, 32).lag(0.01));
// Add a bit more mid-frequency emphasis to the sound
son = son + BPF.ar(son, 1000, mul: 0.5) + BPF.ar(son, 3000, mul: 0.3);
// This envelope mainly exists to allow the synth to free when needed:
son = son * EnvGen.ar(Env.asr, gate, doneAction:2);
Out.ar(0, Pan2.ar(son * amp))
}).memStore;
)
// This plays the opening sound:
p = Pmono(\dominator, \dur, 0.24, \midinote, Pseq([40, 67, 64, 62, 62, 62, 62, 62], inf)).play;
p.stop;
// And this plays the main synth line in the track:
p = Pmono(\dominator, \dur, 0.24, \midinote, Pseq([55, 52, 67, 55, 40, 55, 53, 52], inf)).play;
p.stop;
If you don't have SuperCollider... well why don't you have SuperCollider? Anyway I've uploaded a recording of the reconstructed Dominator patch. See if you can improve it, or recreate some other synth.
Update:
This article triggered various discussions online, and Wouter Snoei produced a version which sounds even nicer. He found the manual for the actual synth used, which described the unusual "pwm'ed sawtooth" waveform used in the synth (a Roland Alpha Juno 2). See the article More Dominator Deconstruction for Wouter's synth, and a graph of the unusual wave shape.
We've been thinking about how best to incorporate multicore processing into SuperCollider's audio engine. A bit of background: the trend in computing is that although computers used to have one single CPU to do all the thinking, the latest computers tend to have multiple CPUs (each with access to shared memory). Furthermore, it's now even possible to make use of the number-crunching power lying unused on many graphics chips - although that doesn't use the same shared memory so it's a slightly different situation.
This all means that most software, which runs on an "old-fashioned" single-core model, might not be using the full power available. There are libraries available to help programmers easily move into this multicore world, such as the well-established and very easy-to-use OpenMP.
How does OpenMP work? It's very much like a traditional threading model, where if you want multiple things to happen at once, you launch as many separate "threads" as you need. OpenMP simplifies this by automatically creating the threads as needed (e.g. it can automatically parallellise the separate iterations of a for-loop), and also by automatically distributing the threads over the CPUs. It's often called a "fork-and-join" model: when the program reaches a block of code which could be parallellised, it divides itself up into many parallel threads - and then when the parallel bit is over, the program logic all joins back to the single thread that started it all.
With real-time audio processing there's a complication. We want the software to take some chunks of input audio (if used), do some processing, and create some chunks of output audio, all within a very tight timeframe. This has a few implications:
So the question remains. Do we want to make our realtime audio apps multicore, and if so, how? You don't always improve things by spreading them over more cores, because of the inherent overheads I mentioned. However, on an 8-core system it certainly seems a shame to be limited to a maximum of 1/8 of the computer's thinking power.
SuperCollider has a nice aspect which helps here. The audio engine ("scsynth") is a separate application, and you can have multiple instances. So you could quite easily launch multiple audio engines, and have each one of them handle different parts of your audio scene. Great - nice and easy - although with some limitations. The different audio engine instances wouldn't be able to share memory, so sharing data between them is a bit of a pain. Also, it seems that you can't really guarantee which CPU core is used to run which process (the "affinity") - typically they would tend to be distributed over the cores, but it'd be nicer if we could guarantee that.
So, an approach to within-process parallellisation? Maybe we need to launch a thread for each core, and have these threads do a kind of busy-waiting until the audio callback wants some work to be done. Busy-waiting would be hard to get right though, compromising between responsiveness and CPU cycles wasted on the active waiting.
For a long time I didn't like having curly hair. It was ages before I realised that it was just that a lot of hairdressers don't know how to cut it. Obviously, there's more straight hair in the world than curly, and also curly hair acts completely different when it's wet (...it goes straight) so you kind of can't blame them, but still.
One of the basic principles seems to be "layers", basically letting the stuff on top be longer than the stuff underneath. (You can tell I'm not a hairdresser.) Before I went to anyone who knew this, either the top would look right, or the sides, but never both!
When I had my hair cut today, the hairdresser did a trick I've not seen before. She would take a little bundle of hair from on top and twist it into a tightish spiral, and then make a few nicks halfway-through the thickness of that spiral. So the end result is that that bundle of hair gets cut to different lengths, but apparently without going frizzy. I've no idea how the mechanics of that works, but I'll take her word for it.
The other thing that helps is "product". Some hairdressers have put gel on my hair and that looks absolutely rubbish, it basically sends me straight to the 80s. The place I go to at the moment uses stuff called "curl cream" (and the even more pretentiously-named "soufflé"). Who knows what they are? I can't tell you, I could tell you what's on their ingredients list but it's basically all the usual stuff you find on those bottles (copolymer this, cyclomethicone that, and of course "aqua"). It's not like gel because it doesn't hold as fast, but it seems to encourage a softer kind of hold which sort of lets curls curl together and not fall apart. "Curl cream" isn't a household phrase so I can't look it up or work it out...
Oh and something else. On the internet you will find various bits of debate about whether people with curly hair would benefit by not using shampoo - the reasoning being that shampoo gets rid of natural oils that let the hair curl non-frizzily, something like that. Some websites will tell you not to use shampoo at all, just use conditioner. Well in my experience that advice is along the right lines - but don't completely avoid shampoo, because your hair needs a proper clean now and again. For example, I wash my hair regularly but with nothing more than conditioner, and then maybe every two or three weeks I use shampoo. It doesn't look its best after the shampoo-wash you see, but it's certified clean :)
