## Algo to morph sound to sine or saw wave?

Sep 8, 2010 at 5:27am

# Algo to morph sound to sine or saw wave?

I’m thinking on how to implement morphing of the arbitrary sound wave to particular simple waveform (sine/saw/square). Preferably in realtime, some latency will take place of course
Here is a good demonstration of the effect, at 8:00

Do you have any suggestions on the algorithm?
I guess I need some fundamental detection, and fiddle~ or pitch~ are good points to start with. But Max5 crashes when I try to open their help files (which are in old max format) so I don’t even know if they can be useful in my case

#52225
Sep 11, 2010 at 11:48pm

that sounds promising :)

I had a quick look at the manual and there it says that these effects are precalculated and work on the zero-crossings of the signal.
In theory this is quite simple:
You take the segments between two zero-crossings and add or subtract a waveform of the corresponding length…

..but i don’t have any idea how this could be implemented as a max patch :(

#187701
Sep 12, 2010 at 2:55am

You might try looking up Larry Polansky’s ‘morphological mutation functions’ and ‘spectral mutation functions’ online. Might give some interesting ideas on how to proceed.

#187702
Sep 12, 2010 at 1:02pm

You might get something similar with waveshaping I guess.

#187703
Sep 12, 2010 at 4:09pm

you can put your audio sample into a multislider with peek~, store the multislider with [pattr], then interpolate between your original waveform and a pre-stored one (sine, saw, square, whatever). Pick an overall sample length (like 512 or 1024) and use that for everything, including your pre-stored sine/saw/square waves. You *must* have the same number of points in your sample as the ones you want to interpolate to.

#187704
Sep 13, 2010 at 4:43pm

Thank you all

mudang, that makes it clear, I had no hope they would write it in manual

seejayjames, yes, indeed, but first of all I need to detect frequency and phase for my waves

Steven Miller, interesting, I’m having a look

Do you guys have fiddle~ or pitch~? Can you post a screenshot of its help file? I would be very grateful for that, I still have problems with their help files

#187705
Sep 13, 2010 at 6:57pm

I’ve got pretty exhaustive fiddle~ description here
http://crca.ucsd.edu/%7Etapel/icmc98.pdf
So I’m interested in pitch~ help only

#187706
Sep 13, 2010 at 7:38pm

here's the pitch~ help patch…i don't know if it's up to date though

– Pasted Max Patch, click to expand. –

[attachment=141502,1127]

###### Attachments:
#187707
Sep 14, 2010 at 1:43pm