Multi tasking project help please!

I've been working on this code which takes inputs from a midi-keyboard and writes it to a midi file(*.mid) while simultaneously displaying it on the graphical axis in real-time(x-axis = time axis y-axis= key axis i.e. corresponding to the key pressed). I've developed a code but the problem is that it's creating an empty midi file and there's no graphical output but just a still frame that is drawn in a window. Is the code right? because i've used the following code to draw the axes: http://forums.sun.com/thread.jspa?forumID=20&threadID=383034 . I've also used the CreateSequence.java file from java sound resources to write to a midi file from jsresources.org and the jmidi package for interfacing the keyboard from : http://www.softsynth.com/javamidi/
The code is pasted below

class g3 extends JFrame
               myView          myGraph = new myView();
               Thread t;
               //boolean         ok    = false;
               public g3() 
                    setBounds(3,10,765,840);
                    addWindowListener(new WindowAdapter()
                    {     public void windowClosing(WindowEvent ev)
                         {     dispose();
                              System.exit(0);
                    JLabel lab = new JLabel("Displaying notes at every 0.3 seconds");
                    lab.setOpaque(true);
                    lab.setBackground(Color.cyan);
                    lab.setHorizontalAlignment(SwingConstants.CENTER);
                    lab.setFont(new Font("",1,16));
                    getContentPane().add("North",lab);
                    getContentPane().add("West",new myLeft());
                    getContentPane().add("Center",myGraph);
                    JLabel rid = new JLabel("            Reading");
                    rid.setOpaque(true);     
                    rid.setForeground(Color.blue);
                    getContentPane().add("South",rid);
                    setVisible(true);
               public void running(int status,int key, float ts)
                         try
                              Thread.sleep(300);//changed sleep time to 300ms from 1 second.
                              if (myGraph.G != null) myGraph.draw(status,key,ts);
                              repaint();
                              return;
                         catch(Exception e) {}
          class myView extends JComponent 
               Image      I;
               Graphics2D G;
               int    cnt    = 0;
               //int    last_y;
               Vector points = new Vector();
               Point2D.Double  point;
               public void draw(int stat, int kn, float tstamp)
                    int y1 = (63-(kn-35))*12+14;//changed to 62 from 11 then back to 11 :P
                    newImage();
                    G.setColor(Color.darkGray);//color of the output
                    //cnt++;//an ordinary counter to add points periodically..
                    if (points.size() == 800/4) points.remove(0);//if it reaches the limit then remove the leftmost element..thus shifting elements to the left
                    points.add(new Point2D.Double(tstamp,y1));
                    for (int i=0; i < points.size(); i++)
                         point = (Point2D.Double)points.get(i);               
                         if (i > 0)          
                              while(stat!=80)
                                   if(stat==90)
                                        point = (Point2D.Double)points.get(i); //gets the value of the point depending on the number i
                                        int x = (i-1)*4+1;//defines values of x as 1,5,9,13...
                                        G.drawRect(i,(int)point.y,i+1,(int)point.y);//plots the output rectangles
                                        return;
                         //last_y = Point2D.y;
               public void paintComponent(Graphics g)
                    if (I == null)
                         I = createImage(702,800);     //changed from 276 to 800, caused the image to increase downwards
                         G = (Graphics2D)I.getGraphics();
                         newImage();     
                         G.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);          
                    super.paintComponent(g);
                    g.drawImage(I,0,18,null);//changed 20 to 62,shifted the rectangle by a few pixels below
                    for (int i=0; i < points.size(); i++)//draws the scale on the x axis
                         g.fillRect(i*4+1,9,1,2);
                         cnt++;
                         if (cnt%10 == 0) g.fillRect(i*4+1,3,1,8);
               public void newImage()
                    G.setColor(Color.lightGray);
                    G.fillRect(0,0,802,741);     
                    // G.setColor(Color.cyan);
                    // for (int y=1; y < 62; y++) G.fillRect(0,y*25,702,1);//changed  from 12 to 62
                    G.setColor(Color.black);
                    G.drawRect(0,0,701,740);//changed y component from 275 to 701...didnt completely fill the rect so changed further to 800
          class myLeft extends JComponent 
               public myLeft()
                    setPreferredSize(new Dimension(35,1));
               public void paintComponent(Graphics g)
                    super.paintComponent(g);
                    g.setFont(new Font("",0,9));
                    int octave;
                    String[] note=new String[200];
                    //draw values on the y axis:
                         int i=1, n=0;
                         g.drawString("0",18,(62-n)*12+14);
                         n++;
                         if(n>=0&&n<12)
                              octave=1;
                              note[1]="A";
                              note[2]="A#";
                              note[3]="B";
                              note[4]="C";
                              note[5]="C#";
                              note[6]="D";
                              note[7]="D#";
                              note[8]="E";
                              note[9]="F";
                              note[10]="F#";
                              note[11]="G";
                              note[12]="G#";
                              while(i>=1&&i<13)
                                   g.drawString((note[i]+""+octave),18,(62-n)*12+14);
                                   n++;
                                   i++;
                          if(n>=13&&n<25)
                              octave=2;
                              note[13]="A";
                              note[14]="A#";
                              note[15]="B";
                              note[16]="C";
                              note[17]="C#";
                              note[18]="D";
                              note[19]="D#";
                              note[20]="E";
                              note[21]="F";
                              note[22]="F#";
                              note[23]="G";
                              note[24]="G#";
                              while(i>=13&&i<25)
                                   g.drawString(note[i]+""+octave,18,(62-n)*12+14);
                                   n++;
                                   i++;
                         if(n>=25&&n<37)
                              octave=3;
                              note[25]="A";
                              note[26]="A#";
                              note[27]="B";
                              note[28]="C";
                              note[29]="C#";
                              note[30]="D";
                              note[31]="D#";
                              note[32]="E";
                              note[33]="F";
                              note[34]="F#";
                              note[35]="G";
                              note[36]="G#";
                              while(i>=23&&i<37)
                                   g.drawString(note[i]+""+octave,18,(62-n)*12+14);
                                   n++;
                                   i++;
                         if(n>=37&&n<49)
                              octave=4;
                              note[37]="A";
                              note[38]="A#";
                              note[39]="B";
                              note[40]="C";
                              note[41]="C#";
                              note[42]="D";
                              note[43]="D#";
                              note[44]="E";
                              note[45]="F";
                              note[46]="F#";
                              note[47]="G";
                              note[48]="G#";
                              while(i>=37&&i<49)
                                   g.drawString(note[i]+""+octave,18,(62-n)*12+14);
                                   n++;
                                   i++;
                         if(n>=49&&n<61)
                              octave=5;
                              note[49]="A";
                              note[50]="A#";
                              note[51]="B";
                              note[52]="C";
                              note[53]="C#";
                              note[54]="D";
                              note[55]="D#";
                              note[56]="E";
                              note[57]="F";
                              note[58]="F#";
                              note[59]="G";
                              note[60]="G#";
                              while(i>=49&&i<61)
                                   g.drawString(note[i]+""+octave,18,(62-n)*12+14);
                                   n++;
                                   i++;
                         g.drawString("A6",22,(62-n)*12+14);
                    g.setFont(new Font("",0,12));
                    String s = "Notes";
                    g.setColor(Color.blue);
                    g.setFont(new Font("",1,12));
                    for (int j=0; j < s.length(); j++)
                         g.drawString(""+s.charAt(j),6,j*45+300);
          class Music
               static MidiPort midiport;
               public static void inputTest( int inDevice, int outDevice )
                         InputThread inputThread;
                         try
                              midiport = new MidiPort( inDevice, outDevice );
                              inputThread = new InputThread( midiport );
                              inputThread.start();
                         catch (Exception e)
                              System.err.println( "Error!" + e.getMessage() );
                    public static void main(String args[])
                         int inDevice = 0;
                         int outDevice = 0;
                         inputTest( inDevice, outDevice );
          }

Similar Messages

  • After mixing a project i select bounce and burn the disc that is burned plays on any cd player but when i try to burn the wav or mp3 file that was created the resulting disc will only play in a computer this also happens with video projects help please

    after mixing a project i select bounce and burn the disc that is burned plays on any cd player but when i try to burn the wav or mp3 file that was created the resulting disc will only play in a computer this also happens with video projects help please are there any settings i need to alter as it seems the wav or mp3 file i ceated is being converted to a data file somewhere between the folder and disc drive

    Same thing for a movie file.. If you want to play back the movie via a DVD and a DVD player you must create a Movie DVD  and not just burn files to a data DVD... as Data DVDs are just storage devices for files and therefore will only work with computers...
    Movie DVDs are special formats that include things like menus and special file formats.. so they can playback via a DVD Player...
    You will need a 3rd party DVD Burning app like Toast which is what i actually use.... or the more popular DVD Creator app...to create and then burn a Movie DVD that will playback on a DVD Player....
    https://answers.yahoo.com/question/index?qid=20101220205435AA70beb

  • Can't open my project, help please...

    I've spent hours and hours on my wedding video project... When I was working on it, iMove suddenly crashed and then I can't open the project any more...
    I can't open, edit, duplicate and export the project. It allows me to play it in full screen but the content is incomplete.
    My other two projects are fine.
    I tried to reinstall iMovie (delete the program and com.apple.pkg.iMovieXXXX files, and reinstall and update) but it didn't help...
    I tried to repair the disk permissions but it didn't help...
    Could anyone please save me and my project..
    I was using Lion and iMovie 11 with the latest updates. My labtop is MBP 15'' mid-2010.
    Thanks!

    Anyone could help me please ???

  • Very simple java project (help please)

    Hello. For a project I have to somehow use MouseListener to make something. My idea was to have a rectangle in which a circle (hockey puck) follows the user's mouse and whenever the user places the circle into a certain area the count goes up by one (like a game of hockey). If someone could give me some idea as to where I should start it would be greatly appreciated.
    My thanks

    This is alwyas [a good place to start|http://java.sun.com/developer/onlineTraining/] when you don't have a clue what's going on, and here if you need specifics on MouseListener. And to get movement, then you'll probably want to look here.
    Once you have some code and specific questions, literally almost everyone on here will be willing to help you further along the way. When you post code, please use code tags.

  • Research Project - help please

    i am making a report on the percentage of 1900mhz US capable (Tri band or better)hsndsets sold on the European market.
    Would anybody be able to help me find the answers??
    I assume that for e.g lets say that Nokia produces 1,000,000 handsets for sale in Europe per year, and that only a percentage of those are 1900Mhz capable (tri band, quad band etc). i believe that teh majority of handsets sold in Europe are Dual band only (900 + 1800 Mhz) but i have no proof of this, it is only an assumption.
    i need to know, what is the percentage of 1900 capable phones to non 1900 capable phones.
    thanks for helping me get the answers, or pointing me in the right direction.
    Stuart Kull

    I think more and more phones sold in Europe are at least tri-band.
    What you could do is take a look at the device specifications of Nokia handsets available here:
    http://www.forum.nokia.com/devices/matrix_all_1.ht​ml
    I think you'll find that all the Nseries and Eseries devices are in fact quad band 800/900/1800/1900. Many of the 5xxx and above series are as well. I think only the entry-level 1xxx and 2xxx series phones are bi-band.
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • Cannot export iMovie project - Help please

    When I try to share the project I've worked on for over a week, I get the following ...
    However, that event is in the iMovie library.
    The only thing that happened differently this time is that I mistakenly deleted the event files from the event library before I exported the project to save disk space. But once I found out I needed the event clips in iMovie in order to share the project, I found out the clips are still in User > Movies > iMovie Events > British Isles Cruise 2013, so I imported them back into my Event Library in iMovie. So the Event and all the clips are back in iMovie, but I'm still getting the above error, as if iMovie doesn't realize the event is still there, and I cannot share or do anything with my project other than view it in iMovie.
    Any help on this would be much appreciated.
    Thanks!

    you haven't renamed any files/folders?
    just dragged them out of the Events folder, and back, right?
    try this …
    quit iMovie
    goto Library/Preferences and trash com.apple.iMovieApp.plist
    launch iMovie again ....
                     How do I trash the iMovie Preferences File? and Why?

  • Please help i started my project video format 720HD resolution 12x720 rate 25p at last when i finish and burn to dvd the edges are cut off any one help please i am really in trouble

    please help i started my project with  video format 720HD, resolution 12x720, rate 25p.  at last when i finish and burn to dvd the edges are cut off and my logo cut off the screeen aswell any one help please i am really in trouble. thanks

    Sorry, but I don't know anything about that app.
    I did go to their Web site and I see they have a support link. Perhaps you can get help there or in their forum.
    If you are OK with a DVD with a basic menu, you could try the Share>DVD option in FCP.
    Good luck.
    Russ

  • I can't find my project!  Please help.  I can see it on  the desk top but it will not open.

    I have a documentary due tomorrow and it won't play and it's not in my project library in imovie!! HELP PLEASE!!!

    Using the Finder, move the Project from your Desktop to the Movies/iMovie Projects folder. Then restart iMovie.

  • Help-Task not found - Please check the Task Type, Name and Location are cor

    HI all,
    i have upgraded my owb from version 11gr1 to 11gr2. the installation is complete and all my mappings and objects are imported successfully.
    i was able to execute the mappings using the sql code:
    @/oracle/product/11.2.0/owb/rtp/sql/sqlplus_exec_template.sql
    by logging into sqlplus as the user in whose schema mappings are deployed.
    hOwever, suddenly i am getting the error since sometime back - not sure what might have happened or what might have gone wrong. can someone please help me understand what might be wrong - how to decode this?
    Here is my error:
    @/oracle/product/11.2.0/owb/rtp/sql/sqlplus_exec_template.sql
    Role set.
    Enter value for 1: WSODS
    Call completed.
    Enter value for 2: ODS_SCHEMA
    Enter value for 3: PLSQLMAP
    Enter value for 4: MAPPING_1
    Enter value for 6: ","
    Enter value for 5: ","
    Stage 1: Decoding Parameters
    |  location_name=ODS_SCHEMA
    |  task_type=PLSQLMAP
    |  task_name=MAPPING_1
    Stage 2: Opening Task
    begin
    ERROR at line 1:
    ORA-20001: Task not found - Please check the Task Type, Name and Location are
    correct.
    ORA-06512: at "OWBSYS.WB_RT_API_EXEC", line 759
    ORA-06512: at "OWBSYS.WB_RT_SCRIPT_UTIL", line 910
    ORA-06512: at line 2When i execute this: i get the result as follows:
    SELECT warehouse_object_id, store_id, object_type_id, object_type_name, object_name FROM owb$wb_rt_warehouse_objects
    where object_name = 'MAPPING_1';
    WAREHOUSE_OBJECT_ID     STORE_ID                OBJECT_TYPE_ID          OBJECT_TYPE_NAME                                                 OBJECT_NAME                                                     
    15947                   15325                   769                     PLSQLMap                                                         MAPPING_1                                                       
    1 rows selectedEdited by: Chaitanya on Mar 5, 2012 3:33 AM

    Hi Chaitanya,
    Did you get any resolution for this error? I'm facing the same error while trying to execute OWB mapping through this command.
    Any help would be much appreciated. Thanks.
    Regards,
    Jagari

  • Aperture 3.2.4 macbookpro lion: image disappears after loading from any project; repairing everything on starting app doesn't fix it. Only restarting the computer works. Any help, please? ... in non-technical language please. Thanks

    aperture 3.2.4, macbookpro lion: image disappears after loading from any project; repairing everything on starting app doesn't fix it. Only restarting the computer works. Any help, please? ... in non-technical language please. Thanks

    “Hi Kirby, thanks a lot for your answer.
    I got one answer, from DMoore, saying:
    “Try Safe boot and then restart with only Aperture open.  Still doent work write back with more details like Ram, HD capacity/free space.  Are these thumbnails or Previews? Have you turned off building previews in AP preferances?
    Safe boot   http://support.apple.com/kb/HT1564
    Starting up into Safe Mode does several things:
    1  It forces a directory check of the startup volume.
    2  It loads only required kernel extensions (some of the items in /System/Library/Extensions).
    3  In Mac OS X v10.3.9 or earlier, Safe Mode runs only Apple-installed startup items (such items may be installed either in /Library/StartupItems or in /System/Library/StartupItems; these are different than user-selected account login items).
    4  It disables all fonts other than those in /System/Library/Fonts (Mac OS X v10.4 or later).
    5  It moves to the Trash all font caches normally stored in /Library/Caches/com.apple.ATS/(uid)/ , where (uid) is a user ID number such as 501 (Mac OS X v10.4 or later).
    6  It disables all startup items and login items (Mac OS X v10.4 or later).
    7  Mac OS X v10.5.6 or later: A Safe Boot deletes the dynamic loader shared cache at (/var/db/dyld/). A cache with issues may cause a blue screen on startup, particularly after a Software Update. Restarting normally recreates this cache.”
    As I don’t know much about the technical aspects of computers, I don’t really understand the first answer, and it sounds like following it might produce unwanted changes.
    But I understand your questions, so I’ll try to answer them;
    "loading from any Project" means that I encounter the problem when I’m using a project, possibly after/because I’ve left the Mac on overnight, and/or  I’ve made a lot of adjustments, and, once the problem is there, it happens in any other project which I open – the images load then disappear.
    I can see images in the Browser, so it only happens in the Viewer(s).
    I’m afraid I don’t understand what you mean by: “If you select "Photos" from near the top of the Library tab of the Inspector, does it show you all of your Images?”. I am a newcomer to Aperture, so I don’t know what some of the buttons are for yet, but when I want to look at and adjust my pictures, I import them, as referenced images, then Aperture creates a folder/project in the Library. When I click on that Project (when it’s working properly), all the images appear in the Browser or the Viewers  – without me needing to “select Photos from near the top of the Library tab of the Inspector”. I selected it and looked at all the items in the dropdown menu, but none of them seems to offer the option to ‘show all the images’. So I’m not sure how to answer your question except to say that – yes, I can see all the pictures in the Browser or the Viewers (when it’s working properly), but I don’t seem to need to use the Photos button to achieve this.
    Did Aperture work before?
    Yes it worked ok for a while, but I only purchased it on 24th May.
    If I understand correctly, the difference between thumbnail and preview is that the thumbnail is what I see when the “Loading” wheel is turning, and the disappearance of this wheel after a few seconds means that I am now looking at the preview (also, the thumbnail cannot be adjusted).
    So I think the problem occurs when the thumbnail has finished loading; the viewer going blank/grey might mean that it is not showing the preview.
    But I have not changed the default Preview settings in Aperture Preferences.
    My macbookpro details:
    2.7 Ghz Intel Core i7
    Memory: 8 Gb 1333 MHz DDR3
    Hard Drive capacity 499.25 GB
    Available 387.36 GB
    I have noticed another problem: I cannot apply the same rating to multiple images: following the instructions, I select a group of contiguous (or non- contiguous) images, choose a selection eg “5stars” using the keyboard, but the stars only appear in the last selected image – even though all the images are still showing as selected.”
    I hope this helps you to understand more.
    Thank you for trying to help me.
    Tony

  • HT1386 having trouble syncing/downloading contacts & calendar & tasks from outlook 2010 to iphone4s help please.

    having trouble syncing/downloading contacts & calendar & tasks from outlook 2010 to iphone4s help please.

    I had the identical problem.  I still don't know how to sync the tasks, but here's how I did the contacts and calendar:
    1.  Connect the 4s to the computer.
    2.  Open iTunes.
    3.  Click the iPhone box in the upper right corner.
    4.  Click on the info tab.
    5.  Hit the checkbox Sync Contacts with... and choose Outlook from the dropdown box.
    6.  Ditto for Calendars.
    7.  Hit Apply.
    My problem was that originally, I wasn't getting the checkboxes.  I turned off the iCloud settings on the 4s.  That did the trick.

  • IMove 9... Project cannot locate clips after I chose "Split Event Before Clip." Help please!

    iMovie 9; chose "Spit Event Before Clip." Project now cannot locate Event clips for that Project. All Events and Clips are on an extenal HD. All I see are !-points for all clips in the Project. Help!
    I noticed another Event folder for the same clips so I "Merged" them. Still nothing. I've had nothing but problems with the waaay overdue project. I really need some help, please!
    gb

    I'd even gladly pay someone to walk me through this on the phone! I'm really desperate at this point!
    gb

  • I have a black window that keeps coming up and telling me the various tasks that I am handeling. It came after opening a power point and now I cannot make it disappear. It frames all windows and programs that I open with a black line. Help please...

    I have a black window that keeps coming up and telling me the various tasks that I am handeling. It came after opening a power point and now I cannot make it disappear. It frames all windows and programs that I open with a black line. Help please...

    Go to System Preferences - Accessibility - Voiceover - turn off Voiceover. The shortcut is command-F5, so possibly you pressed that accidentally.
    Matt

  • Troubleshooting: Help please. Creating a PDF file from a Photoshop-designed project

    I wanted to add personal design elements to my resume so I decided to use Photoshop to add in a logo and a footer. The problem is, when I converted the 3 Photoshop .psd files (3 pages) to .pdf files, the combined file came out to be very big in size. The biggest was 2.88 MB and the smallest that I got it to be without compromising the quality of the text and images was 1.48 MB.
    What did I do wrong?
    I've seen other .pdf files with more images and more color and definitely more pages and text which were only 300KB in size. How can I make my final .pdf file size small but still retain the quality of the original design from Photoshop?
    I've tried merging the layers before saving. I've tried turning the files into .gif files before making the pdf. Into jpegs before making the pdf. Changing the canvas and image sizes in Photoshop into super small which made the final pdf file unreadable and super blurry. I'm at my wit's end.
    Details:
    .psd image size 8.5 by 11 inches (normal resume size)
    colors - black, gray, light blue and light yellow
    Images are very minimal, 4 lines total and around 5 circles at the header of the first page and footer of the 3rd page.
    Help please!
    X-cross-post: Acrobat Forum-X

    This is so sad. I read your comments and I said, "Huh?" Haha!
    I tried the indexed color option and it did make the final file smaller. Around 600KB. But there's probably another way to make it even smaller like the gazillion-paged pdf file that I mentioned that was only about 300KB.
    And by saying a layout program, does that mean like Adobe InDesign? Does that mean that I should just make my graphics in Photoshop and then import using another program and finish the file there?
    What other layout programs can I use?
    Thank you so much!

  • Multi track project  shows audio track 1 & not 2  need help!!!!

    hello everyone... Have a sequence in fcp 1 video track 2 audio tracks i right mouse click the sequence go to send to click on multi track project it sends to soundtrack pro but only track 1

    This would frustrate me in the beginning and sometimes it will come back to me. I'll blame that on the Pro tools I have installed. Make sure that device is enabled in controll panel, hardware. Disable the ones you don't use. I don't think AA will recognize usb or firewire hardware if that is what you have. Needs to be a card. I use the M-Audio Delta L1010. 8 inputs. I use 8 direct outs from my mixing board into the 8 inputs on the card. Sounds very good for the price.
    Good luck.
    Donnie

Maybe you are looking for