Cal error any help

Author
jm24
Max Output Level: -54 dBFS
  • Total Posts : 2127
  • Joined: 2003/11/12 10:41:12
  • Status: offline
2011/09/06 12:16:17 (permalink)

Cal error any help

Getting error 3 ( wrong number of argument while ) for the script below.
 
 
The script works when the 2nd track section is removed. But I want to have 8 sections for 8 tracks.
 
 
Create at least 2 midi tracks at top of tracks window.
 
 
Ideas?
 
 
 
(do       
 ;; initialize variables      
 (dword TimeNow 0)      
 (dword TimeTotal 0)      
 (dword TimeEnd 0)      
 (dword BeatsPM 0)      
 (dword TicksPQ 0)      
 (int ChannelNumber 0)      
 (dword TotalTracks 0)      
 (dword TracksDone 0)      
 ;;;;;; set known variables      
 ;;      
;; (getInt ChannelNumber "ChannelNumber:  " 0 15)      
 ;;      
 ;; set default values      
 (= TimeNow 0)      
 (= TimeTotal 10)      
 (= TimeEnd 0)      
 (= BeatsPM 120)      
 (= TicksPQ 960)      
 (= ChannelNumber 6)      
 (= TotalTracks 8)  ;;  NUMBER OF TRACKS TO CREATE AND ADD   
 (= TracksDone 0)      
 ;;       
 ;; convert time to ticks       
 (= TimeEnd (* BeatsPM TicksPQ))      
 ;; (pause "TimeEnd " TimeEnd)     
 ;;       
 (= TimeEnd (* TimeEnd TimeTotal))      
 ;; (pause "TimeEnd " TimeEnd)     
 ;;      
 ;; insert TotalTracks     
       
       
 (do      
  (while (< TracksDone TotalTracks)     
   (do    
    (= TimeNow 0)   
    (TrackSelect 1 0)   
    (do   
     (while (< TimeNow TimeEnd)  
      (do 
       (= TimeNow (+ TimeNow 7680))      ;; on the one of every other measure
       (insert TimeNow ChannelNumber NOTE 52 127 60)
       (= TracksDone (+ TracksDone 1))
      ) 
     )  
    )   
   )    
;;     2nd track
   (do    
    (= TimeNow 0)   
    (TrackSelect 1 1)   
    (do   
     (while (< TimeNow TimeEnd)  
      (do 
       (= TimeNow (+ TimeNow 3840))      ;; on the 1
       (insert TimeNow ChannelNumber NOTE 52 127 60)
       (= TracksDone (+ TracksDone 1))
      ) 
     )  
    )   
   )    
  )     
 )      
)       
#1

