countdown timer to start play(back)

    Jul 26 2021 | 1:35 pm
    I am trying to make a countdown clock that allows me specify some lead time after I have started my patch to get to my station and pick up my instrument. I need both hands to play my instrument and often need a moment to get situated. My patch would start at the smash of the spacebar and show me a huge countdown display giving me 10~30 seconds to get ready. When the countdown hits zero, the main patch is started with a large clock and waveform display playing my sound file. I have a surprising amount of it working. However, there is one problem, in the event that I abort and stop my countdown before it reaches 0, my main timer/sfplay starts anyway. I would rather it totally abort and everything reset to zero. I am sure this is an easy fix but I am not seeing it. I have been away from max a few years. I am quite rusty and wasn't great to begin with. haha.

    • Jul 26 2021 | 2:11 pm
      Hi KP fast answer... maybe helps zzz
    • Jul 26 2021 | 2:24 pm
      Thanks. I see you highlighted the 2 additions in red. Thank you. Not only does the thing now work exactly right, but I can see now what I did wrong. I needed to reset the counter to the top when stopping (it's hardwired at 10 for now) and I forgot to send a 0 to my clock sub patcher.
      I am very nervous about doing this gig so I want to make sure that if I need to hit the panic button and abort the patch before I get my instrument set, that I can start again from scratch just by hitting the space bar again. I could manage it now, kludge-y in my apt, but you have to remind yourself that you will be standing in front of a room full of people and you don't want to have to quit max or figure it out while people are waiting staring at you and I could see that stopping and starting multiple times was making the 2 parts of my patch to get twisted.
      Thank you!
    • Jul 26 2021 | 7:38 pm
      happy to help , Have fun in your gig ! michel
    • Jul 27 2021 | 5:56 am
      Okay. I thought this was finished but I see now I broke it. Haha. You had the message box hard wired to 10. I was using 10 because I didn't want to wait so long for the patch to run while debugging. Ideally I want to set the countdown differently depending on the performance situation, so I tried to use set $1 to make it variable but I don't quit understand it's behavior now. If I change from 10 sec to 30 sec the change doesn't take effect immediately but only after an addition stop start.
    • Jul 27 2021 | 8:00 am
      update the countdown with the "on" of the spacebar ?
    • Jul 27 2021 | 8:10 am
      Ah, I was updating the message box but with $1 but I was forgetting to actually bang it to send the message. I see what you did there was to add a bang from the spacebar which would update the count immediately, which is precisely what I was trying to do. t b b. Rookie mistake. I should have realized that the message box would have to be set and sent a bang.
      I plan to try to re-use this patch a few times by making "tape" parts to play over, but I don't want to be near the screen when I do it. I would rather be at the instrument but I also want to be able to control it by myself on stage. This gives me a countdown (time to get set) and a big clock I can see while my hands are on my instrument.
      Thanks. I have been away from Max a few years and forgot how to do many things & also forgot how many hours you can get lost in it. haha.
    • Jul 27 2021 | 8:12 am
      Hat's off to you Mizu. Who knows maybe others find this approach helpful.
    • Jul 27 2021 | 10:05 am
      And the time interval between -1 an 0 (a.k.a. "go") would be the same. That seems more precision than is necessary in my case .... One last thing bothers me though is that both the red and the green button are lit at go. I'd like to fix that. It does this:0
      -3 red -2 red -1 red 0 red & green
      I'd rather this.... -3 red -2 red -1 red 0 green
      I probably need a sel after the counter somewhere....
      sorry to be live blogging this...
    • Jul 27 2021 | 11:53 am
      [>0.]---[sel 1]
      Indeed seems to have done the trick. I did not recall that button flashes even on 0.
    • Jul 27 2021 | 3:00 pm
      just a propose with multislider... i don't know what you need under your eyes... fun with Max and these needs
    • Jul 27 2021 | 3:08 pm
      That's beautifully loud & easy to see. Bravo. I anticipate that I will not be glued to the screen or even that close to it so I love that. Gosh I should add that underneath my waveform as well. I have a progress bar that marches along the waveform but it isn't easy to see and a multi slider in obnoxious neon red will likely make that easy to see. Ideally I would also do something better than what I am doing with ubutton. Maybe the green should toggle on and stay on instead of blinking. I am trying to make this big and bold so I can see it while I am playing. I don't have the greatest vision and like I said, I plan to be busy playing, that is why the clock is so big & everything is green or red on black.
    • Jul 27 2021 | 3:16 pm
      waveform march looks like this. I can't really see the progress bar but I don't see any attributes or messages for changing it.
    • Jul 27 2021 | 5:04 pm
      playbar and multislider ? And a counter from the sfplay funny
    • Jul 27 2021 | 5:07 pm
      playing with transparency and presentation mode could be nice bzzz
    • Jul 27 2021 | 10:54 pm
      That's really neat. & a bit better than what I cooked up last night. I have to study that transparency and the progress bar that you did. That is really easy to see.
      One bug though that I can't quite figure out in this version... when you press the space bar it doesn't stop the sound file playback it just starts the counter again.
    • Jul 28 2021 | 8:47 am
      just added a send from the toggle of spacebar. Depends than of your needs. The multislider over the waveform needs to receive the duration of the file from sfinfo~ to message "setmin 0, setmax $1".
    • Jul 29 2021 | 3:08 pm
      Thanks. I have been looking at what you did there and that is a very elegant solution just pasting that semitransparent multi slider over the waveform & I noticed that the waveform and slider fit right on top but you lengthened the playbar so that the time indicator lines up with the line over the waveform. Super. When I get all this worked out I will tidy it up as you suggested with presentation mode.
      I noticed that if I send the message open foo.wav and open jongly.aif all works fine but that just "open" doesn't work because I am opening the same file in splay as I am in buffer... and buffer wants replace. While replace $1 works for "open jongly.aif" it isn't going to work for an open only message & file browser choice. But I suppose that isn't mission critical. For this show I will probably just have a sound file list hardwired in in the sequence I need it on the program.
      I forgot how sucked in your while max-ing. I spent a few hours away from the screen. Thanks.
    • Jul 29 2021 | 8:43 pm
      Hi KP i've seen: when you change of soundfile you need to open in sfplay~ replace in buffer, care the sfinfo~ to give a max $1 to the multislider. -- i had some time these days. Hope it free's you of this max-ing zzz
    • Jul 31 2021 | 1:39 pm
      Ah, I had the prepend bit & trigger, plus the feed to the buffer & sfplay. I did not update sfinfo and I also didn't know about open dialog.
      Learning lots. Thanks for your help. Much appreciated. It is a funny little patch that does a whole lot of nothing processing-wise but can be useful for performance & rehearsal.
    • Aug 03 2021 | 12:56 pm
      Somehow I broke it. Trying to fit it on my screen & I rearranged some objects. I don't care if it is beautiful at all, I just want it uncluttered enough when locked and moving from a larger screen to rehearsal right from the laptop, I noticed that it did not fit well on my 13" laptop screen. And in rehearsing with it I notice now that:
      1. The countdown multislider progress bar is just full on all the time. I found that useful. 2. The "go" signal is flashed at 0 but so is the red one (wait). It didn't used to do this.
      On the off chance you can look, one last time, I post where I am again. If not. Okay too. I appreciate all the help you have already given me but I am so far unable to see it.
      On the plus side, the audio portion of the patch works great and the waveform and screaming huge counter is making it easier to play along with the sound file so even broke, the patch seems to be a huge help in preparing these tape & live pieces.
      I am working on a cue system but using coll but even if I don't get that up & running in time we can still go on memory and head nods.
    • Aug 03 2021 | 3:26 pm
      Hi KP made this fast. Presentation mode is your friend to make a "preset", adding a message with 2 numbers to give a countdown and a time for ?
    • Aug 04 2021 | 12:58 pm
      If you would describe more detailed what your needs are, it would be easier to help with this. Had a brief look at it, and would suggest to simplify it a good deal. there are multiple counters, displays, playback controls which are not synced, unnecessary loading of all buffer channels , everything is overcomplicated. Waveform and multislider both move the current play position line, why ? On stage one needs simple, rock solid, reliable and visible status about what is going on, as well as a good strategy to get out of trouble if something goes wrong. ---------- here is modified patch with partly simplified elements and linked toggle, spacebar and playbar control.
      -------- What is not clear to me is if this countdown is needed only at the very beginning of the show, and later ? You load different files and they all need countdown ?
    • Aug 04 2021 | 1:05 pm
      The use of presentation mode here has convinced me I should be looking into that. I was hacking away on a big screen but realized that when doing the gig I will just being using the laptop screen and suddenly the patcher exceeds the bounds of the screen by a lot. I'm not use to the space restrictions of a 13". But I see here with a small laptop it is helpful to embrace presentation mode, which I have largely ignored. I will revisit the toots. Your patch Pungsu/Feng shui is tops.
      >>to make a "preset", adding a message with 2 numbers to give a countdown and a time for ?
      Not 100% sure I grasp this but I think you mean I can have different count off times for each file by packing the numbers in a message box and banging that message box with with the filename message box ... if so, that is not something I thought of but absolutely makes performance easier. ... one less thing to set which can be hardwired in at rehersal. I can literally just switch files and press play. This is great as it turns out there will be some solos before, and after the files.... That's smart. THANK YOU.
      Now I have to read up on presentation mode so I can add (& subtract) as needed. I like the time in the waveform display too. nice idea. I will probably remove pause and resume since that can be done in the playbar anyway...
      Goodness, thank you.
    • Aug 04 2021 | 1:30 pm
      >>If you would describe more detailed what your needs are,
      What I am trying to do is play a whole evening of pieces alone, no other performers, no sound person, just me running everything from the stage into the house. Most of the piece are in a kind of fixed media (pre-recorded) & live player format (mostly, me). There are six pieces. One entirely live electronics, the rest done with playback.
      Since I have limited bandwidth, and will be holding my instrument with two hands (and sitting), what I want to do it load the next piece, hit the space bar, and have time to move to & get seated, & pick up my instrument and be ready to play when the tape starts.
      In some cases I want a longer countdown because I might be starting with a solo and the tape comes in later. So maybe the first minute is a solo and then the tape comes in, but obviously don't want to get up, put my instrument down, and go to the computer. I would rather give my self 15 seconds to get to my seat, and then a minute to play solo, etc, so then I want something like 75 seconds countdown....
      The visual feed back just tells me where I am in the file because do certain things at certain times and following the waveform allows me to time certain events so that they happen simultaneously.
      Eventually I will probably add some kind of system of cues with coll or some such that will help but that may have to wait. For now I am mostly trying to practice and memorize my cues.
      >>Had a brief look at it, and would suggest to simplify it a good deal.
      It should be ... I am simply not a great Max programmer, doing this in a rush (I had Covid which just hit me like a truck) & things were added piecemeal as I figured things out etc & the concert was rescheduled sooner than it should have been. At first I thought I would literally just use sfplay and or even line up the files in a DAW.
      >>On stage one needs simple, rock solid, reliable and visible status about what is going on, >>as well as a good strategy to get out of trouble if something goes wrong.
      Indeed. The most important this is that the patch is dependable, easy to operate, and that gives only the information needed and as clearly a manner as possible.
    • Aug 04 2021 | 1:44 pm
      I will have to study your example. I see you have removed several that should have been deleted (for example since I have the muilislider now over the wave there is no reason for 2 lines to update the march through the waveform).... & I see you also re-use many of my interface items so smartly. If I am already looking at a huge time display, that display also be used to show the countdown as well. That is smart and easier to see as a performer. You don't have to shift to another part of the patch to see the information you need.
      I guess once one gets all the features you need you should look back and see if there are things that are redundant. Your patch is leaner and meaner. There are quite a few new winkles to ponder. It's kind of amazing. Greatly simplified.
    • Aug 04 2021 | 1:46 pm
      I think you need a sort of footpedal, even with a single switch, that would help a lot. One can perform quite few gimmicks with a single and silent switch, short, long , double etc clicks to perform different functions. that could replace countdowns , and be used to load next file for playback etc.
      Anyway, just ask if you have any question about how to do this or that
    • Aug 04 2021 | 1:50 pm
      I eventually plan to use a foot switch or some such. Years ago, when I last used Max I used a Wii.
      I try to post my work to show what I have tried even if my patches are embarrassing or inefficient. I am trying to put this show together really fast so not working in the most elegant way possible. heh.
      Thank you.
    • Aug 04 2021 | 2:03 pm
      No problem, it maybe needs no patches, but simple description.
      and no need to study what I did for the time being, just ask why this or why that. You want to get all this assembled as soon as possible , explanations can follow at later time.
      Are you sitting close enough to the laptop, so that you can use the keys ? Or is using a mobile phone as remote controller an option ? Or external keyboard or anything else, even a children gamepad ...
    • Aug 04 2021 | 2:13 pm
      I will probably just bring my bluetooth keyboard. That is why I am just using keyboard keys thus far.
    • Aug 04 2021 | 2:25 pm
      Then you can assign for example numkeys to load audio files, use space bar for play, stop or use one key to step through Audio Files list in umenu... There are many options.
    • Aug 04 2021 | 2:29 pm
      But you should post some infos about necessary actions during the show. Are any pause- resume planned, if countdown is really needed. and anything else that might be important.
      One can use long key press to execute critical functions to avoid unwanted key presses. like you need to hold key > than 500 ms and it executes when released.
    • Aug 04 2021 | 2:37 pm
      -->Then you can assign for example numkeys to load audio files, -->use space bar for play, stop -->or use one key to step through Audio Files list in umenu...
      I will look into those options, for now have been just clicking on a soundfile name. I love Mizu's read of loading the countdown with the name & have added that.
      >>But you should post some infos about necessary actions during the show. >>Are any pause- resume planned, if countdown is really needed.
      I just put the necessary silence in the actual soundfiles for now. No pause or resume so far, though I suppose my patch suggests that... it would have to also pause (or not) the clock. I just baked all the silences in so far. It's dumb so far it works. Ideally, I suppose, start and stop would be helpful but I sort of thought, not mission critical for this show. I suppose down the line an elapsed time and separate soundfile clock would be ideal but .. again, not mission critical. Though in that case this clock would pause when the soundfile was paused. But again, trying to avoid mission creep and just get this as solid as it could be since it is kind of key to my performance plan.
    • Aug 04 2021 | 2:41 pm
      I'll test this more in the am.... but If it all works.... I might go back to prepping the soundfiles and maybe spend an afternoon doing what MIZU did, which is using presentation mode or something to make it more compact and elegant.... I can't believe I agreed to do this show all by myself. Well, since I am playing back from sfplay too I guess I am cheating. That is okay. As long as the sounds are good. (q: are they? haha)
    • Aug 04 2021 | 2:51 pm
      I think as simple as this is , one can get without presentation mode, which at the end makes you create 2 layouts.
      I did not really catch that you need absolute time counter, parallel to Audio Playback counter. Patch I posted has Playback counter only. you coud remove that sample type etc infos, who needs that on stage ...
    • Aug 04 2021 | 2:56 pm
      >>Are any pause- resume planned, if countdown is really needed.
      Mine plan didn't include pause because pause and resume don't work in my patch. I just noticed that in yours it does & IT stops the clock. That is so good. It opens up some possibilities. This was actually the original intention. I gave up.
      >>I did not really catch that you need absolute time counter I didn't mention that initially because my pause resume was looking like a lost cause and I felt like it was less important since I could just put pad my soundfiles with zeros.
      But yeah. wow. I just noticed that pause/resume works. YES!
    • Aug 04 2021 | 3:13 pm
      That time display is taken directly from sfplay~ playback position, so it is clear that it stops on pause.
      How would you combine all this 1 counter start and counter abort 2 pause / resume after playback started 3 stop of the playback and if it enforces counter again or not using single key like spacebar possible would be short press starts or aborts the counter if Audio File is in stop state. when playback started short presses toggle pause - resume, long press and release stops the playback no matter if playing or paused. That activates count in again, or maybe only if audio file changed ? In that case Audio File if unchanged would start immediately. P.S. pause - resume and stop need fade I/O for clickless operation depending on audio material 20 - 100 ms so you first start fadeout, then execute pause or stop after fadeout finished. Resume starts together with fade in.
    • Aug 04 2021 | 3:21 pm
      I am away now til tomorrow, have fun with this, maybe MIZU would also jump in to help again, in case you have more unsolved problems.
    • Aug 04 2021 | 3:22 pm
      yes, in an ideal world pause resume would have a line on it to keep it from clicking. I would think pausing and playing would have to be a different key from global spacebar stop start. Otherwise there would be confusion. .... This patch would have been so helpful on my last theater gig, watching actors from the stage triggering sounds, then the next night the scene with music goes long ... but you only had so much music ... I did it all (believe it or not) from Protools, Supercollider and a CDR backup... You could run a whole show from a patch like this...
    • Aug 04 2021 | 3:25 pm
      >> I am away now til tomorrow, have fun with this,
      Thanks. 1am here so I am also fading,
    • Aug 05 2021 | 2:09 pm
      i' m a little there after away... @Sourceaudio : on the same way as you, the patch can be nicely optimized like you propose :-) @KP : the pleasant thing for me is the simplicity of your idea: make "play", but it begins nn seconds after. Yess ! Basis of every process. In my mind, - i come from theater- it's another thing if i see you make spacebar, and take place with your instruments, than if you have a footswitch i don't see when you press it. Reading you, i believe you are ok to take-estimate these times before your show, and make in live with that. The periculous life on stage ! I love :-)) Clearly it opens the door to many other "events" in a show