[jmsl] Jmsl to Xml/Midi and Xml/Midi to Jmsl?
jmsl at music.columbia.edu
jmsl at music.columbia.edu
Sat Apr 11 10:32:54 EDT 2009
ugh, I see the mailer unwrapped the 4-numbers-per-line listing of
MusicShape data. This example at the end of message looks very confusing
now. Those numbers should be four per line.
Sorry
Nick
jmsl at music.columbia.edu wrote:
> Hi Chi
>
> Here's what I would do: I'd develop my own simple text-based shorthand
> for encoding this to a text stream, and write it / read it to/from a
> text file for testing. Not sure XML is really needed for this since it
> is so straightforward, but I'll use XML-like tags.
> Mark the beginning of pc with <parallelcollection>
> Mark the end with </parallelcollection>
> Mark the beginning of sc with <sequentialcollection>
> Mark the end with </sequentialcollection>
> Everything encountered between the <collection></collection> tags gets
> added to that collection instance
> Mark the beginning of ms with <musicshape>
> Mark the end with </musicshape>
>
> Examine the following to save/load the musicshape data, maybe they
> will be of use:
> MusicShape.save():
> /**
> * Save a MusicShape to a file
> *
> * PrintWriter out = new PrintWriter(new BufferedWriter(new
> FileWriter("foo.out")));
> *
> * First line is number of dimensions, followed by dimension names,
> one per line, followed by
> * data, one element per line *
> */
>
>
> MusicShape.load():
> /**
> * BufferedReader in = new BufferedReader(new FileReader("foo.in"));
> *
> * Replace data with data loaded from a file. Also reads dimension
> names from file.
> *
> */
>
>
> So a simple example of a text file that has a Sequential Collection
> containing one ParallelCollection containing two MusicShapes might
> look like this (assumes your MusicShapes have 4 dimensions and you
> called ms.useStandardDimensionNameSpace() )
>
> <sequentialcollection>
> <parallelcollection>
> <musicshape>
> 4
> duration
> pitch
> amplitude
> hold
> 0 1.0 68.0 0.3320770263671875 2.0 1 0.25 68.0
> 0.3054046630859375 2.0 2 1.0 66.0 0.1468963623046875
> 2.0 3 0.0 64.0 0.6534271240234375 2.0 4 0.25
> 66.0 0.8718719482421875 0.5 5 0.0 68.0
> 0.0991058349609375 1.0 6 0.25 65.0 0.8820037841796875
> 2.0 7 0.0 68.0 0.0174407958984375 2.0 8 0.0
> 66.0 0.5522918701171875 0.5 9 0.75 63.0
> 0.7834320068359375 1.0 10 0.25 64.0
> 0.2577362060546875 1.5 11 0.5 62.0 0.7720794677734375
> 1.5 12 0.0 64.0 0.3733367919921875 2.0 13 0.5
> 62.0 0.3583831787109375 2.0 14 1.0 64.0
> 0.2740936279296875 1.5 15 0.5 66.0 0.9173431396484375
> 0.5 16 0.25 66.0 0.3350067138671875 2.5 </musicshape>
> <musicshape>
> 4
> duration
> pitch
> amplitude
> hold
> 0 1.0 63.0 0.384246826171875 2.5 1 0.25 65.0
> 0.930084228515625 1.0 2 0.75 64.0 0.855804443359375
> 1.5 3 0.75 63.0 0.020782470703125 1.5 4 0.25
> 62.0 0.534393310546875 1.0 5 1.0 62.0
> 0.756011962890625 2.0 6 0.75 61.0 0.295013427734375
> 2.5 7 0.75 61.0 0.010772705078125 1.0 8 0.75
> 61.0 0.012664794921875 2.0 9 0.0 58.0
> 0.660064697265625 2.5 10 0.25 55.0 0.562347412109375
> 2.5 11 1.0 53.0 0.578887939453125 1.5 12 0.0
> 53.0 0.819061279296875 0.5 13 0.0 53.0
> 0.642242431640625 2.0 14 0.25 52.0 0.657806396484375
> 1.5 15 0.25 50.0 0.725128173828125 2.5 16 0.5
> 53.0 0.953582763671875 1.5 </musicshape>
> </parallelcollection>
> </sequentialcollection>
>
>
> Thanks
> Nick Didkovsky
>
> jmsl at music.columbia.edu wrote:
>> Hi,
>>
>> I'm pretty new at programming, but I'm trying to write an applet that
>> people can compose some music and save it on the web to share.
>> I need to way to pass a sequential collection to php and import back
>> from url. The way I organized the collection is:
>> 1. ParallelCollections (pc) contains one measure of MusicShapes (ms)
>> for different instruments.
>> 2. SequentialCollection (sc) contains all the pcs above.
>> I tried to convert the entire sc into xml with XStream, but since
>> jmsl is third party library, it throws a security error.
>> My alternative is midi which might be simpler. I've checked out
>> MidiLoggerNonRealTimeTest, but is there way to feed the entire
>> collection into MidiLogger? MidiLoggerNonRealTimeTest seem to feed
>> one midi message at a time to the logger. If I can export the entire
>> sc into midi, I could just let users save the midi file and share the
>> midi file on the web.
>> Thanks for all your help.
>>
>> Chi
>> _______________________________________________
>> jmsl mailing list
>> jmsl at music.columbia.edu
>> http://music.columbia.edu/mailman/listinfo/jmsl
>>
> _______________________________________________
> jmsl mailing list
> jmsl at music.columbia.edu
> http://music.columbia.edu/mailman/listinfo/jmsl
More information about the jmsl
mailing list