Sine to square on complex wave?
This is doable, but could be prone to noise.
What you appear to be after is an output squarewave, which transitions on the defection point of the incoming signal AND whose amplitude is that of the transition point.

The point of inflection can be determined by differentiating the signal and testing for a sign change (+ve to -ve or -ve to +ve). 

A Sample&amp;Hold can then be used to influence the amplitude of the resultant signal. 

The concept is demonstrated below (crudely, for a 2min model...). How this is realised in practice is a different problem. The main concern will be the differentiator and the susceptibility to noise.

The incoming signal will need to be filtered and potentially a deglitch/retrigger function on the sample &amp; hold. This will impact your bandwidth. If the signal of interest is "slow changing" with regards to the processing you should be fine. You can see the impact of a fast-changing signal on the differentiator below as techically there was a very quick +ve change and a -ve change, but the fix-step sim triggered once. A 1kHz filter before resolves aspects of that 







WIth a 1kHz pre-filter (to manage the fast transition)




Now you can see there is an additional level change as the signal is slow enough for the fix-step 


  Do you know any part(s) that could do it?


To sample, to differentiate, to sample &amp; hold, to output... I doubt any dedicated analogue chip exists that does this. It could be built out of some OPAMPS, FETS, R,C ... A better solution would be to use a small uP and this would not need that much processing.