Results 21 to 40 of 78
Thread: midi bytes
- 07-21-2008, 10:40 PM #21
- 07-22-2008, 01:15 AM #22
Willem Dragstra Web Site
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
- 07-22-2008, 09:01 AM #23
Senior Member
- Join Date
- Dec 2007
- Location
- Spain
- Posts
- 573
- Rep Power
- 6
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.
- 07-22-2008, 09:20 AM #24
Senior Member
- Join Date
- Dec 2007
- Location
- Spain
- Posts
- 573
- Rep Power
- 6
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
- 07-22-2008, 04:06 PM #25
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.
- 07-22-2008, 09:09 PM #26
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
- 07-22-2008, 10:09 PM #27
mercy
I have a rule, no mercy from the cruel. Special case because you are trying:
Try this -> pascal conversion to midiIntroduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 07-22-2008, 11:07 PM #28
Senior Member
- Join Date
- Dec 2007
- Location
- Spain
- Posts
- 573
- Rep Power
- 6
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
- 07-22-2008, 11:57 PM #29
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.
- 07-23-2008, 01:19 AM #30
Senior Member
- Join Date
- Dec 2007
- Location
- Spain
- Posts
- 573
- Rep Power
- 6
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
- 07-23-2008, 03:10 AM #31
graceful retreat accepted.
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:
May be historic or hysterical.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 */
( 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
- 07-23-2008, 03:37 AM #32
Package javax.sound.midi
Provides interfaces and classes for I/O, sequencing, and synthesis of MIDI (Musical Instrument Digital Interface) data.From pages in the JDK API docjavax.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.
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 DemoLast edited by Norm; 07-23-2008 at 04:13 AM.
- 07-23-2008, 09:59 AM #33
Senior Member
- Join Date
- Dec 2007
- Location
- Spain
- Posts
- 573
- Rep Power
- 6
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:
etc.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
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)
- 07-23-2008, 02:07 PM #34
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 audioLast 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
- 07-23-2008, 02:39 PM #35
Senior Member
- Join Date
- Dec 2007
- Location
- Spain
- Posts
- 573
- Rep Power
- 6
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).
- 07-23-2008, 02:43 PM #36
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
- 07-23-2008, 02:51 PM #37
synchronization
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
- 07-23-2008, 03:39 PM #38
bump
Usually, we don't bump. Here I post so that I can see what you are saying.
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.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 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
- 07-23-2008, 03:52 PM #39
This is getting too much into application code. I'm bailing out.
- 07-24-2008, 12:01 AM #40
Senior Member
- Join Date
- Dec 2007
- Location
- Spain
- Posts
- 573
- Rep Power
- 6
Similar Threads
-
DES algorithm (Read and Write bytes to file)
By JoaoPe in forum Advanced JavaReplies: 6Last Post: 07-29-2008, 03:46 PM -
Reading bytes from InputStream
By Java Tip in forum Java TipReplies: 0Last Post: 11-25-2007, 07:51 PM -
how to know the number of bytes
By gabriel in forum New To JavaReplies: 2Last Post: 08-06-2007, 05:13 PM -
help with midi files
By leonard in forum New To JavaReplies: 1Last Post: 08-06-2007, 04:40 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks