Forums > MaxMSP

### Neural Oscillator/ sample-wise iterative calculations Troubleshoot

Jul 18 2010 | 9:39 am

Hi,
I’ve been using PD for years, and recently tried out MAX and have thinking of moving over – nice to have properly implemented presets etc. I’m having teething problems porting a PD patch though – mainly because there doesn’t seem to be an expr~ object for windows in MAX. I do stuff like this quite a bit, so if it turns out to be a PITA in MAX I may just stick with PD.

So two questions – first, is there an expr~ object for Win hanging around the web somewhere? I can’t find one. (If not, this seems crazy, expr~ is so useful).

second, if there isn’t one – can anyone see what I’m doing wrong in this patch where I’ve implemented using the basic maths objects? It’s probably something incredibly stupid and basic to someone familiar with MAX. The patch implements the oscillator formulae listed in this paper
http://www.ecila.org/ecila_files/content/papers/ACEICMC05.pdf

BTW, the paper is worth a look even if you can’t help but you’re interested in using neurological ideas in music, or just in noisy exotic oscillators

I’ve attached the functioning PD patch and the non-functioning MAX patch. If you’re familiar with both I’d really appreaciate your taking a look at what I might have done wrong in the MAX patch.

btw
If anyone just wants to have a crack at building a patch themselves for their own use, here are the formulae (there’s a slight error in the paper compared to matsuoka’s formulae for a neural osc, and anyway I think writing them out like this is easier to follow for patching)-

For each formulae output is at n1, and each of the variables at n-1

X1 out
=((C-x1-(B*V1)-(G*max(x2,0))-(H*max(input,0)))/T1)+X1

V1 out
=((max(x1,0)-v1)/T2)+v1

X2 out
=((C-x2-(B*V2)-(G*max(x1,0))-(H*min(input,0))/T1)+X2

V2 out
=((max(x2,0)-v2)/T2)+v2

Audio Output
MAX(X1,0) – MAX(X2,0)
Where
(internal variables)
x1 = output of neuron 1
x2 = output of neuron 2
v1 = inhibition of neuron 1
v2 = inhibition of neuron 2
max
(System variables)
T1
T2
the t variables determine shape and frequency

C = tonic excitation – determines output amplitude
B and G are constants
H is the weight of the input

###### Attachments:
1. neurosc_node.pat
Aug 01 2010 | 4:33 pm

very interesting. i will read the paper when I find the time. thank you!
can’t help you with trouble shooting the patch right now either, but regarding expr~; there is an object floating around somewhere, although when I tried it (back in max 4 days) it was not very stable.

here it is, maxobjects.com still links to it.
http://www.mat.ucsb.edu/~wakefield/soft/expr~.zip

Aug 02 2010 | 1:33 am

I’ve not taken the time to look through this extensively, and when I do I think it might be slightly above me ;)

However, my first thought is about the [delay~ ] objects in [822.neurosc_node ] that are directly after the [patcher "equation" ] sub-patches.

As far as I know, the [delay~ object defaults to a delay time of 0 samples if there is no argument; in these sub-patches the [delay~ ] objects are not doing anything at all. So, what were you expecting the delay to be? If you want a delay of 1 signal vector size, you can use send~/receive~, or use [dspstate~ ] to set the [delay~ ] objects.

If that doesn’t help, or if the non-delays are there from some previous patch-experimenting, then I’m not sure what the issue is.

I’m going to look into your patch and the paper though, it seems really interesting!

Aug 02 2010 | 2:14 am

Take a look through these max patches that Eldridge included on her thesis page:

and the thesis itself

the patch you are looking for should be there.

Aug 03 2010 | 10:49 am

Ta people. I’d not spotted Eldridge’s thesis or the files.
Actually quite glad I didn’t in a way as I’ve learnt a lot and generated a lot of ideas through trying to get this to work. I’ll grab the files when I get home though and see how hers differs from mine. Her thesis looks really interesting.

Tim – thanks, I think the delay issue is certainly part of it. I’d not really twigged that Max works on vector calculations rather than sample by sample (obvious now that I think of it – and feels like this one point has helped me understand so much more about how Max (and PD) does things, so I’m glad I got there the hard way)… If, on top of that, I’d forgotten to specify the delay time at all then I guess that goes some way to explaining why it wasn’t working!

Re: expr~ – thanks for the link. Looking into this has made me realise quite how inefficient expr~ and fexpr~ are. I think I’m going to have a proper go at learning Java for max to do these kind of things. I reckon sonifying non-linear equations could be a pretty fertile area and if I’m going to pursue it, then the ability to write externals is going to be fairly essential.

Ta
Dan

Viewing 5 posts - 1 through 5 (of 5 total)

Forums > MaxMSP