how could I correctly duck clicks from a real-time resampling patch?

xxc's icon

xxc

10月 10 2024 | 3:57 午後

Dear people of the forum,

I am trying to build a patch on which I can play back the input in different speeds. I really like the fact that the shorter window, the less delay and more artifacts, and the other way around, and I'd like to use this creatively. However, I am encountering clicking problems everywhere, and I am not so sure where else to look.

If I play at regular rate (1.) grooveduck helps me to solve this problem, and effectively removes the clicks from what I am singing live.
However, if I go to any other rate, new clicks appear. I tried to duck the input too, syncing with the record object sync outlet. It gets a bit better but it does not do the job well enough.
Furthermore, when I change the rec and reading size, lots of times new clicks appear, and later they seem to stabilise. It is a behaviour I don't quite understand, but I believe I must be doing more than one thing wrong.

I am not sure if what I am attempting to do is really possible. I do not mind to have a constant 'tremolo' sound at the moment, but I would really like to be able to get rid of the clicks.
Any solution or explanation of why is this happening would be deeply appreciated.

Here I paste a reduced version of the patch I am working on to focus on the problem:

Max Patch
Copy patch and select New From Clipboard in Max.

Thank you!

xxc's icon

xxc

10月 16 2024 | 12:14 午後

Hi again,

If only someone could maybe help at least to get some documentation on the subject, it would be really helpful. I know to repitch in real time is a tricky thing, but I could not find anything about it on the Cipriani books or online.

Thank you!

👽'tW∆s ∆lienz👽's icon

👽'tW∆s ∆lienz👽

10月 17 2024 | 1:19 午前

I am not sure if what I am attempting to do is really possible.

yes, it's very possible.

it's a common thing to run into when starting out in max, there's no documentation that can cover this, as you need to understand how to 'envelope' each segment of recording and playback that changes parameters, with some form amplitude window(this can also involve 'ducking' for instantaneous changes at the same time, plus both sample-accurate signal-based operations in tandem with event-rate operations, etc.), but there's so much involved it's hard to get into, not to mention tedious to explain for those who've already done this in many different ways...

...so here's some suggestions:

-use play~ or wave~ or index~(i'd suggest starting with play~) to synchronize playback to an audio clock like phasor~, then use poke~ for the recording side and sync that to the same clock... as you learn how to control everything sample-accurately, you'll learn where and how to create math that accounts for all the changes in 'length'/'speed'/'position'/etc... but there's still much to learn at that point about 'window'/'envelope', most of which you can learn by studying the 'Examples'->'sampling' folder

-use gen~ to create a more custom version of the above where you might even benefit from being able to consolidate many functions into a single lua-like script within the 'codebox' part of gen~(also known as 'genexpr')

-check out a 3rd party solution like karma~(see threads here for that, and download from the 'package manager')

-search for all the terms above, and read up on threads here on the forums based on those searches(which i admit will take a long time, but is one of the methods that seems to work for some people, over time, in getting to know all the available options really well, and then finding the best custom solution for them)

one more thing, this was a smart decision, shows you've understood some of the complexity already:

I tried to duck the input too, syncing with the record object sync outlet.

...but if you're changing speeds of playback differently than recording, then you can't use the same exact 'sync'/'ducking' signal for both, it would need to be a separate 'ducking' signal that would apply the differences in length/position/speed/etc. between recording and playback(i.e. using record~ will always just record at 1x speed, so if you're trying to playback at a different speed, but controlling both 'start'/'stop' of a selected segment from the waveform~ view to apply to both recording and playback, it will cause clicks... you want to adjust segment selection from waveform~ for recording, separate from that of playback, based on speed as well...)

hope that can help, and that others here might have further suggestions :)

xxc's icon

xxc

10月 23 2024 | 1:00 午後

Thank you so much for your answer. I will definetively explore the options you propose and update this thread if I manage to do it! The gen part scared me a bit, as I am still at 0 knowledge with it, but this may be a good chance to start!

Regards:)