Page 2 of 7 FirstFirst 1234 ... LastLast
Results 21 to 40 of 121
  1. #21
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Post translators are partially useful

    Quote Originally Posted by hannehomuth View Post
    But no matter of that I think we got the solution of your problem if we decalare the vars as fields in your java class or not?
    can you give us a byte[] ? Take a few kilobytes on the front end of the array or pass a second array describing how the first byte array is structured and what it's data rate and so on is .... we will pass the information as a traditional file and let the operating system work in it's intended manner.

    In fact, take an entire folder - write to tradional files - all files in that folder will be dedicated to this program. We can utilize those files by a 256 byte array { minus some hokey hotkeys for the operating system } which you know as a file name and we will use that as a header.

    Trying to do direct linkage editor between the PASCAL and Java is likely to become bogged in details specific to proprietary compilers.

    while(true)System.out.println(":-)");//

    ================

    Norm: Here's your first regex:
    Java Code:
    // for Norm, partially completed concepting.
    // Much work to be done, picks up files with 
    // willemjav file extension, allows these two
    // to work unimpeded by filename restrictions.
    // Drops unallowd filename characters. 
    Pattern JAVA_EXTENSION=Pattern.compile //
                ("(?i)[^<>:.\\\\\"/|?*]+\\.willemjav$");
    //
    Last edited by Nicholas Jordan; 07-31-2008 at 03:59 AM. Reason: several changes to regex
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  2. #22
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Exclamation don't bite the alligators

    PASCAL is an academic work intended and effective for introducing computer science students to known algora that should be studied, so also are several other languages. If we are critical of the work of the acadamy, we will find out where the cad in acadamy actually comes from.

    It may not be pleasant, and they can bite like an alligator due to studying the stuff all day long. Making a programming language effective to a task is a subject of compiler science, not un-informed critical rebuttals on the open wire. A general survey on languages at the undergraduate level approaches about ten general language types, with about 100 languages listed as implementations of those. The language must be tailored to the problem domain, the compiler must be tailored to the general class of machines the language will run on.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #23
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,611
    Rep Power
    25

    Default

    What is the purpose of the Reg exp you posted?

  4. #24
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default passing data from pascall programming domain to Java domain

    Quote Originally Posted by Norm View Post
    What is the purpose of the Reg exp you posted?
    I thought about how to get the work already done in PASCAL available in Java. One of those avenues is to get a byte[], which they report being able to do already or nearly so. Passing headers is either in the data channel or is a separate control structure. I thought that our workers could pass header information in the filename rather than trying to figure out a header and getting an un-reliable meta-data transmission due to stripping off the control channel information from the data stream.

    Posted regex, as of re-work at 8 pm GMT-6 could be used in a directory listing to pick off filenames having the form "*.williemjav" where star is a wildcard match for anything not prohibited by the win shell. This would allow them to write raw data in the file, using it as a data channel.

    This would achieve automated methods of data recovery vis-a-vis manually digging through half a meg of streaming pcm.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  5. #25
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,611
    Rep Power
    25

    Default

    Still not sure of the purpose of using the above regex.
    If a file exists, how can it have invalid chars in its name?
    Why not use endsWith(".willemjav") to find file names?

  6. #26
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Arrow we can do that

    Quote Originally Posted by Norm View Post
    Still not sure of the purpose of using the above regex.
    If a file exists, how can it have invalid chars in its name?
    Why not use endsWith(".willemjav") to find file names?
    The discussion of why I considered this approach first is deeply involved in obscure technical reasons, we can certainly do it as you suggest. I am swamped, make sure the folks understand that if we do this it is for prototyping and that making a sub-directory to contain data streams encapsulates.

    With some work the header information could be extracted under a generalization of the regex approach using capturing groups.
    Last edited by Nicholas Jordan; 07-31-2008 at 09:38 PM.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  7. #27
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,611
    Rep Power
    25

    Default

    When the smoke clears, maybe I'll be able to understand what you are talking about.

  8. #28
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Talking driver writer recommended another site

    SynthMaker - Modular VST and DSP Visual Programming Environment

    Haven't looked at it yet, Doug has written drivers so site probably says some things he recognizes.

    Norm: I can see your reply to my reply now. What we would do to follow Java conventions ( given that my approch is pursued in the foggy moment ) is to do name=value pairs a'la

    Properties (Java 2 Platform SE v1.4.2)

    directly in a 200 character string before the proposed willemjav file extension.

    This would be re-worked later to follow conventions, it is a bench-hack for the limited time / limited puropose of archiving Opie's work during early phases to avoid trying to write a full-blown source translator. Much of the territory we are in has not been effectively reduced to reliable api's, we can get hung trying to find something that will work and I sought to get the byte[] readable in java using the filename listing in a dedicated directory to achieve parsing of the data stream.

    We can as well just use a matching properties file for each data stream, this would probably be more like Java conventions but I see a single layer data type that will not expansively provide individual stream types for each of the byte[] as os File. I do not see how we can have a PASCAL process and a Java process running in the same process space, signals are being reduced in their use in Java due to calling into 16-bit single threaded code and thus given the near-realTime nature of feeding PCM I would like to avoid all signals wherever possible.

    Maybe this will help: Public Key Distribution through "cryptoIDs"
    Last edited by Nicholas Jordan; 08-01-2008 at 12:02 AM.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  9. #29
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    Nick ,all this reminds me of an old song of Harry Belafonte, the song was about sex education of kids back in the old days (nowadays we have the internet happely taking care of it). The refrain was like:
    "it was as clear as mud but it cover the ground......"

  10. #30
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default pascal clock

    i

    miditimer = new Timer(1000, listener);
    miditimer.setRepeats(true);


    The get the pascal clock in java hooping that it works on seconds?

    Java Code:
    miditimer = new Timer(1000, listener);   
    miditimer.setRepeats(true);
    
    
    public void clkset{int x?, int y?)  {  // after pascal clkset(6,klok);
    miditimer .stop();   // I do not I you should stop a timer
    miditimer start();  // before starting
    miditimer.setRepeats(true);
    clkpls = 0;
    
    }
     
    
    public void actionPerformed(ActionEvent evt) {  
                if (evt.getSource() ==  miditimer)  {   // clkpls reads out the pascal timer
    		clkpls++
                 }
       }
    this code fragment in pascal explains the above
    Java Code:
    clkset(6,klok);
         repeat
           if bconstat(2)<0 then
           begin
             if bbconin(2)=27 then zoekerboo:=false;
           end;
           if (clkpls>=(i1*3)) and (i1<50) then

  11. #31
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    Next question is what might be:
    bconstat, bbconin?

    (some ascii code?)

  12. #32
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    of course the listener comes from

    EventHandler listener = new EventHandler();

    private class EventHandler implements ActionListener {


    public void actionPerformed(ActionEvent evt) {

    if (evt.getSource() == miditimer) { // clkpls reads out the pascal timer
    clkpls++
    }
    }

  13. #33
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Talking the song remains the same

    Quote Originally Posted by willemjav View Post
    Nick ,all this reminds me of an old song of Harry Belafonte, the song was about sex education of kids back in the old days (nowadays we have the internet happely taking care of it). The refrain was like:
    "it was as clear as mud but it cover the ground......"
    Yeah, I was worried I had had safe sex with myself by posting crypto stuff to Norm, it's always the same again and again - trying to stuff 64 byte datablocks through 8-bit octets is not sufficient for the work at hand. Looks like you and the poster from Germany or wherever it is are starting to get some translation channels opened, but what I want to avoid is crushing the whole thing down to an eight-bit wide data channel. Uh, trust me - you have so far.

    What I want to set as the targe is a 64 byte base datablock at 1-khz control-loop, doing that is not overly difficult in Java Code be though it may that there is no way to do full-cross platform portability even semi-portably when we get down to critical system time domain issues. It's the sort of thing that causes me to favor ftr, if he says anything his word is senior to mine. He told us PCM so it's PCM. If you can get the work in PASCAL over to java then doing PCM converstion from there is probably in sight.

    I burnin adrenaline right now because I almost lost,..... the jvm would not even let me do file writes. It is buried in the shell somewhere, the Unice often make fun of poor winnie the pooh and I just have too much at stake to try to work right now. The posting about crypto ( a few posts back ) is for general overview, if we make strong keys and people lose them -which they will do - we do not want to be locked on development avenues we have not chosen for ourselves.

    I just de-installed all of my Java, will bring it back up in the morning. Focus on keeping us a sufficiently wide data block that we do not get choked down to an eight-bit keychain garage door opener. Driver writers for video and other system kernel routines use 32 / 64 / 128 bit data blocks already, I would think 256 bit datablocks will fit in some processors soon. 64 bytes times 8-bit bytes == 2,048 bits, which is fortunately considered to be the minimum keysize for open-wire protections and that also is a handy size for musical data-blocks before compression and computer science. The machines popular today often have a natural rate very close to one kilohertz so until we know how to do 44.1khz PCM using real computer science I will sleep better if you will target your main control loop to run at 1-khz passing enough 64 byte data blocks to give you whatever level of room to work you need.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  14. #34
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    again:
    1) midi has 8 bits and runs at a low clock rate
    2) that´s the ground rule we can´t change
    3) audio is a different story
    going back to my translating process

  15. #35
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default

    Nick,
    you might consider opening a thread about turbo-midi or Nicholas-midi, and see who is interested (I am NOT!). Else stick to the above concept because all the rest (your writing about) is OVERKILL regarding midi, which might scare people away from this thread!

  16. #36
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Smile ok

    Okay, as noted.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  17. #37
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    Java Code:
    // There are two Timer classes available:
    // One is in http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/Timer.html
    // The other is in http://java.sun.com/j2se/1.5.0/docs/api/java/util/Timer.html
    
    // This sets us rolling with a one second update rate:
    miditimer = new Timer(1000, listener);   
    
    // I suggest:
    miditimer = new (1, listener);
    // which gets us an effective control rate of 1 khz
    // That control rate can be used to dispatch the 
    // next note to be played by a lookup on how long
    // the current note has been playing vis-a-vis how
    // long it is supposed to play. This can be done with
    // a countdown loop or by calculating note start time
    // minus current time. We have a natural clock in the 
    // system also, timings can be centered on a long .....
    
    miditimer.setCoalesce(true);
    // Not to be funny, explaining why would be too much.
    
    miditimer.setRepeats(true);// correct.
    
    // Start the clock from either a console ( keyboard command )
    // or from a Swing user interface. I suggest using a Swing 
    // rather than the keyboard. Again, not to be funny, you just
    // told me to cool it so you may rest assured you do not want
    // to know why we should not control the MIDI from a console.  
    // If you insist on doing so, there will be System issues that 
    // are neither apparent nor do they resolve anywhere short 
    // of custom designed hardware. I can write you some custom 
    // code that will do this if you promise to fend for me when
    // they laugh at me.
    miditimer.start();
    
    /*  Norm, we set a Daemon Thread running on System.in to 
         sit on the console without loading the other threads. That
         thread would need to be setDaemon(true) so that it does 
         not make exits lethargic.    */
    
    
    // Attempting to translate the Pascal clock code:
    //  ( this is really far from working )
    public void clkset(6,klok)  {  
      while(zoekerboo)
         if(bconstat[2] < 0) {
              if ( bbconin(2) == 27){zoekerboo=false;}
              if ( (clkpls >= ( i * 3) ) && ( i < 50) )
        // ????.... really kludgy attempt ....
    
    // given: clkpls reads out the pascal timer
    // Java:  reads it to where?
    
    // clkpls might be clocksPerSecond in Java
    // zoekerboo should be a loop control variable?
    // bbconin sounds like console, iow the keyboard
    // klok should be clock or Clock in Java, I can 
    // write you a super simple Clock class easily.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  18. #38
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default now we are talking

    Nick, now we are talking (don´t be afraid, you wont be under attack, your "retorica" scares of your attackers too much anyway).
    Okay, swing clock, that make since, but it is limited?
    So import swing clock!
    Setting it to pulse on second-rate and each rate augments the counter (clkpls++) that would fit nicely into the long pascal code.... what is wrong with that? The next code resets the clock to a new beginning (the reseting is controlled by the program or midi_in reading out the midipedal of the cello player. So that is why the clock has actually noting to do with swing stuff..... so take away the swing clock.... give your reasons (nick, I should say you are on the right track, more understandable, usable code, less comments, which go too much of track, I like retorica... but, I´d like to learn more about java)

    public void clkset{int x, int y) { // after pascal clkset(6,klok);
    miditimer.stop(); // I do not I you should stop a timer
    miditimer.start(); // before starting
    miditimer.setRepeats(true);
    clkpls = 0;
    }

    Bottom-line what is wrong with my code?

  19. #39
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default clock rate the main issue here

    The clock rate is the very important issue for the moment. The resolution of 1000 is probably to low (you are right) but 1 (=each millisecond) is to high. The low clock rate of midi is not only rooted in computer history (meaning, that old comp, at the time midi occured where simply to slow) but is also related to human performance in music. Lets turn again to Ligeti´s continuum for cembalo solo. How fast can a human being play on a (light) keyboard. There lies the answer of the clock rate (or just a little over). The next code, in pascal, is the first sounding block. There is a lot of midi-sending-out going on (don´t worry about that), but the actual note playing is done by "toon" and midi_toon. Note please, the long repeat loop. The clkpls (with what rate?) controlles several counters..... please do not judge the programming concept, it was done 20 years ago, and it did work. THE PROBLEM IS HOW TO UNDERSTAND IT ALL TODAY (ha ha ha, some senior programers may laugh or recognize the situation)

    Java Code:
    procedure klankblok1;
       var tel, teller, fractie, toon, tijd1, tijd2, tijd3, i1, i2,
           i3, i4, i5, stem, vel, waarde: integer;
           boo1, boo2, boo3, boo4: boolean;
    
       begin
         tel:=0; teller:=0; waarde:=0;  
         i1:=0; i2:=0; i3:=0; i4:=0; i5:=0; tijd1:=0; tijd2:=0; tijd3:=0;
       
         midi_data(algemeen,'fdb',7,6,8,data);
         midi_stereo(1,1,links);
         midi_stereo(2,3,midde);
         midi_stereo(4,4,rechts);
         midi_stereo(5,6,links);
         midi_stereo(7,8,midde);
         midi_vel(1,4,67);
         midi_vel(5,8,97);
       
         clkset(6,klok);
       
         repeat
           if bconstat(2)<0 then
           begin
             if bbconin(2)=27 then zoekerboo:=false;
           end;
           if (clkpls>=tel*7) and (tel<=60) then
           begin
             tel:=tel+1;
             midi_vel(1,4,67+tel);
           end;
         
           if clkpls>=50*teller  then 
           begin
             teller:=teller+1;
             if (teller>10) and (teller<=40) then midi_vel(5,8,97+teller-10);
           end;
    
           if teller=8  then midi_data(algemeen,'fdb',1,1,2,data);
           if teller=12 then midi_data(algemeen,'fdb',1,3,4,data);
           if teller=14 then midi_data(algemeen,'fdb',2,1,2,data);
           if teller=19 then midi_data(operator4,'lev',8,1,2,data);
           if teller=23 then midi_data(operator4,'lev',8,3,4,data);
           if teller=25 then midi_data(algemeen,'fdb',3,3,4,data);
           if teller=29 then midi_data(algemeen,'fdb',3,1,2,data);
           if teller=31 then midi_data(algemeen,'fdb',4,1,2,data);
           if teller=34 then midi_data(algemeen,'fdb',5,3,4,data);
           if teller=38 then midi_data(algemeen,'fdb',5,1,2,data);
           if teller=40 then midi_data(operator4,'lev',7,1,2,data);
           if teller=43 then midi_data(operator4,'lev',7,3,4,data);
           if teller=45 then midi_data(operator4,'lev',6,1,2,data);
           if teller=49 then midi_data(operator4,'lev',6,3,4,data);
           if teller=52 then midi_data(operator4,'lev',5,1,4,data);
           if teller=53 then midi_data(operator4,'lev',4,1,4,data);
           if teller=55 then midi_data(operator4,'lev',3,1,4,data);
           if teller=56 then midi_data(operator4,'lev',1,1,4,data);
           if teller=57 then 
           begin
             midi_data(operator4,'lev',0,1,4,data);
             midi_data(operator4,'d1r',6,1,4,data);
             midi_data(operator3,'lev',3,1,4,data);
             midi_data(algemeen,'fdb',7,1,4,data);
           end;
           if bconstat(2)<0 then
           begin
             if bbconin(2)=27 then zoekerboo:=false;
           end;
         
           if teller=12 then waarde:=134;
           if teller=19 then waarde:=259;
           if teller=23 then waarde:=378;
           if teller=30 then waarde:=491;
           if teller=37 then waarde:=598;
           if teller=43 then waarde:=700;
           if teller=52 then waarde:=798;
    
           if teller=6 then midi_vel(5,8,97);
    
           if clkpls>=tijd1 then
           begin
             tijd1:=random(startgetal,80-teller,400-(6*teller))+tijd1; {?}
             if teller<=58 then 
             begin 
               boo1:=true; boo2:=true; boo3:=true; boo4:=true;
             end;
             case random(startgetal,1,4) of 
               1: boo1:=false;
               2: boo2:=false;
               3: boo3:=false;
               4: boo4:=false;
             end;  
           end;    
           if bconstat(2)<0 then
           begin
             if bbconin(2)=27 then zoekerboo:=false;
           end;
    
           if clkpls>=3*i1 then
           begin
             i1:=i1+1;
             if boo1 or boo2 then
             begin
               toon:=random(startgetal,1,waarde);
               fractie:= toon mod 127;
               toon:= toon div 127;
               vel:=random(startgetal,80,100);
               stem:=random(startgetal,1,2);
               if boo1=false then stem:=2;
               if boo2=false then stem:=1;
               midi_toon(stem,50+toon,fractie,vel);
             end;
           end;
       
           if clkpls>=4*i2 then
           begin
             i2:=i2+1;
             if boo3 or boo4 then
             begin
               toon:=random(startgetal,1,waarde);
               fractie:= toon mod 127;
               toon:= toon div 127;
               vel:=random(startgetal,80,100);
               stem:=random(startgetal,3,4);
               if boo3=false then stem:=4;
               if boo4=false then stem:=3;
               midi_toon(stem,50+toon,fractie,vel);
             end;
           end;
    
           if clkpls>=tijd3 then
           begin
             midi_toon(5,20,random(startgetal,0,127),random(startgetal,50,80));
             tijd3:=random(startgetal,10,60)+tijd3;
           end;
           if bconstat(2)<0 then
           begin
             if bbconin(2)=27 then zoekerboo:=false;
           end;
         
           if (clkpls>=400+tijd2) or (teller=56) or (teller=58) then
           begin
             tijd2:=random(startgetal,30,600)+tijd2;
             midi_data(algemeen,'fdb',random(startgetal,5,7),5,8,data);
             if teller>=58 then 
             begin 
               midi_data(algemeen,'fdb',7,5,8,data);
               midi_data(operator4,'lev',0,5,8,data);
             end;
             toon:=random(startgetal,16,17);
             fractie:=random(startgetal,0,127);
             midi_toon(5,toon,fractie,127);
          
             toon:=random(startgetal,17,18);
             fractie:=random(startgetal,0,127);
             midi_toon(6,toon,fractie,127);
    
             toon:=random(startgetal,18,19);
             fractie:=random(startgetal,0,127);
             midi_toon(7,toon,fractie,127);
           end;
         until (teller>=60) or not zoekerboo;
     
    {midi datadump no 3}
         midi_datadump(data,1,6,7);
         writeln('    DATADUMP 3 DONE '); writeln; writeln; writeln; writeln;
    
         midi_data(algemeen,'fdb',6,1,8,data);
         midi_data(operator4,'d1r',3,1,8,data);
         midi_data(operator4,'lev',4,1,8,data);
         midi_data(operator3,'lev',7,1,8,data);
         if zoekerboo then
         begin
           midi_toon(1,50+b_toon1,b_fractie1,127);
           clkset(6,klok); while clkpls<=3 do ;
           midi_toon(2,50+b_toon2,b_fractie2,127);
           midi_toon(3,50+b_toon3,b_fractie3,127);
           clkset(6,klok); while clkpls<=7 do ;
           midi_toon(4,50+b_toon4,b_fractie4,127);
           clkset(6,klok); while clkpls<=5 do ;
           midi_toon(5,50+b_toon5,b_fractie5,127);
           clkset(6,klok); while clkpls<=4 do ;
           midi_toon(6,50+b_toon6,b_fractie6,127);
           midi_toon(7,50+b_toon7,b_fractie7,127);
           while clkpls<=700 do ;
    
           midi_toon(3,50+b_toon3,b_fractie3,0);
           midi_toon(4,50+b_toon4,b_fractie4,0);
         end;
       end;

  20. #40
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default clock is not the keyboard

    Yes, accomplished programmers know this moment all to well. I have some major issues on my primary project, way deeper than this. What we do here is a well known design, You have three or four .... ( uh, spare me the moment ) areas.... of the program. One of them reads the keyboard { which though you have not forgotten - you just have not realized it yet } but in our design the data byte[] stream basically ( for the moment ) replaces the keyboard. That byte stream may also be modeled as a sequence of instructions. The clock pulls them off the ( stack | list | sequence ) and as such it is better to think of them as a list. Reading from the front of the list should be for now done as a disk-read. Trying to read from the front of the list goes into the switchback we just went through. Okay.

    We then have a Picker-Puller that lines up things for the midi player to do. Noteable the note play you have already accompilished. You have a sort of a boudary -->|<-- where one area of the program 'talks' to another. All the clock does is drive the two sides, the propogation across the boundary is occuring at 1khz, but does not in fact push a note every time it is called. It can in fact be a void return type. The design problem occurs in that if any of the data is in a Java Object ( including arrays ) we have what is called a synchronization problem. The resolution of that problem is far beyond the reach of source code, unless you are very carefull and very well informed. There is no way to do it portably across many differing architectures.

    Since you insist on midi, what we will have to do here is have the Clock class we will be writing momentarily do the push you refered to from early on. All it does is see if the note needs changing and if so write the note to the midi port and return. Because we have the music data-typed as raw byte stream, we read a considerable amount in early in the program and let the midi-stream get ahead of the note that needs to be played. We keep the notes in a TreeMap, pushing them in by a sort of index: What and exactly how that index is done is somewhat ahead of where you are at, but what it does is gives us a one - two - three - four ...... sequence that moves on to the thousands of notes to be played next. Providing rich, fluid harmonics in moving aura is not done with one or two notes a second, the TreeMap keeps the what to do next naturally aligned by the way it works.

    You then have a primitive form of what is called a scheduler, that brings the 1khz clock rate down to the human performance in music and it's the several counters that does that. We have to get some more information before we can do " what's wrong with my code? "

    I need to know what every one of these variables does:
    Java Code:
    procedure klankblok1;
       var tel, teller, fractie, toon, tijd1, tijd2, tijd3, i1, i2,
           i3, i4, i5, stem, vel, waarde: integer;
           boo1, boo2, boo3, boo4: boolean;
    
       begin
         tel:=0; teller:=0; waarde:=0;  
         i1:=0; i2:=0; i3:=0; i4:=0; i5:=0; tijd1:=0; tijd2:=0; tijd3:=0;
    This is just the picker-puller:
    Java Code:
         midi_data(algemeen,'fdb',7,6,8,data);
         midi_stereo(1,1,links);
         midi_stereo(2,3,midde);
         midi_stereo(4,4,rechts);
         midi_stereo(5,6,links);
         midi_stereo(7,8,midde);
         midi_vel(1,4,67);
         midi_vel(5,8,97);
    aka very primitive scheduler. Where you have 7,6,8 /1,1 / 2,3 / 4,4 / ....

    probably are the notes, which we will store as a series of bytes in a file. We have to get them back again so if you can write me a Note class, we just line them up in a list, un-beknownst to most intermediate computer scientists is that list, stack and so on are commonly implemented as a Tree of some kind behind the scenes, they run remarkably efficiently. What we do here is store the notes in a TreeMap on the basis of what note comes next and have the 1-khz clock class only pick them off and "push' the note only if it is ready to be played according to human compositional.

    For the Clock to do that, it has to have what they called a score in my High School String Bass instruction, ditto Piano class, an Orchestra has a ( you're the musician, what do they call that ) just write a bunch of dummy classes that do nothing ~ give them all names that are common music nomenclature. Thus: class Orchestra {} and use them as throw-away concepting pads until we get some more Top-Down. The minimum the clock will function effectively is twice the data rate for the note because of what is called: "The Nyquist–Shannon sampling theorem" A fundamental result in the field of information theory, in particular telecommunications and signal processing, it tells us the clock has to run at at least twice the data rate. If we do not try to do any screen activity or ( especially ) any disc-writes, we can get away with a 1-khz clock rate and keep the machine responsive, you will try to drive the notes directly with the clock and that is why we just went through what we just went through.

    The problem here is that pascal as it is in the original work has no concept of Threads, something that is natural for Java. An extremely powerful concept, it has to be done as a Master work or don't do it at all.

    The
    Java Code:
           if teller=14 then midi_data(algemeen,'fdb',2,1,2,data);
           if teller=19 then midi_data(operator4,'lev',8,1,2,data);
    is where the picker-puller decides if the next note needs to be pulled off the TreeMap.

    We have a design issue here you are not ready for based on your review of my post dated yesterday, Masters in cs know how this goes .... so I am not overly worried about it but we can say with assurance you do not want to look at the crash logs for what I just went through....

    Makes this look puny by comparison.

    { no harm done }
    Last edited by Nicholas Jordan; 08-02-2008 at 12:29 AM.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

Page 2 of 7 FirstFirst 1234 ... LastLast

Similar Threads

  1. PASCAL & JAVA? for senior members
    By willemjav in forum Forum Lobby
    Replies: 2
    Last Post: 07-13-2008, 12:11 PM
  2. Pascal Triangle help
    By Magic101 in forum New To Java
    Replies: 4
    Last Post: 05-01-2008, 08:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •