Algo to morph sound to sine or saw wave?

quatro's icon

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
http://www.youtube.com/watch?v=Gxbx-fvvsGI#t=8m00s

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

mudang's icon

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 :(

Steven Miller's icon

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.

Roald Baudoux's icon

You might get something similar with waveshaping I guess.

seejayjames's icon

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.

quatro's icon

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

quatro's icon

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

mudang's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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

1127.pitch~.help.png
png
quatro's icon

Very helpful, thanks a lot!