Monday, 2 June 2014

Parking this again for a few weeks ...

...  but in the meantime here's a performance snapshot, grabbed from Instruments as the 'Fat Lady' configuration of POLYANA was running, so 11 synths configured, 10 of them active, 14 notes of polyphony in total.


This is running the 'high quality' version of the oscillator and filter, so is rendering at 88k and downsampling after the filter. Headline numbers from this run (in case you can't make them out above) are :

thrashFunction / thrashFunctionCore2 : 46.7% : these fill up otherwise spare cycles to make sure total is 100% and to make overall measurement accurate
synthEngine / synthEngine : 35.4% : These are the two audio render threads that do oscillator/filter/downsample/stereodelay, 32 samples at a time. The stereoDelay is about 10% of that, the time is dominated by the 'step32at88k' function which incorporates the oversampled oscillators and the filter.
synthesizeAudioPacket : 3% which dispatches work out to the render threads, gathers the results, splits them into 'clean' and 'reverb send' signals, passes them through the reverb then accumulates them

Not shown is the less than 1% of Core Audio callback management

Not a 'sleep' in sight, previously the device would typically spend 3% of its time in usleep, and would still be in danger of not making callbacks in time, resulting in occasional pops. That's now settled.

And today's debugging horror show was a propogating NaN that only appeared when the app was launched by a touch rather than by 'Run' in Xcode. Meaning I couldn't see printfs and couldn't run the debugger to work out what the hell was happening. Evil, and yet typical. It turned out to be an oscillator - the sub-bass oscillator in fact - being initialized erroneously with a frequency of zero, then being reciprocated to generate an infinite period ... NaN! Fixed.

UPDATE - ran it in 'no oversampling mode', backed off on filters wherever possible, just one synth render thread to simulate a Pi - 24% of iPad 2. This might work. Here's what it sounded like -



UPDATE UPDATE - it transpires that, the way the code was written, it was trivial - like 20 lines of code scattered around the application - to turn oversampled mode on or off, per synth. Which is actually very cool and flexible - synths that don't need a filter typically don't need oversampling either (although oversampling can make hardsync and ring modulation less alias-prone), so for a multi-synth arrangement with a bunch of digital synths and a couple of 'Moogy' synths, enabling oversampling for just the Moogy synths will deliver excellent overall results for a small increase in overall compute burden. Brilliant.

Wednesday, 21 May 2014

PIANA - hitting 8+ notes of polyphony on a Pi, one last time ...

I kicked off this latest round of work on PIANA with one goal - to get to 8+ note polyphony on a bog standard Pi, with all the features turned on. Meaning 4-pole filters applied to all notes, both oscillators active on all notes, the full quarterpounder cheeseburger with bacon. And sadly, since I started performance-testing (on an iPad 2) of the new codebase, it's been clear that this wouldn't happen, and that I would have to back off on requirements, and maybe only deliver 8 notes with the filter off.

This was bugging me, to put it mildly. Then I had a thought a few days ago that the oscillator might be reworkable - AGAIN - to double performance and improve quality, just like that. The problem with both the oscillator and the filter is that in order to eliminate aliases (in fact to minimize aliases, they never really went away) I had been running the oscillator, and as a result the filter, at 88.2kHz, then downsampling. I realized that there was a much smarter way to manage the bandlimiting on the oscillator that would cost me pretty much nothing, less than the current rather half-baked scheme, and it should do such a rock-solid job of alias management that it would allow it to be clocked at native sample rate, no oversampling. And with the oscillator at 44.1k I can then run the filter at 44.1k - at some lowering of quality, but that will have to be lived with - and double performance of the entire synthesis engine. Just like that. Thus getting me back to 8 notes and more with all the features turned on. Wouldn't that be nice?

So, I had an oscillator itch, and had to scratch it - so I redid the synthesis. AGAIN.

Here's some waves generated with the newest band-limiting oscillator to show you what's going on - first, a well-behaved pair of waves, both of them morphing continuously from sin through saw to square, with the Phase Distortion amount ramping down from 1.0 to 0.0 in the upper image, and ramping up from 0.0 to 1.0 in the lower one -


So far so good - looks like a phase-distorting, continuously-variable waveshape oscillator doing its thing. And no visible uglies in the high frequencies. 

So let's really test it from an aliasing perspective - this time, always a sawtooth, always maximum Phase Distortion. Remember, a sawtooth in theory requires infinite bandwidth on the vertical edges, and Phase Distortion ramps up the frequencies within the signal by a factor of 8. So a saw, with Phase Distortion, will generate signal with tons of frequencies that can alias down in a really, really bad way. 

So, here's that full Phase Distortion sawtooth wave, starting slow (50Hz), ramping up in frequency to end at 3kHz. 3kHz may seem low, but the sawtooth edges coupled with the Phase Distortion is generating frequencies MILES beyond Nyquist - the Phase Distortion alone pushes the wave well beyond Nyquist. And look how nice it is - 


A naive implementation would result in total junk on the far right, and in fact the wave below turns off the bandlimiting for comparison - note the total junk on the far right.



And in case quite what's happening here isn't apparent, take a look at a close up of the two waves - again the top one is bandlimited, the bottom one is not. Yes, there is a bit of ripple going on in the bandlimited wave, but the naive wave is going to hell in a handbasket, and there is no question that strong aliases are present in the signal and that this will not sound the way the keyboard player expected it to sound. 





So where is this? Right now it hasn't generated sound, only images. It will probably generate a sound some time in the middle of next week, not because it's hard but because I have more pressing things demanding attention. But this bodes well for a PIANA that hits 8 or even 12 note polyphony with filtering enabled, and that means that 8+ independent monosynths for 'Human League in a Box' applications should in fact be a practical reality for just £20. 

In terms of schedule for getting this out there, I now have a concrete, will-not move date. End of October, where I'm planning a full reveal, a first public demo of PIANA 2.0 - or is it 3.0? - and a release of PIANA to the wider world, to coincide with the first Raspberry Jam ever to take place in glorious Georgian Bath.  

So keep watching this space! 

UPDATE : done, generating music on the iPad. Overall gain for my 'Fat Lady of Limbourg' test was only 27%. Initially a disappointing result, but this test has 11 synths in total, mostly monophonic, pretty much all of them with an individual stereo delay, so the 'oscilator plus filter' that is being optimized by removing the oversampling isnt as dominant as it would be in a pure polysynth test. 

A quick reconfigure to a single 8-note polysynth with stereo delay and 4-pole filter yields a gain of 56% for non-oversampled vs. oversampled - much more like it. There's a little issue I need to fix in filter keytracking, the filter isn't resonating at the same place between the two builds, once it is I shall record some audio for comparison, and while I am at it I will roll in the 'PIOPTIMIZATION' into the non-oversampled and remove it from the oversampled, to give a single 'improved quality' setting. 

UPDATE UPDATE : I *finally*, 4 years on, as this is shared code between my iOS apps, have got my audio buffering and callback stuff right. Fully decoupled irrespective of buffer size requests from the OS (iOS 7.1 suddenly jumped its request size and broke my apps, forcing a fundamental re-re-rethink), and no sleeps except under exceptional and short-lived conditions. And this gives me a 'final' number pre-GUI, which is 

Platform : iPad 2
Rendering threads : 2 (this is 1 for Pi, 3 or 4 for quad-core devices)

Entire application : 95.6% of iPad 2
'Thrash' thread 1 : 27% (idle, thread ensures total is 100%)
'Thrash' thread 2 : 26.9% (as above, ensures both cores get saturated)

Hence app is consuming : 41.7% of iPad 2 of which 

Synth render thread 1 : 19.8%
Synth render thread 2 : 14.9%
Synth work distributor/aggregator : 3% of which reverb 1%
'Main thread' : 1.7%
AURemoteIO : 1.3% (CoreAudio callback)

I'll go into detail on how the audio buffer code is managed when I do the deep dive disclosure at the October Pi event in Bath. But there isn't much detail now, it's a) how it always should have been b) brainless but c) very efficient and well-defended against latency





Tuesday, 20 May 2014

Sopranotron is in the App Store


Here we are, just a couple of weeks after the recording session for the new operatic soprano vocal library, you can go buy yourself a whole Soprano on the App Store, in 2 exciting ways. 

If you like all your mellotronic stuff in one place, 'The Caitlin' (as her digital form has been affectionaly named by my wife) is available as an in-app purchase for users of M3000 50th Anniversary Edition, and M3000 Free Edition. Just buy, she installs, she appears as a set of 15 new voices within your existing app.  

However, if you are one of the increasing number of In-App Purchase refuseniks - and I have to say, I  do swing this way, I like to just buy an app and know I actually have all its features - then you can buy Sopranotron. Which is nothing more, nothing less than M3000 50th Anniversary Edition with a different splash screen, the Tape Store removed, but pre-loaded with 'The Caitlin' rather than a bunch of creaking, ancient yet somehow fabulous violins, flutes and haunting, disembodied choirs. You know, all that cool, cool stuff. Replaced with brand new, gorgeous, delicious vox humana stuff that sounds fabulous.  

Sopranotron has another advantage - the M3000 apps use on-device receipt verification, and this feature is only available on iOS 7, but Sopranotron works pre-iOS 7, hence it/she works on iPad 1. Actually, it/she works GREAT on iPad 1, with full MIDI support, '2 Tron' mode, chord pads, the works. So if you have a device that cannot run iOS 7 - that would be iPad 1 - or if you are an iOS 7 refusenik, and I suspect there are a few thousand of those out there - then Sopranotron offers you the opportunity to have a Soprano in your pocket, for just over a fiver. Actually, if you are an M3000 user you may wish to go for Sopranotron anyway, because then you can run M3000 and Sopranotron concurrently, and via the magic of 'Two Trons for the Price of One' you suddenly have 4 playable / sequenceable mellotrons available at the same time via 4 MIDI channels. Think what you can do with that ...  

There's an interesting observation I want to make here about iPad 1. Apple must have sold what, 5 million, 10 million units of iPad 1? Vast numbers of a truly amazing, breakthrough device. They are not all in landfill right now, that's for sure, so there's a whole bunch of them still around. They are excellent machines, about 2x the performance of a Raspberry Pi, with built-in battery, display, WiFi, fast (ish) 3D graphics, capacitive touch screen - in essence, perfect to turn into a performance musical instrument. Plug in a MIDI keyboard and you have an instant, cheap but very powerful synth. But increasingly, App releases will not run on them. 

There must be a big, big pile of frustrated musicians who would like to be able to run new App releases on their iPad 1, but just can't. So we are deliberately bucking that trend here - unless there are compelling reasons to do otherwise, for as long as we can possibly hold out, our apps will continue to be iOS 5.1 and iPad compatible. 

Sopranotron - really, how can you possibly say no? 


UPDATE - looks like a lot of you can't say no, we are on the day of release riding at the (relatively) dizzy heights of number 22 in the iPad Music App sales charts - thank you all for investing in Caitlin and us, we do hope you will enjoy the app, and we are looking forward to hearing lots of chartbusting records featuring 'The Caitlin' over the next few years. 


Monday, 5 May 2014

M3000 Free Edition is live on the store, and is AudioBus-compatible

If you have not yet made the leap to embrace your inner Prog, do it - it's FREE!

It has Tony Banks' actual, no messing about, genuine Watcher of the Skies custom tape. It's FREE!!

5 whole tapes, all from Streetly's production archive. And - it's FREE!!!

MIDI, AudioBus, actual, genuine mellotron production tapes. Genuine. And FREE!!!!!!

Seriously - why don't you have one yet?





Sunday, 4 May 2014

'You must be that opera singer I ordered' ...


I opened the day with a line I nicked straight from Mick Jagger, and after months of email trading and twitter chatting, two complete strangers finally hooked up at a bus station in downtown Bath (no trains on the route we needed on a Sunday ... ). One cab ride later a truly great day's work was started, capturing soaring soprano tones for the new M3000 voice library. Not a great day of work by me - just like 'Clare day', I did frankly zip. I sat there like a lump, so immobile I fell to the floor with leg cramp right as the last note went in the can. Before the comedy cramp - oh how we laughed, ha-ha! - I had grunted and offered occasional Eno-like Oblique Strategy production oversight. All the while Glenn did the second hardest job like the true pro that he is - getting the levels right, monitoring every sound over headphones, and driving Logic and keeping an eye on the Macs.

Of course all the really hard work was done by this girl, the totally brilliant Caitlin Downie, who those with long memories may remember from last summer. She was absolutely sensational, and made a very difficult piece of work seem effortless. Starting with a run up through the range of staccato 'ooh' and 'ahh' notes, a big set of vibrato-free sustained notes across her entire range, defying years of training to hold the vibrato back, then the 'rip off the roof' big notes, all the vibrato, holding nothing back. Over 3 hours of solid singing, and not even a whiff of a diva moment. The boys, used to rather more rock and roll stylings and temper tantrums, were frankly a wee bit in awe of her. She just oozes professionalism, nails the notes and has the most lovely tone. And is a total delight.



I now have my job to do - a few hours of aligning, chopping and tweaking and editing, and there's a bit of range at the top needs to be invented to pad out all 35 mellotron samples, but when I'm finished I expect this to be a very successful day's work of recording. She sounded quite fabulous, Glenn and I kept passing knowing grins at each other, little whispered 'oooh, she's good' and simultaneous little smiles as suddenly a human voice in the same room hit a velvety, chocolately level of deliciousness you just had to smile. Then she'd apologise for it 'not really being quite good enough, I'll do that note again'. Then she'd do it EVEN BETTER.

People will make beautiful music with today's work, for years to come  - isn't that a great thought?

Pictures above are by Glenn - obviously, as the careful observer will note that he has managed to sneak into shot a) 'Glenn in the 80s' with much more, much darker hair and b) a Stackridge poster. Way to squeeze in self-publicity, nicely done!!!

