Slice Visualisation

This is pretty far down the list of interesting things to code, but would it be possible to create a visualiser for the slicing objects? Something in jsui would be neat where you pass it the source buffer and slices buffer as arguments and it creates a visualisation showing you the location of segments. My very limited GUI imagination would just have the bipolar waveform with vertical lines running through it.

My reasoning for this is tuning the parameters can be tiresome when you have to check aurally what the slices are like, where they are and how well they fit your idea of what is salient in segmentation.

EDIT:

I promise I wasnā€™t too lazy and did give it a whack with lcd and jsui but they were doing my head in, so deferring to those who are more fluent/proficient :slight_smile:

1 Like

Yeah I agree.

It would probably be quite easy to set up using the same warpy2.js (from the groove~ helpfile and the fabled ā€œbird finderā€ patch).

Can also just be a tie in with my suggestion for a better multichannel waveform display, especially since the slice point UI/UX is already in the warpy2.js file (though attached to stretching the buffer around.

Maybe a tweak on that would be using different ā€œpointersā€ at the top to designate the start and end of a slice (if future segmentation objects give onset and offsets).

@pasquetjeā€™s code on the code share thread does that already (and some cool warping)

Give us a fancy link!

The thread

Thanks @tremblap for pointing us to it and @pasquetje for making it :slight_smile:

1 Like

Youā€™re already lucky I did not give you a ā€˜lmgtfyā€™ā€¦

1 Like

Man, that subpatch for p fill_markers is confusing!

Thankfully a simple message of insertMarker2 $1 with $1 = phase position, is all the warpy op_warpy.js needs.

Any chance that that functionality (insertMarker) can get migrated into the (hopefully included) ā€œgeneral purposeā€ multichannel display jsui?

That way we donā€™t need a separate jsui for each type of thing weā€™re doing, plus, one might want to run fluid.transientslice~ on the output of fluid.bufnmf~.

I made an abstraciton which you can connect to the jsui for fast visualisation. This is basically a way of tapping into @pasquetjeā€™s work in a bit more straightforward manner :slight_smile:

https://cp.sync.com/dl/52ca47f70/ib78qhuu-9hhh8k8w-725habwg-wqwpqyy4

1 Like

Super handy idea!

Hmm, a bunch of stuff is named wrong (view_slice vs slice_view), and after changing everything (I think), the jsui is still complaining:

jsui: view_slice.js: Javascript TypeError: warps[after] is undefined, line 129
jsui: error calling function insertMarker [view_slice.js]

I also tried changing it to insertMarker2 like it was in @pasquetjeā€™s original, but that doensā€™t seem to make it any happier.

Sorry, I changed a few of the names after I gave the folder link. Everything should be working now if you start fresh. You will get thrown

But it still works.

I couldnā€™t figure out why the errors weā€™re being raised.

EDIT:

draw_slice is the abstraction
slice_viewer.js is the js
visualise_slices demonstrates usage

1 Like

Ok, played with it more now (I couldnā€™t get it to work at all before).

Some of the math was wrong in the abstraction (you were dividing by list length instead of the duration of the source buffer, meaning your first and last indices were 0. and 1., regardless of what they actually were).

Also made it so it trims off the last 2 slices (and doesnā€™t render the first) so you only load transients and not boundaries.

draw_slice:


----------begin_max5_patcher----------
999.3oc2X1kbaiCCG+Y6SAGM8QWuBj5Ku2g8DrSmNx1zYYhEoFJ4zzzo4ruT
fRMcaksXjQxjYeHVQzTB7Gwe.B3usbQzVyCxlH1ex9a1hEea4hE3PcCrn+9E
QUkOr6XYCNsHs7Kls2Fsx+UsxGZwgaJqpaZMUMOM7UlSsGkssesV5e8QMpaz
kGiVwhNbzT5drO0Oy5x1c+iReymsxcs9Iyi4qSWwRJxVGuhkm28ImuN9GOi9
TkR6d+3hBddPuUwQ48ip1iqP2p9iEQcC88kK69X00Q7evf0mk0.HLKtivTQb
GaohtaNOg7QID9cByHjvOx3mEPk9x3AfniKQp20sgH73DhWkSuhxVZjrooHv
bZUr.PHw0VYsTum0HaOKxgDVx8h1b9bfbDuZBkp1Zo7tmXGLlqI3rO8SBJhy
lfSQvblRHmmdTcVB2VpuoS0NbMzn0MnrMI9x7NdzpXDdSdOIdAWnI+0P8FSH
ksrsririS5Yw+tX5HuSLF5t.4vkS.CA6RoLejRev7zDgoNNOpZZeNGbf+SHx
998nbLkMDKlifXyH6QBB2id7HyJu+7J9vzAfWyKxmSj8HGKIHMSlttb2cWT1
GJlYnbmmxI53WAsw1GXpok6SoZEIndU.AUZUvnxSeGoZE4nir+.Xxjs.kM.b
qQom2IQCzA3kLpJNFxeENtcus7KaOc3fzdUrlFikGC.Um5BTJWsNaIY0VyNo
ahWaRnX7RAPjncy6ohnDtTquFEQk9drFJdg3mKhx0KKQEQ8+nZnF1i7JA5Jh
ZV0YV4BeKuQNxlTiz19Wk16jV1Gfgu+fQ21ndD2rvDSypm39eHm7j0YcQFa3
yIter9Jl0O1AZn4Ea6Se469S7iOGmh3PonnXXwryTUI0dGxvXJ8dIRS7LP0a
3nIcMYvlPPZboY7HHs4EiDZQWPn9W+wVwUc23+WNaLmr6FbZ9CAVwddcuW1z
pzksJi9mliqnbbRitU9RLD7VXnNgwjHsgBCE.QYDXmr.3wESe8FJM.CADXmj
fHhBsPRHHUPggRbuD9aBRB2KIaJuDItIdHadTDIk.gr6kQkklT5InxRSkdHI
lBKE+lwT.HkRjclRN3ZJEWLWsgdKx3IBIOjfBwfHHw.PkklTfSfg3gr4kQfZ
.MDDht6pQJDmDE6cPHECATDyNrubYKQwYsP5K3bo9IUo1Wabsb1Wkrnnu.d7
BOGqfGu6ZWagj0mhZ0f.pBf+69Ue+Bk002KsM8yFsgqCnaM1taKVg2pz9aw9
Thrx6UCyGazLpz55Jp00RzIKtthdHKIx+nl8Rq9jB68YYGcNShcWoKcMRWW5
AAaBa42W9uv++v77
-----------end_max5_patcher-----------

And a different top-level patch that works of fluid.buftransientslice~ so you can see more options.


----------begin_max5_patcher----------
1040.3ocuXssbaBCD8Y6uBFdlxHIt2oSm7ezoiGtHbTJW7HAwosS62dWsBrM
wNITaRxCDcYE5b1c0pC92qWYm09DWYa8YquYsZ0uWuZENjdfUC8WYWm9TdUp
BMytguuM6AaGyTc7m5vgKq5EEtY8kcxzFkf2zopD47+ZcWAOqsuIma46SIV2
gyC1YgyuYWq.L05N0O36s9DZv8Rt59x8EVT2wdYo4+.6tWzTztWI9E2h5OBh
JQCOG1CDIrgAa66p3cc+bG2vN6rzls1VeeX5coc42KZ1tQxy6LVD3E6RbrXQ
95+4SwddAtjCKpouVz.uUzSPONnYulLpn.cKfq5STa8P+Y8Z8CmY5lyaqqAm
3Y94unZ6k47uZ8kQG4WseYJkfTgFgOCSP5Q9+HD4bBk3cML5ERbJjo62f4B1
uTj6UiZXTJ.eFFfDjcyQrjqJjUyUpzs7yXnZZt9MPSSfL1+0oIatzLN5ZnYZ
WmrWLCVnMz3.fy1uRRpeByMPSHSZZ.YghhwjOF5crlzLHIgrrjLJ4igjGqC+
1jjF4svjL9ijjvUOyfi9gKLGupCiOnlECKEU7lzZt43HVL5QAeOW59fx9MJ5
3MT0IlhLkd6WHFEdbOk.p53xM.7xpP7QVvRu6js4vTVpxwoJagRv5ipvzdDW
+XlWhWTjGI1KH4ppLGFaRAHlDBeza46cyUm87WvaYAcBkb4em2EQkUsofxiY
HYJdfzglC7T10bXfcAtydO3doUlrWcOW4lJJWP16gmLnL5Bwd1jKtvWFpw8Y
5zQDoGepKwHPbfLCpYbrNhoBtpSzj1IZaNwH8YRsQWzsO2cBDT716zHbtsch
LicZJuqEEC48F09DLYkFiph8CBOuGKDinAvQ5fgd2HrgaqWHXGxNE1S58N.6
3kB1dAmB6I8dGfczRAaR7ovdRukG1Pg+YC6aZilScgwizmUPJc2tG4R0f03d
.UienEURE6fcEMlt32PZK4OJFsGq5YmJgRpcP8zdoQZxSglOp2ttsfKa.sM5
5lq0rC1RU2OqddQvCpZfaBB0WOfrAHSYZeU2TGP1171JCh9lkol8gGD2fi5A
yygO89DaItwZKh8RXzPcqHRRLwGW5gUouuAWyFQi1yvGWK91GebR5gyPvRp+
wRzTC4w.ApAzKFkCcZvcBgwKWdMJOgD9Lu.VhFHdQr.erEKxOftzvZhbrKCr
+CukyXzCTwVcfPqN7tfW1vs21akoEhi+rIC7mdHJFB+E4bwVmrUCKiMtrnXP
kXfyEac9xFWEKgPSvrEugrEcKXH5yVEHyv3jYQZROLJHccWqb7zHrzjC1220
dfniBlMGNewv2zSGyKJZDoL6rKLl4CoUDF1B3Lf4qMyxTjA01oAkZWpozEJA
b8eV+OnCJJWL
-----------end_max5_patcher-----------

This is quite handy as you can visually ā€œtuneā€ the threshold(s) for what looks appropriate (ala Liveā€™s UI for slicing).

Would be good to tune it to be more accurate (i.e. seeing the window offset), but Iā€™m now not sure if the window offset is in samples or ms (so I made a thread about it!). Sadly the compensation wonā€™t be generic as fluid.bufnoveltyslice~ doesnā€™t work the same way.

Thanks for those additions and corrections. Iā€™ll correct my own version now :slight_smile:

Are you finding the jsui is incredibly slow to draw? Seems like a completely trivial task that shouldnā€™t take that long.

I never find js to be too great in Max for things like this.

Itā€™s not instant or anything, but it doesnā€™t seem like it takes crazy long (nowhere near as long as the transient stuff obviously)

Not taken a close look at the guts of the jsui, but I presume (hope) itā€™s downsampling the buffer before rendering it, otherwise that could take a while, particularly with longer multichannel audio.

1 Like

I would just hope in a dream world that it would happen near instantly, but it seems to pinwheel on quite long buffers.

The jsui is pinwheeling or buftransientslice~?

I get pinwheeling on the transient stuff for sure, but the jsui takes like 100ms (or thereabouts) to render for me.

How big are your buffers?

I did a 1.5 minute buffer which pin wheeled on fluid.bufnoveltyslice~, but also pin wheels for a shorter amount of time on the jsui stuff.

Ah right, I only tried the test example on brushes.aif. So if that took around 100ms, then something that long would pinwheel.

I would think it would be easy to downsample the calculation in the jsui.

Hereā€™s a Max-based version of a similar thing which I have saved somewhere. Itā€™s pretty brutal here downsampling to 64 ā€œstepsā€, but less brutal versions look better.

Or the abstraction can do this in Max-land and then pass a downsampled buffer into the jsui.


----------begin_max5_patcher----------
1654.3ocyZszjiZCD973eEpnxgjs73A8.vrmRtkCIUkJUkSIaskvV1lM7p.w
7ZqM+1W8.lAuC1V1R3MWL1xBZ0e780p6F97ra7RJej03AdO3uA2bymmcyMpg
jCbS2uuwKm93pLZiZZdqJyyYEbu45+iydjqFmtlVwYqAapKyA+9y8eiuKsQ7
QMit9eJ1w4UMu+t6V8zprzhsQjEhq1caJqayatacZSUF8oao29.8dlXv7aeH
ku6171LdZSV5ZV8skIehs5EaKtFrUksEpE.pavh17zhLFWsZguNXYKueT+tQ
SWqV4hK5sg8WyJJe0NwZ6i0RCovkPBYg+b.NLTcXYj5.dgO3Cxy4KylI+Xtg
3WA6AgAeC7cO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OL2oog9b24wXFqOj
imPD9vvxkuuVGhfhzOhFMhfcMhHhfcVO9gQ.k3yESzO8gKCUvQcIWGLnzL72
QUDAe1pH7Tqh5RwNbR3LuC.sjvPPWSFSOl.0XB1JLQrPDtmcLFLxLFScNU4B
gWWNDNJT2s639mQz2YEF1++eJrNzwR1zATXoEaJ+OvN5N5Y.bwiTBJ9xzYBD
R1VS4wWFvjuXWcb8HKpqu1Xkp8RgVWzWwkSSaEg3tFCgcPeEO.E5udNEfd8o
fYPbZ7H8R1pBqr6sKnCihHC1leZqlHv22txIHW+pIvg5pIfSB.UwX+6QhCgM
9k14xd8TtPjYopGYXUqR.Qjo.XzMdUCMf00s4+VYY0BZ5FKKH6heMdrXCstx
1iz8y3.JM0kV0uzu4EpScAkiuOH1T1VupeU1+Bb.d84Fsl0vSKn7TQH5ASBp
mzn2nL1RQlXIeWXIQgO.3orTzdSprV1+Y4sU6LMw.mjnsrUFBYnctNXIZbrz
2NSahOBcgSJKU7zVZ+kiibRhI5ukt3FoA2GItP8I6q4oASGXHQVP.zIrC5Zw
NBlhnIKMzv15gx5Q.gmvPXjqrzobIrKnglvBIHGDIF6apkrVYYR.wXWv3MZ2
ErKhJYBEGF6pMx7uFA.UWjSEpE4BzS990bc7IjQA0CcgOYfgPNgPXB30mz5a
R4lVUcOqtoa1JiHpP4S5WO8kymoeVt5epJSvqlceZ+7U0X3QqE47yEI72VqK
I3wtGChm7UyttnMsaKDg6ILop5GY4CMUcO6aUQRy9xruBw4b86B
-----------end_max5_patcher-----------

We have been talking at several moments about some hack or proper programming of slice visualization in Max. @weefuzzy had something brewing which was almost ready for distribution, but I donā€™t seem to find a link to some useable / testable example.
Is there any update on that front?
I know we can do this in Reaper with the great tools @jamesbradbury has provided, but Iā€™m looking for a way to keep things inside Max right now.
Thanks, Hans

Indeed that would be great!

Not that Max has a great UI or anything, but a couple weeks ago I was using Reacoma to segment some audio, and just navigating stuff back-and-forth like that is a bit tricky and slow, when trying to dial in values.

For what itā€™s worth, the code of warpy is already in Max so it should not be difficult to adapt it to what you want. I use a very garage view in pd where I make a buffer with 1s just at cutting point and link the zoom, which again works well.

The point of ReaCoMa is not to have quick back and forth. This would only be reasonably possible if segmentation was separated from the calculation of novelty, amplitude curves for example. When/if it does Iā€™ll make something better (: