Page 2 of 4 FirstFirst 1234 LastLast
Results 21 to 40 of 78

Thread: midi bytes

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

    Default

    I've connected thru a serial port to communicate with a GPS.
    I have NOT connected to a USB device from java.
    I have no idea about any of the other types of connections you refer to. Are they special cards plugged into the motherboard with their own sockets?

  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 Willem Dragstra Web Site

    Quote Originally Posted by willemjav View Post
    ....Citespascal.doc .....
    Cited link is dot doc, convert to simple html 1.0 / 1.1 no scripting, no attachments.
    All data as text/plain min == 0x20 max == 0x7e

    I just left a site yesterday, a Grand Master in our field of study. The main 'campus' site security site, having banners for security and admonishing several standard security procedures, was down. The master's site was up with KISS/TEXT, along with several other workers who use the simplified format. Conversion from PASCAL, or any of about a hundred programming languages is a known science, we do not do the work ~ only answer questions about how to do the work:
    Java Code:
    Patten linkFinder = Pattern.compile("< ?a href=\"(\\w+?://(www)??\\.\\w+?\.\\w\\w\\w/?(\\w+|/)\\??(\\w+|=))\">[^<]++");// Partial,.... any help welcome.
    Last edited by Nicholas Jordan; 07-22-2008 at 01:19 AM.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

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

    Default

    Norm, by answering all your questions I might eventually solve my problem? Right!
    Nicholas, when I saw again this code, after 20 years I had a similar feeling! We have a very interesting member at our forum called Hardwired. He indeed wrote several (complete) applications concerning my programming problems. I indeed copied that work. But I never copied it to simply make my code going, I always wrote, after studying Harwired´s code, my on version. (I still have to finish one concerning glasspanes of which hardwired already write two independent solutions, see applets). I am almost done with rewriting the first part of pascal in java and I taught that the midi_out thing would be a piece of cake and I was wrong.

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

    Default

    Lets try to return to (one of) the deeper meaning(s) of this form, learning programming in java. So I´d like to try another approach.
    1) In order to get a byte to midi out I need to find a midi device yes/no
    2) By calling getMaxTransmitters(),getTransmitters() we might obtain a list of present devices yes/no
    3) Select a device from that list or simply say
    m_out = MidiSystem.getTransmitter();
    Is that correct so far yes/no

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

    Default

    I ask questions to get you to explain your problem in terms I might understand. Some times the OP's problem has nothing to do with the specifics of his app, but is just a common java programming problem like classpath or misuse of a class.
    Usage of special packages like for sound, I won't be of any help with.

    Sometimes answering questions will cause the OP to look at the problem from a different angle. When I was programming, we had an expression: "cardboard programmer". It described the roll another programmer played when he was asked to help a programmer solve a problem. The one with the problem would start explaining the problem and before the "cardboard programmer" could begin to understand the problem, the asker would suddenly find the solution, say thanks and go back to his desk.

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

    Default this is an interface

    MidiDevice (Java Platform SE 6)) is an interface. Sorta difficult to explain, like say how many strings an instrument will have or what notes they will play .... but you have to have an instrument to play them. To play one of the transmitters, you have to have an instance of a class.

    In Java, Classes are Insturments.

    You would declare a class, then use the methods of that class. You are in for a shock when you see what is actually involved. If I may suggest, someone has very likely made a pre-compiled library or other tool which does not only PASCAL to midi conversion but as will dozens of other things.

    Read Instrument (Java Platform SE 6) and Sequence (Java Platform SE 6)

    You will likely need to find a package that somebody has built to do the conversion you want to do.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

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

    Lightbulb mercy

    I have a rule, no mercy from the cruel. Special case because you are trying:

    Try this -> pascal conversion to midi
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

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

    Default

    Oh help me Jesus I accidentally fall in the hands of high priests of system programming… I gratefully accept thou help and be your humble student and shell read and read and read all codes and suggestions.....
    And hopefully, finally find my sincerely desired solution of midi out in java

    Thanks
    Your humble servant

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

    Default

    Take a look at this site. This is link into the middle of it, I can't find the starting place.

    http://http://java.sun.com/javase/te...mentation.html

    Seems like I downloaded something from this site a week or so ago.
    I was going to add audio to a slideshow program I wrote years ago.

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

    Default

    Thanks norm
    the link concerns audio but not midi (as far as I understand)
    -what is a socket?
    -I know what network sockets are
    -midi is not an audio signal (directly)
    (The pascal application actual presents realtime editing of an old fashioned freq modulation synthesizer and the midi bytes provide the numbers of that process. just some more info)
    I will start trying things out beginning with the MidiDevice interfase ad the MidiMessage class.... I´ll keep you informed

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

    Smile graceful retreat accepted.

    Quote Originally Posted by willemjav View Post
    ...And hopefully, finally find my sincerely desired solution of midi out in java
    Don't worry, by which we intend to say do not lose any sleep over it. Norm and I know this ground well and I would not have done it unless I had Norm on short leash. Please delete our pm exchange.

    This is routine for systems programmers.

    Norm, here's the data frames:
    Java Code:
    /* *  01 = 8-bit G.711 µ-law
     *  02 = 8-bit linear PCM
     *  03 = 16-bit linear PCM
     *  04 = 24-bit linear PCM
     *  05 = 32-bit linear PCM
     *  06 = 32-bit IEEE floating point
     *  07 = 64-bit IEEE floating point
     *  08 = Fragmented sample data
     *  09 = DSP program (digital signal processor )
     *  10 = 8  - bit fixed point
     *  11 = 16 - bit fixed point
     *  12 = 24 - bit fixed point
     *  13 = 32-bit fixed point
     *  18 = 16-bit linear with emphasis
     *  19 = 16-bit linear compressed
     *  20 = 16-bit linear with emphasis and compression
     *  21 = Music kit DSP commands
     *  23 = 4-bit ISDN u-law compressed using the ITU-T G.721 ADPCM voice data encoding scheme
     *  24 = ITU-T G.722 ADPCM
     *  25 = ITU-T G.723 3-bit ADPCM 26 = ITU-T G.723 5-bit ADPCM
     *  27 = 8-bit G.711 A-law
     */
    May be historic or hysterical.

    ( Norm knows what I intend by that term, simplified version is caveat emptor )
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

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

    Default

    Package javax.sound.midi
    Provides interfaces and classes for I/O, sequencing, and synthesis of MIDI (Musical Instrument Digital Interface) data.
    javax.sound.midi
    Interface Synthesizer

    All Superinterfaces:
    MidiDevice

    public interface Synthesizer
    extends MidiDevice

    A Synthesizer generates sound. This usually happens when one of the Synthesizer's MidiChannel objects receives a noteOn message, either directly or via the Synthesizer object. Many Synthesizers support Receivers, through which MIDI events can be delivered to the Synthesizer. In such cases, the Synthesizer typically responds by sending a corresponding message to the appropriate MidiChannel, or by processing the event itself if the event isn't one of the MIDI channel messages.
    From pages in the JDK API doc

    Years ago I downloaded something called JavaSoundDemo from the Sun site. These demo programs create sounds. Google finds the download page.
    Java Sound API: Java Sound Demo
    Last edited by Norm; 07-23-2008 at 04:13 AM.

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

    Default midi bites

    This is great, after a good night of sleep, I notice data- bytes flying over me all over the place. But suddenly I got this feeling that we are going in the wrong direction (actually it is more an intuition).
    Sound is my field (programming not) so (for the change) let ME explain:
    It is true norm, synthesizers play sound and there two kinds of them (general speaking) virtual (“just” a piece of software)/ non virtual (a keyboard or a small, army-like, black box). The old Yamaha fbo1 is the black box one (with the old fashioned non-USB cable interface (do not know the right term here)).
    Usually users push the keys or send notes on/off to both synth-types and, most importantly, use the all-ready-stored presets of the synth sound banks.

    Norm, Nick that is exactly NOT what I do in that 20-year-old Pascal code, I am peddling stream upwards! Putting midi notes on and off happens only at the end of a long process in which I gradually, from the very bottom scratch, build up (by the protocols of FM, which I real use to know very well but now, twenty years later have forgotten in large). The next bit of code forms the hearth of this sound building process (yes already in java) and gives you an idea of all this:

    Java Code:
    public void syn1(String k, int kan, int w, int[][][] dt)  { // data for lfo
                                                    // not for operators 
                                                          
          p2=1;
          if (k.equalsIgnoreCase("alg")) {
            p1=12;
            p2=2;
            h_b=((8*dt[kan][12][1])+w)/16;
            l_b=((8*dt[kan][12][1])+w)% 16;
          } 
          else
          if (k.equalsIgnoreCase("fdb")) {
            p1=12;
            p2=1;
            h_b=(dt[kan][12][2]+(8*w))/ 16;
            l_b=(dt[kan][12][2]+(8*w))% 16;
          }
          else
          if (k.equalsIgnoreCase("mod")) {
            p1=9;
            p2=1;
            h_b=(dt[kan][9][2]+(128*w))/ 16;
            l_b=(dt[kan][9][2]+(128*w))% 16;
          }
          else
          if (k.equalsIgnoreCase("snc")) {
            p1=10;
            p2=1;
            h_b=(dt[kan][10][2]+(128*w))/ 16;
            l_b=(dt[kan][10][2]+(128*w))% 16;
          }
          else
          if (k.equalsIgnoreCase("wav")) {
            p1=14;
            h_b=(32*w)/ 16;
            l_b=(32*w)% 16;
          }
          else
          if (k.equalsIgnoreCase("spd")) {
            p1=8;
            h_b=w / 16;
            l_b=w % 16;
          }
          else
          if (k.equalsIgnoreCase("amd")) {
            p1=9;
            p2=2;
            h_b=((dt[kan][9][1]*128)+w)/ 16;
            l_b=((dt[kan][9][1]*128)+w)% 16;
          }
          else
          if (k.equalsIgnoreCase("pmd")) {
            p1=10;
            p2=2;
            h_b=((dt[kan][10][1]*128)+w)/ 16;
            l_b=((dt[kan][10][1]*128)+w)% 16;
          }
          else
          if (k.equalsIgnoreCase("ams")) {
            p1=13;
            p2=2;
            h_b=((dt[kan][13][1]*16)+w)/ 16;
            l_b=((dt[kan][13][1]*16)+w)% 16;
          }
          else
          if (k.equalsIgnoreCase("pms")) {
            p1=13;
            p2=1;
            h_b=(dt[kan][13][2]+(16*w))/ 16;
            l_b=(dt[kan][13][2]+(16*w))% 16;
          }
          else
          if (k.equalsIgnoreCase("trs")) {
            p1=15;
            h_b=w / 16;
            l_b=w % 16;
          }
          else
          if (k.equalsIgnoreCase("pm ")) {
            p1=58;
            p2=1;
            h_b=(dt[kan][58][2]+(128*w))/ 16;
            l_b=(dt[kan][58][2]+(128*w))% 16;
          } 
          else
          if (k.equalsIgnoreCase("prt")) {
            p1=58;
            p2=2;
            h_b=((128*dt[kan][58][1])+w)/ 16;
            l_b=((128*dt[kan][58][1])+w)% 16;
          }
          else
          if (k.equalsIgnoreCase("pd ")) {
            p1=59;
            p2=1;
            h_b=dt[kan][59][2]+(16*w)/ 16;
            l_b=dt[kan][59][2]+(16*w)% 16;
          }
          else
          if (k.equalsIgnoreCase("bnd")) {
            p1=59;
            p2=2;
            h_b=((16*dt[kan][59][1])+w)/ 16;
            l_b=((16*dt[kan][59][1])+w)% 16;
          }
          else
          if (k.equalsIgnoreCase("o1 ")) {
            p1=11;
            p2=1;
            h_b=((dt[kan][11][2]*32)+(dt[kan][11][3]*16)+(dt[kan][11][4]*8)+(w*64))/ 16;
            l_b=((dt[kan][11][2]*32)+(dt[kan][11][3]*16)+(dt[kan][11][4]*8)+(w*64))% 16;
          }
          else
    etc.
    Each component, soundwave´s attach hold decline etc, the operator functions etc are set individually (even by using something called “midi exclusives”, which are midi bytes that are not standard for each machine). This process is controlled by sending each sound building parameter out by single midi byte through –the already fames term—midi_out function (in Pascal). This fact is actually the very important main activity of the pascal program (note on/, what most people only use to do, triggers only at the very final part of the process the actual sound).


    THAT IS WHY I BELIEVE I DO NOT EVEN NEED TO GET INVOLVED WITH MOST MIDI JAVA CLASSES MENTIONED! What I am doing (on the soundlevel) is to basic because I do not need sound banks sequencers and all that.
    I sincerely hope that all this info might eventually change the direction where we going at present time (the persisting constantly falling of a drop of water will finally break a hard stone in parts…. Free after a Chinese saying)

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

    Smile running data

    Okay, where this goes after some work is the actual shipping of the carefully crafted work ( you are in one form or another, doing the artisan work in the code you posted ) is one or a few, ususally one, remarkably short, simple construct - ususally a loop - that actually sends the data. There will be a data issue somewhere because of it being a Mac.

    You can get your sleep on the idea that there will be others in the world who want to do the same thing. Today should be spent looking for those people, and as well likely several days.

    EG: Understanding and using Java MIDI audio
    Last edited by Nicholas Jordan; 07-23-2008 at 02:32 PM.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

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

    Default

    Nick, the data looping you talk about might be present in this small example (still in pascal):


    clkset(6,klok);
    midi_vel(1,8,127);
    repeat
    if ((mouse(2)<0) or (Bconstat(2)<0)) and (teller<1000) then boo5:=true;
    if ((mouse(2)<0) or (Bconstat(2)<0)) and (teller>1010) then boo6:=true;
    {kanaal 1}
    if clkpls>=i1*5 then
    begin
    i1:=i1+1;
    j1:=j1+(1*m1);
    if (j1>=127-l1) and (m1=1) then m1:=-1;
    if (j1<=117-l1) and (m1=-1) then m1:=1;
    midi_vel(1,1,j1);
    end;
    if ((mouse(2)<0) or (Bconstat(2)<0)) and (teller<1000) then boo5:=true;
    if ((mouse(2)<0) or (Bconstat(2)<0)) and (teller>1010) then boo6:=true;
    {kanaal 2}
    if clkpls>=1+i2*5 then
    begin
    etc.

    I believe the remember that clkpls reads the clock out, so there is where the synchronization happens? The atari mouse plug was connected with a simple food switch managed by the cello-player to trigger the sound events (I, know kind of primitive, but it worked in those days). The constant klok (Dutch word for clock is a constant of 237... no idea what that mend). midi_vel is a midiout for dynamics (sound loudness).

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

    Default AudioInputStream

    Java Code:
    import javax.sound.sampled.AudioInputStream;
    /**
    *
    * Preliminary. 
    * What are k, kan, w, dt ?
    *
    */
    public class willemjav extends AudioInputStream
    {
        // Constructs an audio input stream that has the requested 
        // format and length in sample frames, using audio data from the specified input stream.
        public willemjav(InputStream stream, AudioFormat format, long length)
        { 
            super(stream,format,length);
        }
        public void lowFrequencyOscillator(String k, int kan, int w, int[][][] dt)
        {
            ;// Processing omitted for discussion
        }
    }
    Last edited by Nicholas Jordan; 07-23-2008 at 03:02 PM.
    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 synchronization

    Quote Originally Posted by willemjav View Post
    ...clkpls reads the clock out, so there is where the synchronization happens? .... midi_vel is a midiout for dynamics (sound loudness)......
    We are gonna have a serious synchronization issue, the class above ( preliminary stubb ) will let us work in several formats. Code you posted does signal processing and data.out write in same place. Not a bad design, we have to split the generation of the data, it's smoothing and making into music,..... let me think for a moment but what I am sure we will be doing is pre-processing the data and stacking it up in a FIFO or a File then passing a signal ( oh, gosh, do not use signals as you will find it discussed in computer science ) passing a ,.....

    It gets sorta complicated but what we do is process the data stream so that it is musical, then, not before, pass the data. This can be a file write, there are probably three or four obvious ways,... try not to get too fancy. Use KISS ( engineering acronym )

    We need to examine processing the data as midi, then doing a data stream conversion to some format that does not load the system. One place to start is getting the PASCAL or LISP or any other programming language you know to write a data_stream to a file in such a manner that we can open it in Java and do our work. What we need to do is three separate efforts:
    1. Recover, capture or other wise make available from the previous work those musical efforts you have achieved previously avaliable to our Java code without any risk of our efforts affecting previous work.
    2. Experiment, develop, test, re-work no end until we get a good skill base going.
    3. Split out the playback from the development of the signal. Buffering is not at all hard to do. What we get into is no one has done the work previously, the prior engineering keeps us from taking artisitic freedom because the prior engineering did not utilize contemporary processor power.

    We have a real opporutinty here for world-class work.
    Last edited by Nicholas Jordan; 07-23-2008 at 03:11 PM.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

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

    Post bump

    Usually, we don't bump. Here I post so that I can see what you are saying.
    Java Code:
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.AudioInputStream;
    /**
    * Transport-control methods that start, stop, drain, and flush the audio from signal
    * processing. class willemjav can also report the current position, volume, and audio 
    * format of the media. This class allows our application program to write data.
    */
    public class willemjav extends AudioInputStream implements DataLine
    {
        // Constructs an audio input stream that has the requested 
        // format and length in sample frames, using audio data from the specified input stream.
        public willemjav(InputStream stream, AudioFormat format, long length)
        { 
            super(stream,format,length);
        }
        // Obtains the number of bytes of data currently available to the application for processing in the data line's internal buffer.
        int available(){}
        //  Drains the line by continuing data I/O until the data line's internal buffer has been emptied. 
        void drain(){}  
        // System engineering issue as to exactly who's buffer gets what done. KISS is to just set a position pointer to zero and figure it out later.
        void flush(){}
        // Obtains the maximum number of bytes of data that will fit in the data line's internal buffer. 
        int getBufferSize(){}
        // Obtains the current format (encoding, sample rate, number of channels, etc.) of the data line's audio data. 
        AudioFormat getFormat() {}
        // Obtains the current position in the audio data, in sample frames. 
        int getFramePosition(){}
        // Obtains the current volume level for the line.  
        float getLevel(){}
        // Obtains the current position in the audio data, in sample frames. 
        long getLongFramePosition(){}
        //  Obtains the current position in the audio data, in microseconds. 
        long getMicrosecondPosition(){}
        //  Indicates whether the line is engaging in active I/O (such as playback or capture). 
        boolean isActive(){}
        // Indicates whether the line is running.
        boolean isRunning(){}
        // Allows a line to engage in data I/O.
        void start(){}
        // Stop the world, I want to get another plan.
        void stop(){}
    }
    The reason your computer won't run or you got in trouble or any of a list of issues is that nobody bothered to do this work before. Those that have are busy in concert halls.

    The code here is only one of several areas that we shold keep separate. Probably next action is to stubb a Packet class. One custom designed to do our work. Buffer lengths can be variable. To do realtime data buffering in memory and gain some powerful signal processing that you have done in your prior work we need to chain the buffers somehow. Sorta multiply your data rate times packet size divided by some sane time constant such as a second and that gives us a buffer size.

    Chaining them together is intermediate level work. See the File reader Hardwired just put up for a beginner. That should form the preliminary basis of our data import, reading some data out of a system file and reformatting it so that it will fit in our design is neither advanced nor beyond the level of work your prior code shows.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

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

    Default

    This is getting too much into application code. I'm bailing out.

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

Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. DES algorithm (Read and Write bytes to file)
    By JoaoPe in forum Advanced Java
    Replies: 6
    Last Post: 07-29-2008, 03:46 PM
  2. Reading bytes from InputStream
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-25-2007, 07:51 PM
  3. how to know the number of bytes
    By gabriel in forum New To Java
    Replies: 2
    Last Post: 08-06-2007, 05:13 PM
  4. help with midi files
    By leonard in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 04:40 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
  •