Here's the three of us, after the work was done -



Once the library's assembled, I shall post music. Don't touch that dial!



Friday, 2 May 2014

PIANA pewter

Remember this?




Here's the real thing, cast in solid, heavy, shiny and bloody gorgeous pewter. This is very much a first test, it will get refined soon, but it's nice to have it in my hand.




M3000 50th Anniversary Edition version 2.99 is in the store

And *finally* that audio initilialization bug is history.

Tuesday, 29 April 2014

M3000 Free Edition is with Apple for review

We've wanted to reduce the cost of entry for a while, and this seems the right way to do it, without eroding our already meagre incomes too much, and without diluting the Streetly brand equity.


So, say hi to the M3000 Free Edition. Basically, the Free Edition is EXACTLY the same app as M3000 50th Anniversary Edition, but it comes with the 'free voice pack' that's been in the Tape Store for a few weeks. The 50th Anniversary Voice Pack will be available in the Tape Store within the free app, at exactly the same price as the full app. So now you can buy before you try, which is only fair. And there is no financial penalty for doing so.

The voices supplied are

Rhodes - from the 50th anniversary app, a lovely sound and it looks awesome on the Oscillotron
Organ 3 - from Harry's Tapes
Watcher of the Skies Mix
Orchestra
Moog Whoosh from volumes 1, 2 and 3 of the Streetly Tapes

