Saturday, 24 January 2015

PICYCLE update

There was an irritating zippering noise in PICYCLE* that only appeared in the presence of rapid sweeps in parametric space, and that under typical mod wheel levels of rapidity - 10 or 20Hz modulation - was dominating the sound, a really horrible noise breakthrough. I eventually - last night in the shower, as always - worked out that it was exactly the same noise that had plagued PIANA for several weeks about a year ago, and that I could do something about it. I realized that it was a set of discontinuities caused by a few 'constant during the inner loop' assumptions, which then stopped being constant and jumped, in a highly discontinuous way, to different values at the next iteration of the inner loop. So, once it was root caused I knew how to fix it.

Except it turned out to be surprisingly complicated to fix. Not algorithmically, the algorithm is exactly the same secret sauce that de-nangered the PIANA oscillators - basically, discontinuities need careful management. But despite the 'simple fix', a surprisingly large amount of state needed to be managed, and switched inside the inner loop. But it is now fixed, and here's before and after audio for comparison. I don't have a recording of this as an example, but under slower parametric sweeps there's something you can hear, like a just-over-the-horizon thing, a sort-of-audible graunchy / 'buckling metal at the edge of perception' thing, but under these fast sweeps that you can listen to below, it's wretched. An ugly noise, like digital interference, and it gets louder and louder as the sweep frequency goes up.

This is just one oscillator running here so that you can hear what's happening, and it has an 8-wavetable 'twin trajectory' (or specifically, trajectory plus perpendicular) mode, with a 4-table X size and a 2-table Y-size. There is a very rapid sweep in Y (the short dimension, basically bouncing between the end points of a pair of tables), coupled with a not-quite-as-fast sweep in X, and the frequency sweeping up and down as well. All of which gives 3 potential discontinuity sources - X table shift, Y table shift and MIP level shift as the frequency of playback changes. Yes, there be MIP-mapping in here.

