@svanya Not sure I understand because it seems you answered your own question at the beginning......... using delwrite~/delread~ (or vd~)
Do you mean outside of Pd?....... I don't think so because you write about your "patch".
So it was just an analogy.
You want to do stuff....... turn the audio into data (midi) for a certain time........ and then use that data to produce audio and send it to the [dac~]
But at the same rate that the audio came in at........ sort of the same "tempo".
So what you need is a data store with a read cursor that moves at the same rate as a write cursor with a settable gap between the two......
That is as far as I have got.
But this is a first thought.
Write your data into an array at a set rate with a metro and a counter that sets the index.
The counter should stop counting as it reaches the max indexes required for the delay and start putting data into the same index...... sounds bizarre I know, but stay with me......
Just before it writes again to that last index...... shift the array to the left....... read the first index and remove it.
From here on the metro reads and removes the first index and writes the last index with new data..... forever.
I know it looks back to front but I think I am correct.
[tabwrite will be increasing the length by one index every time it writes...... cannot yet get my head around (I have not even tried) how that will affect the patch above...... but I don't think it will.
See you back here if I have a better idea (before someone else?).
Because it's not certain that the operation above would be fast enough.
The maxlib library has [fifo] ...... first in first out...... and it's length can be set...... but how many floats can it store? I tried it set for 10000 and it seems to work.......
There's one in ceammc and zexy too I think....... doing the same?.....