Otherwise full spec - MIDI, 2 Tron Mode, AudioBus, Oscillotron, chord pads. It is pretty great.

We hope you'll enjoy it, you are getting a LOT of app development, 5 authentic tapes from the Streetly production library, and a very giggable instrument for free.


M3000 v 2.99 is with Apple for review

Included the "which complete idiot failed to initialize x0 x1 y0 y1 in his Linkwitz-Riley filter class constructor, thus pushing absolute garbage, including propogating NaNs, into the audio pipeline?"bugfix.

Silence on app starup, and that rather alarming 'POP' on startup about to become things of the past.


For those not familiar with propogating NaNs, they are the kiss of death - once a number becomes a NaN, any arithmetic operation on that number yields a NaN. And since the filters are IIRs, they are never flushed to zero once the app starts. Hence audio silence forever if the condition arose.

Saturday, 26 April 2014

New recording session next weekend!

The second set of brand-new mellotron tapes will get underway next weekend, when all our diaries finally align with a free slot in the studio. The glorious Caitlin Downie - lovely, classic English tone coupled with enough projection to stop a tank battalion at half a mile - will be behind the mic, the trusty Glenn at the controls 'fresh' from tickling the ivories at a Stackridge gig in Sheffield the night before, I will be mainly observing and pretending to be Eno - 'More passion, Edge!! More angst Bono!! Make me feel it!! Make the guitar more infinite!!' - but without U2 cluttering up the place. We are aiming to record a complete 'female operatic vocal' library for the app store, capturing all of Caitlin's range in pitch, dynamics and tone.

The aim is to deliver 10 good voices out of the session if we can, the same way we did with the Clare Lindley sessions, which have been very well-received, and which sound totally fabulous. If we end up with fewer or more voices that's cool, I just want to make sure we get the best, highest quality, most flexible and most playable vocal library we can out of this single session. The App Store's first 'Virtual Soprano' in fact. If we can arrange the timing to make this new tape set coincide with the release of the Free Edition M3000 it will allow people to buy a unique Virtual Soprano instrument for under £5, which is a mighty good deal. They can always upgrade to a full-spec mellotron later.

Here's the in-app Tape Store shot, ready to receive a few hundred MBytes of wavs -




So, the App is ready, the Apple back-end is ready, the studio is ready, the talent is ready, Eno is unavailable so I'm ready, we just need a few hours of singing, a few days of editing and assembling, then we flick the switch.