Here it is with some comments, you are welcome!
On 23/09/17 18:04, Hrvoje Radnic wrote: > Wow, thanks everybody for great solutions! > > Ingo's answer is the most satisfying for me because it stays in vanilla. > For now, I will just subpatch it in my project and use it as a > reference, but I must admit it will take some time before I really > understand every part of that patch. > > All the best! > > Hrvoje Radnic > http://soundcloud.com/sumovi-protiv-valova > 00385(0)915225162 > > > ------------------------------------------------------------------------ > *From:* Ingo Stock <m...@ingostock.de> > *To:* pd-list@lists.iem.at > *Sent:* Saturday, September 23, 2017 3:32 PM > *Subject:* Re: [PD] trim symbols? > > You can use [list fromsymbol] to convert the symbol to a list of ASCII > values and than work on that. See attached patch, it should do what you > want. > > Note that the patch assumes that the ending (like .wav) is always 4 > characters. Also it uses a simple list-drip mechanism that should be > efficient for small lists, in doubt use list-drip of list-abs instead. > > best wishes, ingo > > > On 23/09/17 14:33, Hrvoje Radnic via Pd-list wrote: >> Hi! >> >> I would like to display the name of the .wav file loaded from the HDD >> (using [openpanel]), but, without a full path and without the file >> extension. For example, [openpanel] outputs "symbol >> C:/Users/Hrvoje/Desktop/my_patches/SAMP_SEQ/samples/BD.wav" and I just >> want "BD" to be displayed. Is it possible in pd vanilla? Thank you for >> the help! >> Cheers! >> >> Hrvoje Radnic >> http://soundcloud.com/sumovi-protiv-valova >> 00385(0)915225162 >> >> >> _______________________________________________ >> Pd-list@lists.iem.at <mailto:Pd-list@lists.iem.at> mailing list >> UNSUBSCRIBE and account-management -> > https://lists.puredata.info/listinfo/pd-list >> > _______________________________________________ > Pd-list@lists.iem.at <mailto:Pd-list@lists.iem.at> mailing list > UNSUBSCRIBE and account-management -> > https://lists.puredata.info/listinfo/pd-list > >
#N canvas 193 51 713 503 10; #X msg 49 46 C:/Users/Hrvoje/Desktop/my_patches/SAMP_SEQ/samples/BD.wav ; #X obj 49 90 list fromsymbol; #X obj 49 68 symbol; #X obj 49 200 t f f; #X obj 81 266 list prepend; #X obj 81 288 t l; #X obj 49 222 sel 47; #X obj 49 310 list; #X obj 49 420 list tosymbol; #X symbolatom 49 442 10 0 0 0 - - -, f 10; #X obj 49 332 t l l; #X obj 49 398 list split; #X obj 116 354 list length; #X obj 116 376 - 4; #N canvas 406 157 632 294 list-drip 0; #X obj 39 113 t b l; #X obj 39 135 until; #X obj 39 157 list; #X obj 39 179 list split 1; #X obj 39 69 inlet; #X obj 39 91 list; #X obj 39 201 outlet; #X obj 120 201 outlet; #X text 183 89 <- Make sure it is a list just in case; #X text 183 109 <- Hand down the list and start the loop; #X text 183 129 <- Loop; #X text 183 177 <- Output the first element \, send the rest up. If the list is empty \, stop the loop; #X text 36 41 List; #X text 36 229 Elements; #X text 116 229 Finished bang; #X connect 0 0 1 0; #X connect 0 1 2 1; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 6 0; #X connect 3 1 2 1; #X connect 3 2 1 1; #X connect 3 2 7 0; #X connect 4 0 5 0; #X connect 5 0 0 0; #X restore 49 134 pd list-drip; #X text 237 68 <- convert to symbol just in case; #X text 237 88 <- convert to list of ASCII values. Note the number 47 which stands for slash in ASCII; #X obj 115 112 print ASCII; #X text 237 134 <- simple list-drip (ok for small lists); #X text 237 174 So the ASCII values are dripping down here...; #X text 237 267 <- collect the values in a list again... But whenever a 47 comes through \, delete the temporary list. So in the end the list will only contain the values after the last slash.; #X text 237 313 <- When list-drip is finished \, put the list through ; #X text 237 399 <- Cut off the last 4 list elements; #X text 237 419 <- Convert back to symbol; #X connect 0 0 2 0; #X connect 1 0 14 0; #X connect 1 0 17 0; #X connect 2 0 1 0; #X connect 3 0 6 0; #X connect 3 1 4 0; #X connect 4 0 5 0; #X connect 5 0 4 1; #X connect 5 0 7 1; #X connect 6 0 4 1; #X connect 6 0 7 1; #X connect 7 0 10 0; #X connect 8 0 9 0; #X connect 10 0 11 0; #X connect 10 1 12 0; #X connect 11 0 8 0; #X connect 12 0 13 0; #X connect 13 0 11 1; #X connect 14 0 3 0; #X connect 14 1 7 0;
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list