time-clock


    Jul 25 2006 | 1:32 pm
    i am working on an alarm-clock design project.i want to set the actual and waking up time by using encoders, and display them by using lcd/led phidget.
    - how can i manipulate the time in Max/MSP? i check the 'setclock' but could not get a clear idea.

    • Jul 25 2006 | 5:36 pm
      Have you looked at the "date" object? It will give you the current date and time.
    • Jul 25 2006 | 5:40 pm
      heres a solution using the shell external
      max v2;
      #N vpatcher 0 47 1024 726;
      #P window setfont "Sans Serif" 9.;
      #P window linecount 1;
      #P message 757 318 30 196617 open;
      #P user ezdac~ 15 64 59 97 0;
      #P newex 757 425 31 196617 dac~;
      #P message 757 347 14 196617 1;
      #N sfplay~ 1 120960 0 ;
      #P newobj 757 373 44 196617 sfplay~;
      #P button 522 597 13 0;
      #P button 481 634 15 0;
      #P number 550 592 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      #P window linecount 2;
      #P newex 550 552 63 196617 if $i1==$i2 then 1 else 0;
      #P window linecount 1;
      #P newex 481 613 107 196617 if $i1==$i2 then bang;
      #P number 97 123 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      #P number 60 123 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      #P newex 619 463 64 196617 fromsymbol;
      #P number 619 504 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      #P message 619 484 39 196617 set $1;
      #P newex 550 464 64 196617 fromsymbol;
      #P number 550 505 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      #P message 550 485 39 196617 set $1;
      #P newex 481 464 64 196617 fromsymbol;
      #P number 481 505 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      #P message 481 485 39 196617 set $1;
      #P number 481 591 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      #P window linecount 2;
      #P newex 481 551 63 196617 if $i1==$i2 then 1 else 0;
      #P toggle 328 30 15 0;
      #P window linecount 1;
      #P newex 328 52 58 196617 metro 500;
      #P button 328 94 13 0;
      #P newex 481 160 43 196617 delay 2;
      #P newex 481 116 43 196617 delay 5;
      #P button 481 141 13 0;
      #P window linecount 2;
      #P newex 619 405 33 196617 pack i i;
      #P window linecount 1;
      #P newex 619 444 40 196617 itoa;
      #P window linecount 2;
      #P newex 550 405 33 196617 pack i i;
      #P window linecount 1;
      #P newex 550 444 40 196617 itoa;
      #P window linecount 2;
      #P newex 481 405 33 196617 pack i i;
      #P window linecount 1;
      #P newex 481 444 40 196617 itoa;
      #P newex 481 381 173 196617 unpack i i i i i i i i;
      #P newex 481 354 40 196617 atoi;
      #P newex 481 298 14 196617 _;
      #P message 481 324 53 196617 18:39:23;
      #P newex 481 275 64 196617 fromsymbol;
      #P window linecount 4;
      #P message 215 239 50 196617 Tue Jul 25 18:39:24 BST 2006;
      #P window linecount 1;
      #P newex 215 182 14 196617 _;
      #P newex 328 164 64 196617 fromsymbol;
      #P message 583 245 50 196617 2006.;
      #P message 532 245 50 196617 BST;
      #P message 481 245 50 196617 18:39:24;
      #P message 430 245 50 196617 25.;
      #P message 379 245 50 196617 Jul;
      #P message 328 245 50 196617 Tue;
      #P newex 583 216 14 196617 _;
      #P newex 532 216 14 196617 _;
      #P newex 481 216 14 196617 _;
      #P newex 430 216 14 196617 _;
      #P newex 379 216 14 196617 _;
      #P newex 328 216 14 196617 _;
      #P newex 328 194 266 196617 unpack s s s s s s;
      #P message 328 74 29 196617 date;
      #P newex 328 140 31 196617 shell;
      #P comment 139 124 100 196617 set alarm time here;
      #P window setfont "Sans Serif" 14.;
      #P window linecount 22;
      #P comment 832 66 100 196622 Simple alarm clock , unpacks system info straight from shell (very accurate way of doing it - if fiddley) just used some if statements to put together an hour and minute alarm clock , but could equally add in date - as this information is picked out too;
      #P fasten 34 0 48 0 333 115 65 115;
      #P fasten 34 0 49 0 333 115 102 115;
      #P connect 17 0 18 0;
      #P connect 18 0 19 0;
      #P connect 36 0 35 0;
      #P fasten 35 0 3 0 333 69;
      #P connect 3 0 34 0;
      #P connect 3 0 2 0;
      #P connect 2 0 17 0;
      #P connect 17 0 4 0;
      #P connect 4 0 5 0;
      #P connect 5 0 11 0;
      #P connect 4 1 6 0;
      #P connect 6 0 12 0;
      #P connect 4 2 7 0;
      #P connect 7 0 13 0;
      #P fasten 34 0 32 0 486 107;
      #P connect 32 0 31 0;
      #P connect 31 0 33 0;
      #P connect 4 3 8 0;
      #P connect 31 0 14 0;
      #P connect 8 0 14 0;
      #P connect 14 0 20 0;
      #P connect 20 0 22 0;
      #P connect 33 0 21 0;
      #P connect 22 0 21 0;
      #P connect 21 0 23 0;
      #P connect 23 0 24 0;
      #P connect 24 0 26 0;
      #P connect 26 0 25 0;
      #P connect 25 0 41 0;
      #P connect 41 0 39 0;
      #P connect 39 0 40 0;
      #P fasten 48 0 37 0 65 551 486 551;
      #P connect 54 0 38 0;
      #P connect 37 0 38 0;
      #P connect 38 0 50 0;
      #P connect 50 0 53 0;
      #P connect 24 1 26 1;
      #P connect 52 0 54 0;
      #P connect 4 4 9 0;
      #P connect 9 0 15 0;
      #P fasten 40 0 37 1 486 536 539 536;
      #P connect 24 3 28 0;
      #P connect 28 0 27 0;
      #P connect 27 0 44 0;
      #P connect 44 0 42 0;
      #P fasten 31 0 43 0 486 502 555 502;
      #P connect 42 0 43 0;
      #P fasten 49 0 51 0 102 551 555 551;
      #P connect 51 0 52 0;
      #P connect 24 4 28 1;
      #P fasten 52 0 50 1 583 607;
      #P connect 4 5 10 0;
      #P connect 10 0 16 0;
      #P fasten 43 0 51 1 555 536 608 536;
      #P connect 24 6 30 0;
      #P connect 30 0 29 0;
      #P connect 29 0 47 0;
      #P connect 47 0 45 0;
      #P connect 45 0 46 0;
      #P connect 24 7 30 1;
      #P fasten 53 0 56 0 684 649 684 342 762 342;
      #P connect 59 0 55 0;
      #P connect 56 0 55 0;
      #P connect 55 0 57 0;
      #P fasten 55 0 57 1 762 408 783 408;
      #P pop;
      probably the most accurate way to get time, if one of the more fiddley ways to do it.
      Hope this is what you were looking for
      Trum
    • Jul 26 2006 | 7:42 am
      thanks for reply but i am new to max/msp, i do not understand the code at all.
    • Jul 26 2006 | 12:06 pm
      Just copy it, and go to 'new from clipboard' in Max. It'll open it up as it shoudl look.
      Enjoy
      T
      P.s to get this solution to work you will need the 'shell external, and put it in the externals folder, with the help in the help folder.
    • Jul 28 2006 | 9:16 am
      thanks! i really had hard time to find the shell external, but i found it and put it to the external and help folders. but now it gives " error:sfplay`:no open file " what does this mean?
    • Jul 28 2006 | 10:54 am
      Ok, thats the easy bit, just press the open message above sfplay~ and open any shortish sound file.
      T