Software for Reverse Engineering Waveforms?


#1

I'm just curious if something existed that can extract functions from a waveform, preferably in the following manner:

Say I set it to sinewave, and fed it something that was close to a sinewave but wasn't one, it is able to calculate what function would need to be written into a custom function object in order to get the same, or a very close approximation of the wave I fed it. The idea is that you could copy and paste the function into an Axo object without needing to know how functions work or how to write them.

I'm just wondering if there is such a thing. I did a quick look into Scientific Graphic Calculators, they look like cool devices but they only appear to draw a waveform based upon a calculation you give it. So what I'm getting at I suppose, is a Scientific Graphic Calculator that can do the opposite. You feed laymen-understandable parameters to draw a wave on the screen, and the calculator gives you the math that was needed to create it.

Not being a math geek I can't explain it better than that.


#2

@axoman

I know this is probably not exactly what you are looking for... But Pure Data can do something similar but I am not sure with Axoloti.

In PD you can create your loco waveforms using any source you like.... and then write it to a table. As soon as you have written it to a table, you can right click the table and see a list of the values of every sample in the table. So you dont really get how to do the calculations, but you get all the numbers, that you can enter into another table/array and reproduce the waveform.

But yeah, I know not Axo, but in theory you could create the waveforms in PD and then use it in any other synth you feel like :slight_smile:


#3

I understand, but no, it's not what I meant.

What about function generators that design waveforms in general, are there any that output a math fuction that could be copy/pasted into an Axoloti object?


#4

I think what axo is after is a curve fitting function, rather than trying to reproduce the wave, something, I think briefly discussed here

i think as you want it the answer is possible no (except see below about re-synthesis) - if it were simple, i suspect it would be a rather popular synthesis method :wink:
that said, there are various programs which allow you to draw with various curve types, so you might be able to draw something similar ... albeit it might not sound similar.

of course, this is what re-synthesis is all about... so what they do there (as i understand it), is break a sound down into harmonics and then re-assemble using additive synthesis.
(the idea of additive synthesis is that any sound can be produce by the sum of enough sine waves)

then of course, we need to consider axoloti's processing power... a really complex function would take a long time to compute, so its probably not going to work well - so even if it could be done, perhaps not useful to axoloti.


#5

Never thought of explaining it like that, but spot-on Mark!

Does such a thing exist where you can create waveforms using functions interactively by changing dials or whatever, something that uses math functions like that teacher object Sputnki made, but with a lot more types of functions and blending modes available. I'm guessing that if there were, then it would be able to provide the exact math required to just paste into an Axo object that accepts math functions.

A sort of function designer thing really, but must be able to output the math.


#6

well there are all sorts of tools to draw equations... I kind of remember something in Excel that even tried to estimate curves... the issue being it spouted out hugely complex equations :wink:

i think those that need to do this kind of thing (e.g. scientists trying to describe stuff) tend to be well versed in maths, so they know the kind of functions they want to use.... say like a sound designer knows how to combined oscillators/filters...

that said, there are some really powerful mathematical tools out there, like R so perhaps they can do stuff... but im not a mathematician... so dont know that 'landscape' at all.

that also might prove problematic, equations are not generally described in C++ code, so there is then some translation to be done... also if it an intensive function, on axoloti it going to need optimising and that is non-trivial.

another question to ask yourself is why?
obviously a sampled waveform is fairly accurate...
so the benefit of a function is to be able to 'mess' with it real time (thats why physical modelling is so useful , imo) ... but perhaps you can get some of those benefits by doing re-synthesis and then additive synthesis.
(you'll still be limited to how many sine waves you can generate, but its more manageable as a problem)

will it get you where you want, probably not :slight_smile: but it might be a fun journey...

that said, seems like granular and fm is the fashionable thing at the moment, perhaps with this resurgence of digital, additive will make a come back.

btw: if you want to play with re-synthesis/additive l a bit, there are VSTs doing this, I quite enjoyed Icarus (tone2) ... but im sure there are lots of others.
also I learnt quite a bit, with an old windows app called AudioTerm... though its got quite a 'challenging' user interface :wink:


#7

I suppose that your "reversed calculator" is the Fourier Transform of the waveform!


#8

@thetechnobear
There's a few reasons I wanted it really. One reason is so that I can create my own distortion objects, basically an in followed by some math followed by an out. I can knock-up my own distortions by cabling stuff up, but I thought it would be cool to be able to look at waveforms, analyse the difference, and be able to generate the difference using functions.

Another reason is so that I can create wave-shaping stuff and oscillators that blend from one set of values to another. I know there are objects that do this, but they don't allow the design of the oscillator waveforms you're morphing between. That morphable knob on the Waldorf Streichfett for example, if I recall, I think that one does morphing between mathematicallly generated waveforms. The ability to morph rather than blend is really nice, and if what you're morphing between is at least reasonably representative of the actual waveforms you need, that's a really powerful thing to have.

@gabriel
Could be, Sputnki mentioned something about that in the other thread :stuck_out_tongue:


#9

Sounds like what you need is a Kemper Profiler. Does exactly what you want :wink:
https://www.kemper-amps.com/profiler/overview


#10

Interesting device, I can see the resemblance to the idea!

I wonder how hard it would be though, to first create an oscillator where you dial-in functions to shape a single cycle of the waveform, then create an object containing numerous blocks of these oscillators, say in configurations of 2,4,8, and allow morphing between them by attaching a dial to it?

I'm gonna raid Remco's thread and ask him :grin:


#11

I'm doing something similar. I created a waveshaper, which can provide an arbitrary transfer function. If you use a special exponential function (sign (x)*abs(x)**ln(g) g is gain =1.05...5 (e is no distortion)), you simulate any waveform shape from rectangle over normal form to triangle and sawtooth. Only thing to do is, to find the transfer function for your object (hint: send in a sine and use an x-y oscilloscope for both input - original and desired wave). Be careful to set both signals to the same phase. It works.
To see how it works, just replace x with sin(x) in graphic
If you got the REDUCE system, enter this:
plot(y=sign(sin(x))exp(ln(abs(sin(x)))ln(a)),x=(-6 .. 6),a=(1.1 .. 5), hidden3d);


To see the morphing from rectangle to sin to triangle.


#12

That looks like it's doing what I was talking about, but that math stuff is beyond me!


#13

I can send you a sample, though it's written for a Teensy. Send me a message.