Hello again, I am starting to understand the patch.
One difference with my setup is that I do not have a txt file with the format "time + sub" I only have "time" which is used to fire subs in another txt file.
I create the txt with the times for each "next sub" event with the help of pd, but I create the txt with the subs manually.
In order to get a txt file in the format your patch needs I would need to build a patch that would merge the txt with times & the txt with subs... or do that manually.
So now I want to understand your patch so I can hack it to get the arranged times (and store them in a text file) instead of the subs associated to the arranged times.
You beat me to it again! jeje. Thank you very much Gilberto.
It would be great if you could explain a bit your patch. I think that I can adapt it to store again the arranged output into the original .txt
I myself was trying to understand and implement a sorting algorithm within PD (something I never did anywhere!)
I was attemtping to build a patch that did this:
get original list
compare second and first elements of the list
if second is bigger than first (2nd>1st=1) store them like that in a temp list
else (2nd>1st=0) swap their order
write them like that in the original list
repeat with third and second elements of list
write in original list
then fourth and third, etc
when reaching last position in list start over
do this until you get, within a single interation of the list, a consecutive ammount of "1"s in the ">" comparison that matches the length of the list (which would mean all items are in place)
I did not finish this, but I think it would be able to put the list in order. Although if lowest number is at the last position of the list, the patch will have to iterate through the whole list as many times as the length of the list, to bring the number to the first position.
This is because the patch only moves an item one position per iteration.
I can also foresee a possible problem. Since in every iteration the patch goes up one position in the list, but actually stores a pair of floats, it will probably have repeated numbers on the arranged list (i.e. 12233445) So I should have a filter when storing the result of the comparisons in the arranged list.
Intuition tells me it may be enough to just store the first number of each pair, in every comparison, and not both of them.
PD is fun !
short story: I need a way to take a .txt that has a float per line, like this:
and arrange it so they increase in value, like this:
How can I do this automagically and with ease?
thank you very much
I am building a patch to create and show subtitles for audio files.
I devised a simple system to help me manually log the exact time in s.ms when a /show next subtitle/ event should happen.
I do this with a simple timer abstraction; I start it, time runs, and then I keep pressing bang when I want to log a /show next subtitle/ event. I log the time in s.ms into a textfile object.
This way I obtain a .txt with floats that represent the /next sub/ events in s.ms
BUT if I miss an event, and I try to add that one without deleting the rest, I get something like this
2.34 <---- shouldn't be here but before 4.23
And this is why I am looking for a way to arrange the floats automagically, so I can easily go on adding forgotten /next sub/ events, and I only have to edit the file directly to delete them.
Thank you very much
I went back to read audio basics here http://www.pd-tutorial.com/english/index.html
...and I understand I can use soundfile_info to obtain length of .wav in samples. Divide it by sample rate, i.e. 44100, and obtain this way the length in seconds.
I imagine after this I could attempt to build a timer and start both wav file and timer at the same time, so they run in sync...then I could "listen" to the timer in order to fire bangs at concrete mm:ss
But there must be an easy and more accurate way to do this, right?
Thank you again.
I am trying to build a patch that syncs subtitles to an audio file. I.e. loads a .txt and bangs each text line at key moments determined by mm:ss of audio file.
But I cannot find an easy way to get elapsed time of a playing audio file. Could someone please guide me? is there an vanilla object or external for this?
I was doing this before with ableton live sending midi to PD through IAC driver on OSX. PD would respond to the midi by loading .txt files and banging the text lines from textfile towards text2d, then gem window.
Any help appreciated.
When inputting a semicolon in [entry] it outputs this "///;"
I would like to turn that "///;" into a simple ";" at some point in the patch.
I am using [entry] for a sort of chat that sends text to a [msgfile]
I cannot control users inputting semicolons or not, and, within the [msgfile] txt file, I would need semicolons to be only semicolons.
I understand that semicolons are reserved characters in PD, and that this may not be easy to do.
Any help would be greatly appreciated.