7 Replies Related Threads

    Chappel
    Max Output Level: -52.5 dBFS
    • Total Posts : 2300
    • Joined: 2009/07/11 14:55:32
    • Location: California
    • Status: offline
    Re:Cal error any help 2011/09/06 12:38:18 (permalink)

    I don't know anything about CAL scripts but I found a page that might have some useful info. It contains this about wrong number of arguments:

    "Wrong number of arguments
        Unless you genuinely left out an argument in a statement, this error is usually caused by not having the closing bracket of a nested section of code in the proper spot. You likely have the bracket somewhere, otherwise you would receive a "missing closing parentheses" error. Maybe you just put it in the wrong place and so now some "if" function has a THEN, an ELSE and a stray extra part, or a math statement is being asked to operate on three arguments instead of two."

    http://web.archive.org/we...ct.com/home/ignot/CAL/

    http://web.archive.org/we...-index.htm#wrongnumber


    #2
    jm24
    Max Output Level: -54 dBFS
    • Total Posts : 2127
    • Joined: 2003/11/12 10:41:12
    • Status: offline
    Re:Cal error any help 2011/09/06 13:24:38 (permalink)
    Thanks for the references.

    But, got all that and more. This appears to be one of the many undocumented bugs.

    I have lots of little cal scipts that work fine.  But this one is not????

    Must be a spce in the wrong place, cuz the parenths appear to be good.

    J
    #3
    Mr. Ease
    Max Output Level: -71 dBFS
    • Total Posts : 960
    • Joined: 2003/11/24 18:44:01
    • Location: West Sussex, UK
    • Status: offline
    Re:Cal error any help 2011/09/06 18:05:11 (permalink)
    I'm not convinced your parentheses are quite right.  After "2nd Track" I'd put in an extra indent in every line and add one more closing parenthesis at the bottom.  Worth a try I reckon as doing a simpe count I think there is one more opening bracket than closing bracket.
    #4
    brundlefly
    Max Output Level: 0 dBFS
    • Total Posts : 14250
    • Joined: 2007/09/14 14:57:59
    • Location: Manitou Spgs, Colorado
    • Status: offline
    Re:Cal error any help 2011/09/06 20:12:06 (permalink)
    I'm no expert, either, but it looked like you closed your "(while (< TracksDone TotalTracks)" before the second track was done. So I took out a couple of parens right before the second track section to open the "while" and "do" back up, and moved them down to the bottom. But I must still be missing something, because it runs without errors, but doesn't fill the second track.

    FWIW, here's what I've got:

    (do        
     ;; initialize variables       
     (dword TimeNow 0)       
     (dword TimeTotal 0)       
     (dword TimeEnd 0)       
     (dword BeatsPM 0)       
     (dword TicksPQ 0)       
     (int ChannelNumber 0)       
     (dword TotalTracks 0)       
     (dword TracksDone 0)       
     ;;;;;; set known variables       
     ;;       
    ;; (getInt ChannelNumber "ChannelNumber:  " 0 15)       
     ;;       
     ;; set default values       
     (= TimeNow 0)       
     (= TimeTotal 10)       
     (= TimeEnd 0)       
     (= BeatsPM 120)       
     (= TicksPQ 960)       
     (= ChannelNumber 6)       
     (= TotalTracks 8)  ;;  NUMBER OF TRACKS TO CREATE AND ADD    
     (= TracksDone 0)       
     ;;        
     ;; convert time to ticks        
     (= TimeEnd (* BeatsPM TicksPQ))       
     ;; (pause "TimeEnd " TimeEnd)      
     ;;        
     (= TimeEnd (* TimeEnd TimeTotal))       
     ;; (pause "TimeEnd " TimeEnd)      
     ;;       
     ;; insert TotalTracks      
            
            
     (do       
      (while (< TracksDone TotalTracks)      
       (do     
        (= TimeNow 0)    
        (TrackSelect 1 0)    
        (do    
         (while (< TimeNow TimeEnd)   
          (do  
           (= TimeNow (+ TimeNow 7680))      ;; on the one of every other measure 
           (insert TimeNow ChannelNumber NOTE 52 127 60) 
           (= TracksDone (+ TracksDone 1)) 
          )  
         )
        )   
         
    ;;     2nd track 
       
        (= TimeNow 0)    
        (TrackSelect 1 1)    
        (do    
         (while (< TimeNow TimeEnd)   
          (do  
           (= TimeNow (+ TimeNow 3840))      ;; on the 1 
           (insert TimeNow ChannelNumber NOTE 52 127 60) 
           (= TracksDone (+ TracksDone 1)) 
          )  
         )   
        )    
       )     
      )      
     )       
    )     

    SONAR Platinum x64, 2x MOTU 2408/PCIe-424  (24-bit, 48kHz)
    Win10, I7-6700K @ 4.0GHz, 24GB DDR4, 2TB HDD, 32GB SSD Cache, GeForce GTX 750Ti, 2x 24" 16:10 IPS Monitors
    #5
    jm24
    Max Output Level: -54 dBFS
    • Total Posts : 2127
    • Joined: 2003/11/12 10:41:12
    • Status: offline
    Re:Cal error any help 2011/09/07 11:56:31 (permalink)
    For this example I had the trackdone variable in the inner loop. Not good

    The main problem is the TrackSelect command does not work with the Insert function.
    So, all the midi notes are placed on the first track.

    Gotta figger a way to use a ForEachEvent loop, or some such foolery.

    Thanks for your help

    j
    #6
    Chappel
    Max Output Level: -52.5 dBFS
    • Total Posts : 2300
    • Joined: 2009/07/11 14:55:32
    • Location: California
    • Status: offline
    Re:Cal error any help 2011/09/07 12:32:05 (permalink)
    I still don't know what this CAL script is supposed to do. (insert dorky smiley face here). Is this something you could use track templates for? If the CAL script is supposed to save time and effort it seems you're already in the minus column. (Insert different dorky smiley face here)
    #7
    jm24
    Max Output Level: -54 dBFS
    • Total Posts : 2127
    • Joined: 2003/11/12 10:41:12
    • Status: offline
    Re:Cal error any help 2011/09/07 15:08:26 (permalink)
    This program will insert midi notes at particular spots for many tracks. And then can be edited to make variations.

    If Track templates also saved data this would be way easy.

    Track Templates with data should have been from the beginning. All the code exists.

    Variation: export/import selected portions of a project.

    Hence the need for a program. This little excerpt is part of a bigger program, and a bunch of utilities. So time is not completely wasted.

    Sonar should have a real macro language which CAL started to be. BUt the managers did not understand that the ability to record and edit macros would make the program much more useful compared to other audio programs.

    And so on

    Don't get me started.

    j

    #8
    Jump to:
    © 2024 APG vNext Commercial Version 5.1