Here we are, with zippering noises (i.e. wretched - gritty, nasty Cadbury's Dairy Milk) :

And without (i.e. smooth as silk - luscious Swiss Truffles) :

And now I need to check performance on the Pi to see how much this has hurt me - I fear there may suddenly be a 40% performance droop ... but the quality is pretty great now, I have no fear of modulating these oscillators into the ground. No matter how hard I push them (within reasonable limts) they will be pretty much clear of artifacts, for sure clear of these discontinuity-based artifacts. And once again, for fear of repeating myself, I have to say - doesn't this sound like a resonant filter being opened and closed - like Eno and his solo during 'Blow Torch', that hilarious wiggle squee squaa beep beep squelch squoo - yet there isn't a filter anywhere near this, it's all about the spectral content inherent in the wavetables themselves. Smoothly gliding between wavetables results in the output spectrum tearing around as the parameter sweeps happen. Totally, totally brilliant. I think I shall very much love this little synthesizer when it gets a keyboard and some twiddleable knobs.

UPDATE : in a quite remarkable turn-up for the books, there appears to be no measurable performance droop associated with this additional state management and work. Maybe 1% more CPU is being burned, which is an additional 1 part in 12. Definitely worth it for this improvement. Excellent!!

UPDATE UPDATE : Phew. It gets better. Remarkably, in 'trajectory' mode - with a 1-D path for the wavetables, so there is a lerp rather than a bilerp - 4 note polyphony consumes only 7% of the Pi. That is amazing. Amazing. Basically, for 14% of a Pi I can run 2 copies, different tables, one detuned, one octave shifted, whatever - and generate VAST, moving, swirling sounds. Seriously, that is an amazing result. A couple of tiny glitches - like quiet vinyl pops on certain sweeps - in the linear version that I need to dig into, but nothing to worry about, and nothing that will affect performance to fix.

*pay attention at the back - PICYCLE is the new, jolly witty codename for the wavetable synth. Got that? Good.

Friday, 23 January 2015

Say hello to PICYCLE!

The wavetable synth just got a name. In fact 3 names in rapid succession, but she now has a permanent name. Permanent ish. A permanent codename anyway.

So - those with memories that stretch as far back as last week will remember that she was referred to in a Matt Smith / David Tennant kind of way as PIMEYWIMEY. Which was horrible, it hurt her feelings*, but I couldn't come up with anything better at the time. Then it struck me. UNICYCLE!! Because all her sounds will be generated from a single cycle of a complex waveform. See where I'm going there - UNI and CYCLE? Jolly neat if you ask me.

But even better - by running the 'twin trajectory' (ooh err missus) version of the wavetable oscillator - N waves in the X dimension, 2 in the Y dimension, she's got two whole parametric dimensions - she becomes BICYCLE. Yay!

And, she's a Pi, generating waveforms based on single cycles of samples. A Pi. Generating cycles. Hmm.

So she's officially PICYCLE.

Totally brilliant.

Now sadly there is an existing electric bike called PiCycle. But I think there is no danger of anyone realistically mistaking an electric transportation vehicle that retails at $6,000 with a £20 synthesizer. But even if there is - CALM DOWN, IT'S a CODENAME! OK?

So - officially, the wavetable synthesizer of the extended PIANA family is now "Codename PICYCLE"

*Yes, you CAN hurt a synthesizer's feelings.

Thursday, 22 January 2015

Wiggle - first sighting of wavetable synth

Wavetables wiggling ... very stupid test, 4 oscillators, each in 'bilinear' wavetable mode, each with a set of 4 different wavetables at each corner of a 2D parametric space, a slow sin wave moving in one dimension of the space, a rapid triangle moving in the other, a sin wave or 2 sweeping up and down through frequency space, all moving at different speeds. Yes, it still sounds like an alien with indigestion eating a synth sandwich, but considering there aren't any filters in here, it doesn't half sound like filters opening and closing. This could be a really nice synth once I have a keyboard hooked up to it and a mod matrix wired in. Very fast - OK, pretty fast - this test consumes about 10% of a 950MHz Raspberry Pi, implying a realistic 32 notes of wavetable polyphony with mod matrix / key response / other stuff overhead.

Correction : there is only around 54% of the Pi free due to other threads and other workloads, so don't expect more than 24 notes of polyphony from this particular configuration. Much more polyphony than the Virtual Analog synthesizer, and a good order of magnitude lower than the various sample replay options.

Wednesday, 21 January 2015

Quick remake / remodel of Pi base

The Model B+ demanded a slight tweak to the model I print off at Shapeways for my Pi bases. In fact this is nicer, as I can now integrate a micro-SD theft protection slot at the end, leaving the SD card encased. Not that anything would stop a thief determined to get their hands on a cluster of synths, but you have to try. 

Sunday, 18 January 2015

See you all at the Raspberry Pi birthday bash on 28th Feb

So, like a fool I volunteered to bring the "Raspberry Pi Synthesizer Dog and Pony Show(™)" to Cambridge so people could get their hands on stuff that makes noises, I got an enthusiastic "YES!" so I will be there. I say "like a fool" because you have no clue how busy I am. Oh well.

What I am hoping to bring -

PIANA : in whatever her current form is - I have not touched her for a few weeks, the poor girl, she probably feel neglected and rusty
PIANATRON : playing both mellotronish sounds and unmellotronish sounds
PICUSSION : let there be drums!
PIMEYWIMEY : yes, I still don't yet have a name for the timey wimey wavey gravy digital thing, but it is now making noises that are jolly interesting. Well, somewhat interesting. It has promise. Right now it sounds like digital indigestion and distant, eerie space station effects. All at premium sound quality. Premium indigitalestion is truly a sound to behold. Maybe "PINDIGESTION" is the right name?

What my fallback position is -

PIANA : in whatever her current form is. Which will be less exciting but we can always play Popcorn and be done with it.

And no matter what, the entire on-screen experience will be nothing more than a terminal shouting numbers, or a wibbly wobbly waveform in cycledelic acid flashback palette mode.

I will be presenting, and if all the synths are demoable they'll need to give me a solid hour, because I WANT THE AUDIENCE TO LOSE THE WILL TO LIVE as I drone on and on. It will be ace.

Tuesday, 2 December 2014

Morphing wavetables

Caitlin 'ooh' => Caitlin 'aah' => Caitlin 'eeh' => Oboe - 4 wavetables being morphed, showing 4 complete cycles in total, sort of a complete single cycle of each if only the morphing weren't making it confusing.

Fragments of Caitlin and Tron oboe were captured - because I had them on my iPad right next to me - upsampled 32x then auto-correlated to find extremely sub-sample accurate loop points, then resampled to become wavetables of 1024 samples in length, stored as shorts. This process is pretty automated now. At 1024 samples long the tables support frequencies down to 43Hz without stretching, and 8 progressively filtered octave tables are used for antialiasing letting me reach up to 5500Hz, higher than the fundamental on a piano can go I think.

During the inner loop 2 octaves of 1024 shorts from 2 wavetables form the working set, which is unfortunately 8kbytes / 2 pages of data, which may bust the data cache on really crappy hardware that has a 4k L1 and no L2 - not sure what the cache organization is on the Pi ... actually, it must be more than this or it just wouldn't run at better than a snail's pace. But I don't want to drop to 512-sized tables or things will get muddy and interpolated in the nice 'fattest string of a 4-string bass guitar' region where you want some top end to still be there.

This is effectively exploiting MIP-mapping in audio, but not the Lance Williams pyramidal thing, all tables are the same length as it makes the addressing easier / more efficient. The inter-level filtering is all done in the time domain, the pyramidal MIP levels (filtered down using a 'nicer than rectangular window' filter) form the skeletal sample framework upon which the full-length 1024 wavetable at each octave is regrown via a simple cubic interpolator / SRC thing. The strongest positive-moving zero transition is lined up at sample location zero, as I need to have zero be a reliably click-free point. Everything is implemented in integer / fixed-point for all sorts of sensible reasons.

It has to date only run on my Mac, but should synthesize PDQ on even very slow hardware, and the 4-wave morph will allow for some nice movement / evolution over time, particularly with A, B and C oscillators evolving or cycling at different rates, different feet.

So this project now has 3 synths. The virtual analog PIANA, the sample replay PIANATRON, and this freshly-minted 'pure digital' wavetable synth, as-yet nameless. Names on a postcard please ... but the ANA bit of PIANA isn't relevant here as it is indended to be filterless / pure digital. I wonder how long before I back off on that and get all Moogy on its sorry little ass ...

Monday, 1 December 2014

Picture in the Paper

A couple of weekends ago I took part in an art thing in Bath, where local people who 'did stuff' were called together, based on 'the stuff' they do, to have a group portrait taken. 'Stuff' involved people who live on houseboats, people who keep bees, people who play Minecraft, people who look after the sick, and in my case people who lash together truly awesomely, insanely great things using the superpower of software development. My wording, not theirs. They seemed to think we were just 'software developers'.

Remarkably, for a city that just had a whole digital festival, a mere 4 people rolled up to have their picture in the paper. And no girls. Shame on you, Bath - try harder next time!

This photo is scheduled to spend the next 100 years in the new ICA Centre for the Arts building at the University of Bath, which looks like a truly brilliant facility.

Here's the picture. Isn't the dog CUTE?!?! And also, as my wife just pointed out, with the jacket on I look like somebody's dad who wandered into shot, with all the proper software developers - Bill and Ted shirt, big metal hair, massive comic book collection (check), truly awesome All Your Base script T-shirt (check), brilliantly executed combo of skinny jeans, hipster uniform, post-Beatles haircut, girl-conquering smile and INSANELY CUTE DOG (check) - lined up on my left. Then this grey-haired bloke in a jacket totally letting the side down. I just wish we'd had some women to balance it up, it adds way more fuel to my STEM Ambassador fires.

Big thanks to Claire Sharpe and everyone at LOW PROFILE, and everybody else in Bath and Plymouth who contributed to making this happen, and I am so looking forward to the party in February. Yay! 

p.s. here's our collective mugshot for identification purposes - 

Wednesday, 19 November 2014

Being Boiled now works with no overclocking - without using goto!

Now THAT is a pleasant surprise. Some giant CPU spikes but heck, the GUI is running in the background. And no timing hiccups. Pretty immense at 700MHz.

Some of this may be because the oscillator got an update today - it had been nagging me at the back of my head, and I decided I needed to scratch the naggy itch. I had been rather perversely proud of the fact that the inner loop oscillator function had 12 goto statements in it. I love using goto in C++, so many times it delivers the most elegant, highest-performance solution, and I added the new tweaklet, and smiled at all those lovely gotos and labels. Lovely, lovely little things they are.

Then I realized that the most recent tweak had in fact - THE HORROR - left an opportunity to remove all the gotos, with no performance degradation.

So I did. And here we are - a goto-less oscillator, running Being Boiled with no hiccups at a mere 700MHz. Neat. But I will miss them.

Thursday, 13 November 2014

Great STEM event at BTE Academy, Bristol this week

I think some of the poor students lost the will to live during my little presentation (NOTE TO SELF - cut out 2/3 of the slides and get to the noises MUCH FASTER next time, OK?) but generally a success. The teacher, Miss Wilson, was great, the youngsters were peachy keen, and we talked and played synthesizers.

And the synthesizers sounded just like this - you have to love a nice synthesizer!

Two really great questions - "Do you make a lot of money" (somebody ALWAYS asks that - my stock answer - "I used to, but not any more!") and then the winner, "Do all synthesizers use exclusively sin waves to make their sounds?" - which was a GENIUS question, and sadly I went on a bit about Fourier analysis in order to hedge my answer. Which was "Yes, and no - let me explain something ... "

Friday, 31 October 2014

The iPad just got eliminated from my portable STEM kit

I no longer need to drag an iPad with me on my STEM Ambassador school visits - although I probably will anyway, just for the heck of it - because the Pi itself is now running an oscilloscope. 

Running it at 60 FPS as well, at least at PAL 576i and 480p, I need to check how well I cope with the increased slug on memory bandwidth due to 720p. This is while running 6 PIANA synth instances, 4 stereo delays, a global reverb, and a copy of CodeSequence. Neat, eh?

The oscilloscope here is showing a stereo trace, and this is automagic - if I detect that the signal being generated is 'pretty much' mono, the two traces gracefully collapse back into one. So I can fire up the engines, play a synth with a sin, a saw, a square, show and listen to the different waveforms with a nice, clear single waveform on screen, and educate the kids. Yay!

This is now a demonstrable complete package for music composition, arrangement and performance, plus it has flashy, fast, OpenGL-accelerated, eyeball-melting visuals to go with its quite brilliant sound quality. Push this out to the projector behind the band and you have instant synthpop live rig. Note 'demonstrable' is a long way from 'releasable' so hold your horses out there, I need to secure funding before this can get finished, any ongoing work right now is purely in support of STEM outreach, rather than preparing for a release.

And it's not just flashy visuals for eye candy either, this is valuable for diagnostic work - I fixed a synthesis bug yesterday in about 2 minutes, which I only diagnosed by having this display running. I could see the waveform glitching in phase at an 'interesting' point in the wave, which instantly showed me where the problem was and identified an annoying and occasional little 'zip' in the audio. Worth its weight in gold, this bit of code. 

And the coolest bit is, the sequencer is a whole different application to PIANA, but if it tries to connect to PIANA and it finds it isn't running it launches it anyway, so I only need to boot the Pi and fire up the sequencer. 

As you can tell by the rather graunchy and bitty quality of the visuals, there is no photoshopping here. Actually there is a bit, I never post a makeup-free selfie, dahlings - but this image is, apart from removing a few specks of dust from the screen and playing with levels, exactly what I could see as the display was running. It looks GREAT, way better in motion that static, but stills don't do it justice. I know that for a fact, I took about 50 over a 2 minute period and only this one gave a decent impression of how amazing this thing looks. Even video doesn't do it justice, unless you can grab 720p60. 

In case you forgot, this is what is was playing -