Page 1 of 2

Piano Synthesis

PostPosted: Sat Feb 29, 2020 7:27 pm
by martinvicanek
Inspired by Spoggs recent piano and e-piano simulations, I wanted to make my own e-piano synthesis. I am a big fan of the Fender Rhodes sound and I use it often on my tracks.

I failed miserably. Nothing I tried sounded anywhere close to an e-piano, let alone Rhodes. However, some of my attempts were closer to a real piano, so I thought maybe I can simulate that instead. Out came this little one trick pony, which I think is not so bad at least in the mid and higher range. I only exposed two controls for detune and volume respectively, so the user may select from a perfectly tuned concert piano all the way to a beaten-up honky tonk. The rest is burried under the hood.

The schematic is embarrasingly simple. I found that most important is choosing the right timbre and decay curves and their dependencies on velocity and pitch. If you miss by a few per cent, it no longer sounds like a piano.

Have fun!

Re: Piano Synthesis

PostPosted: Sun Mar 01, 2020 12:55 am
by adamszabo
Nice one Martin!

What does the "// check for changes" part do in the "q_max" code? I havent seen any conditional jumps like this before!

Re: Piano Synthesis

PostPosted: Sun Mar 01, 2020 6:52 am
by martinvicanek
Thanks, Adam. The check is to see if any of the 4 SSE channels has changed (due to a new note). Is there a better way to do that?

Re: Piano Synthesis

PostPosted: Sun Mar 01, 2020 10:25 am
by Spogg
Not a bad attempt Martin!

If you don’t mind, a few pointers for improvement:

Add key scaling for the decay phase because higher notes last for less time on a piano. Hint: The decay time transfer curve for a real piano is not linearly related to note number. This is due to different regions on a piano using different string mass. There is no standard break point for single overwound, double and triple stringing, so it’s down to your ears (and a fascinating topic to research).

Flanginess for detuning is best resolved by “phase scrambling”, so the partials have very similar amplitudes but different phases. That way there is less cancellation of higher harmonics and a reduced comb filter effect.

The spectrum at the low end is richer in higher harmonics than at the high end but has a lower relative fundamental amplitude. So once again, key scaling is your friend.

Cheers

Spogg

Re: Piano Synthesis

PostPosted: Sun Mar 01, 2020 11:56 am
by martinvicanek
Thank you, Spogg, your comments are always valuable and welcome!
Spogg wrote:Add key scaling for the decay phase because higher notes last for less time on a piano. Hint: The decay time transfer curve for a real piano is not linearly related to note number. This is due to different regions on a piano using different string mass. There is no standard break point for single overwound, double and triple stringing, so it’s down to your ears (and a fascinating topic to research).
Right. Key scaling or key tracking is absolutely necessary. In my little schematic I use decay times proportional to the fundamental period, so the higher notes do decay faster. I found that scaling quite okay. However, I also found that the decay process is not well described by an exponential so I had to modify that, too.
Flanginess for detuning is best resolved by “phase scrambling”, so the partials have very similar amplitudes but different phases. That way there is less cancellation of higher harmonics and a reduced comb filter effect.
Yes, provided that the scrambling is different for every oscillator. A decisive ingredient for string synthesis! I had experimented with phase randomization for piano synthesis before and it didn't sound right. If you listen to a real piano there actualy is some flanging at the initial stage, which makes sense because all three strings and their partials are excited with the same hammer blow. This flanging quickly disappears because the partials are slightly anharmonic and the strings are detuned by one or two cent (more for honky tonk).
The spectrum at the low end is richer in higher harmonics than at the high end but has a lower relative fundamental amplitude. So once again, key scaling is your friend.
The excitation spectrum is fascinating as it depends on the velocity, shape and hardness of the hammer, and many other parameters. My approach was that for a given velocity, the overtone spectrum extends to roughly the same cutoff frequency, so yes, higher notes have fewer harmonics. This scaling works well for the mid and high range, less so for the bass. I assume that is because the bass strings are wound. (As a bass player, I appreciate the crystal clear tone of Rotosound round wound strings. ;) )

Re: Piano Synthesis

PostPosted: Sun Mar 01, 2020 3:40 pm
by trogluddite
That's very interesting, Martin. I hadn't noticed your quadrature/exponent based oscillators before, and I've rather enjoyed playing with them; they have some very interesting tonal characteristics.

martinvicanek wrote:The check is to see if any of the 4 SSE channels has changed (due to a new note). Is there a better way to do that?

As I realised only a few days ago when optimising my "most recent note" module, there is indeed! If any SSE channel of a "block of four" has begun a new note, the sample counter 'ecx' will be reset to zero (presumably to ensure that note-on can never be "hopped"). If it's assumed that the player would get tired fingers long before the counter could wrap-around, even the "and eax" in the hop test may be redundant.

Re: Piano Synthesis

PostPosted: Sun Mar 01, 2020 5:05 pm
by Spogg
Key to decay time: When I tried your piano I quickly noticed that the overall decay phase was much too long on the top notes, so I assumed there was NO scaling! Apologies :oops: . The shortening of decay should be quite severe at the top end, so it’s just a question of tweaking your function.

Phase scrambling: Phase randomisation for each note doesn’t work because each successive strike of the same note will sound different. In my SIM-PF I used single cycle waves which had an appropriate partial amplitude balance for each octave but randomised phases. These are baked into the waveform tables, so sound consistent on each strike. Of course it’s a “cheat”, but the alternative of dynamic additive synthesis is unthinkable. :lol:

I’ve spent a few happy hours this afternoon making a few changes to your Piano and I think it sounds a bit improved, but that’s for you and others to judge. All changes documented in the change log.

Cheers

Spogg

Re: Piano Synthesis

PostPosted: Mon Mar 02, 2020 7:59 pm
by martinvicanek
trogluddite wrote:If any SSE channel of a "block of four" has begun a new note, the sample counter 'ecx' will be reset to zero.
Oh, that's very useful to know, thank you, Trog!
Spogg wrote:I’ve spent a few happy hours this afternoon making a few changes to your Piano and I think it sounds a bit improved, but that’s for you and others to judge.
Many thanks for the mod, Spogg! I realise that the assessment of "optimum" parameters is a subjective matter so it was probably not such a good idea to hide most of the controls in the first place. The user should be given the option to set decay times etc. that sound best to him or best suit his purpose.

Re: Piano Synthesis

PostPosted: Wed Mar 04, 2020 11:44 am
by kortezzzz
Hi Martin, thanks for sharing! For some reason, it doesn't works with the latest alfa version on my machine. Have you tried it there?

Re: Piano Synthesis

PostPosted: Wed Mar 04, 2020 11:56 am
by tulamide
kortezzzz wrote:Hi Martin, thanks for sharing! For some reason, it doesn't works with the latest alfa version on my machine. Have you tried it there?

Please accept, that everything on this very forum will exclude Flowstone Alpha. If something doesn't work ask for help in the slack group. I say this, because I want everyone who reads here to understand that Flowstone 3x and Flowstone Alpha are two very different things.

It's an alpha, and still in the testing phase.

So please, all who read here: Keep the alpha version excluded from this forum :)