hi, i adopted the waveform patch from @balwyn https://forum.pdpatchrepo.info/topic/9529/do-you-often-use-the-struct-objects/17
to display and load samples in ofelia. with "space" you open a sample and with "p" you play it. at the moment it needs tab_max_index and tab_min_index from iem_tab, i dont know if theres a vanilla solution. its just a demo. and perhaps there is a better way to display waveforms? ofelia_waveform_display.zip
-
ofelia waveform display
-
@cuinjune hi. thanks, your suggestion fixed the error. i also fixed a display error of the play position and updated the patch. i will clean up the patch if i have some time, and think about a good mouse control solution, could be nice to have an draggable in and out marker above the waveform, and a draggable play position inside the waveform, and to color the marked region (like in most audio editors). a good idea not to look only at pd instruments for understanding and inspiration one question: do you know why i need to click into the pd window to update the waveform drawing if i load a new .wav file (the drawing happens in the lower left corner of the patch)?
-
@Jona I don't understand what you mean by "I need to click into the pd window to update the waveform drawing if I load a new .wav file".
When I load a sample by pressing the space bar and then selecting a file, the waveform updates immediately.
The waveform updates well when I load new samples.
I tested this on both macOS and Windows using pd-0.48-1.
Do you mean you needed to click on the patch window to make the window have focus? -
@cuinjune exactly that. edit: its enough to make any pd window to have focus again, even with focus on the pd console it works. and the "assign $1 $2" messages get printed without focus. could it be that at my mac the ofSystemDialog window suddenly "steals" the ofelia/pd focus that is needed from ofEditPolyline2dPoint? i can only test with my mac at the moment. the very strange thing is that it worked before, and even older versions that worked well before do have the problem now. i do not remember that i changed anything before the problem occured. but nice to hear that it works at your computer. so it could be that something is wrong with my mac. thanks for testing. edit again: suddenly everything works again without changing anything, i dont know why, but i accept it
-
everything works again i cleaned up the patch, and added a colored rectangle as a region marker.
ofelia_waveform_display_i.zip
-
@Jona Great work! Even reversed playback works.
-
@cuinjune thanks. one problem was that treshhold~ outputs a also bang everytime i retrigger the sample, but i want that bang only if the phasor reaches 1 or if i press stop. treshhold~ stops the sample everytime that i retrigger it if the sampler is not in loop mode (i dont want that). so i tried to solve it with {> 0.99}. it works, but i think sadly its less accurate than treshold~. i marked the solution with red and green inside the patch. perhaps somebody knows a better way? also if the outpoint is before the inpoint the position should jump to the in point in one shot mode, to make retriggering possible. another thing that i didnt solve so far is, that it would be nice if the sample plays on without interruptions if i change in and out points. and the last thing that would be nice is to choose the sample position independently from the in and out points. and maybe copy and paste for parts of the array? perhaps thats too much, i dont know. or some beat slicer functionality? for example i really like the "recycle-like" chop suey patch from @toxonic : https://forum.pdpatchrepo.info/topic/2989/bonked-beat-slicer, but perhaps thats for a different patch. i will think about the direction it goes.
ofelia_waveform_display_j.zip -
@Jona I think you will get better answers sooner if you create a separate thread per your question if the question is about vanilla pd & sampling and not directly related to ofelia. (if the question can also be answered by non-ofelia users)
And maybe you can create and upload a simple patch which only shows the problem you want to solve so even vanilla pd users can quickly try and understand your patch.
And if you later have trouble implementing the solution in ofelia, I'd be glad to help you with that. -
@Jona Haven't looked into your patch, but the topic of detecting phasor~ values was discussed recently in the fb group. Being not very experienced with audio stuff i found one solution using threshold most convincing. Note that it detects phasor~ getting to zero instead of one, but it should be accurate:
phasortest.pdThe right outlet of threshold~ fires whenever the signal goes below 0.5 after going above 0.5, i.e. whenever it goes from one to zero.
-
@ingox thanks, it was quite similar in the patch, but i modified the values like that:
and now it seems to work fine. also the retrigger problem is solved.
@cuinjune
thanks for the suggestion. you are right, most of my questions in this thread are not ofelia related and could be ignored by non ofelia users because of the title. i thought i dont want to annoy the forum with too many threads, so i put everything into one (related to one patch). but a few extra threads could make sense. good idea with the example patchesi added a basic reverb, and a volume control. i think as a basic looper/sampler patch it could be finished:
ofelia_waveform_display_k.zip