First mcjMidiLoad Beta Available - Midi File loader script for Daz Studio

mCasualmCasual Posts: 4,607
edited April 2015 in Freebies

Released here
https://sites.google.com/site/mcasualsdazscripts5/mcjmidikit

Now with a manual and a little demonstration video

since ... a long time ago ... there's a PC ( Mac too? ) utility to convert a midi file into a text file

http://sourceforge.net/projects/mf2t-win32/

with my ( upcoming script ) the content of the midi file will be loaded
into the Daz Studio scene as a node named "midi"
the midi node will have up to 16 child nodes, which corresponds to the midi channels used

in the case of channel 10, the drum-kit node,
each drum used by the midi file,
will have a parameter slider ( int property )
that slider will be named according to the specific drum

in the case of musical instruments
each note used by the midi file
will have a parameter slider ( int property )
that slider will be named according to the octave/note : ex O4C#

in the 1st example below, the midi file contained only a drum loop

so the midi node has only 1 channel-node for channel 10

and the channel node has 4 drum-sliders, because the drum loop involves only 4 drums

----------

each drum will get a series of keyframes, corresponding to their midi events

so, you will now have something to guide your animation !

-------

i'll probably have something to automate some of the animation

for example, the script could animate drum pedals and piano keys

or highlight something

drum.jpg
1000 x 800 - 231K
scinn.jpg
700 x 300 - 23K
Post edited by mCasual on
«13456710

Comments

  • mCasualmCasual Posts: 4,607
    edited December 1969

    and the synchro works perfectly if the .avi file from Daz Studio is forced to the exact frame rate ( 30.0 fps )

    xikipa.gif
    480 x 270 - 912K
  • mCasualmCasual Posts: 4,607
    edited February 2015

    tomorrow Amy ( Aiko3 ) will play that drum set

    ( which i may post on my site someday )

    incidentally i don't think i made sticks back in ........ 2007 when i modeled the set


    ( just a hardware render ... one can make it look way more swell )

    mydrumz.jpg
    1280 x 720 - 253K
    Post edited by mCasual on
  • RuphussRuphuss Posts: 2,631
    edited December 1969

    great idea casual
    waiting for Amy to give me the groove

  • RuphussRuphuss Posts: 2,631
    edited December 1969

    the idea of loading midi footsteps to the feet nodes comes to my mind

    casual you think you could write a script like lageffect which I use often and like very much
    with a morph as follower
    maybe smile morph follows head node
    or breast up and down follows chest node

  • KeironKeiron Posts: 413
    edited February 2015

    You are a star !

    Can't wait to try it out

    Thank you

    Just out of interest I found that when I rendered the AVI using Daz Studio I met a few restrictions

    On a 32 bit Operating System the Daz 32 Bit version with 16 Gig of Memory, the AVI was restricted to 2 Gig
    On a 64 bit Operating System the Daz 64 Bit version with 16 Gig of Memory, the AVI was restricted to 4 Gig
    if the file produced "needs" to be bigger it may not play.

    To get over this I did the following in Daz Studio I outputed each frame as a jpg picture instead of an AVI, then used Virtual Dub 64 bit version to create the AVI. available from here http://virtualdub.sourceforge.net/.
    After you have loaded the single frames In Virtual Dub " remember to set the frames to 30" as it's default is 10

    I used the free Lagarith Lossless Video Codec available from here http://lags.leetcode.net/codec.html

    On a 5 min video Daz Studio made 6500 frames at 1920 x 1080. Virtual Dub made a file size of around 45 Gig uncompressed and around 17 Gig compressed

    Looking forward with great interest

    Kindest wishes

    Keiron

    Post edited by Keiron on
  • WendyLuvsCatzWendyLuvsCatz Posts: 38,219
    edited December 1969

    yes looking forward to this too

  • KeironKeiron Posts: 413
    edited December 1969

    Hi

    I've made a MIDI test file for a Piano in format 0 and 1 and it's wav file
    Would that be of any help?

    Keiron

  • mCasualmCasual Posts: 4,607
    edited December 1969

    brand new drummer seat !

    note that drumming will most probably involve the use of mcjAutoLimb 2014

    http://www.daz3d.com/forums/discussion/43130/

    setup.jpg
    1280 x 720 - 446K
  • mCasualmCasual Posts: 4,607
    edited December 1969

    keiron said:
    Hi

    I've made a MIDI test file for a Piano in format 0 and 1 and it's wav file
    Would that be of any help?

    Keiron


    i'll use the midi drum loop to figure out the tools to add to the midi importer

    the midi importer part already works,

    what's next is ... ways to make actors ( limbs or instruments ) move in sync

    i wont automate the whole animation process, i just want to give tools

    i wonder if there's a free poser/daz prop keyboard

    what's "piano format 0 and 1" ? midi instruments 0 and 1 ?

  • KeironKeiron Posts: 413
    edited February 2015

    Hi

    Standard MIDI Files come in two basic varieties: a Type 1 file, and a Type 0 file (a Type 2 was also specified originally but never really caught on. In a Type 1 file individual parts are saved on different tracks within the sequence. In a Type 0 file everything is merged onto a single track.

    Using type 1 would allow different instruments to be allocated to each MIDI channel
    In a Recording Program you could easily split each instrument onto its own Track

    Post edited by Keiron on
  • mCasualmCasual Posts: 4,607
    edited December 1969

    keiron said:
    Hi

    Standard MIDI Files come in two basic varieties: a Type 1 file, and a Type 0 file (a Type 2 was also specified originally but never really caught on. In a Type 1 file individual parts are saved on different tracks within the sequence. In a Type 0 file everything is merged onto a single track.

    Using type 1 would allow different instruments to be allocated to each MIDI channel
    In a Recording Program you could easily split each instrument onto its own Track

    it should work if the mf2t.exe ( very old midi-to-txt converter ) accepts it

    my script reads that txt file and only reads the

    tempo value which is needed to interpret the time stamps
    the program-change events which assign instruments to channels
    the note (On) events

    the other midi messages are ignored

    eventually i may include them

  • mCasualmCasual Posts: 4,607
    edited February 2015

    well i spent some time modeling sit-position shorts for Amy since they initially suffered from poke-through

    drumm.jpg
    1920 x 1080 - 1M
    drumshorts.jpg
    1920 x 1080 - 983K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited February 2015

    arrrrrrrrrgh daz studio 3 crashed on me after saving an avi

    about an hour of finnicking lost ( oops maybe more than 1 hour !!!! )

    though i'll probably recover in 20 minutes

    see in the gif below

    i had the drum stick holding pose and drum placement

    ----
    i made Amy's foot follow the pedal movement by

    1 - creating a null node
    2 - using mcjParent to position the node exactly at the location of Amy's right-toes node
    3 - parenting the null node to the pedal
    4 - using mcjAutoLimb2014 and telling it make Amy's left toes node follow the null node

    in general i think it will go like this

    you'll specify a pose or rotation or a translation corresponding to no-note-played
    this pose can also be absent, so no animation will be addedwhen no note is played

    and you'll specify a pose or rotation or a translation corresponding to a note-played ( drum stick hit in the case of a drum )

    then you'll have a script that can build your animation either note by note or for the whole song

    in the case of the bass drum pedal, it could be done in one shot

    for the arms it can be more complicated since the

    drum215.jpg
    1920 x 1080 - 823K
    drummin.gif
    500 x 281 - 300K
    Post edited by mCasual on
  • KeironKeiron Posts: 413
    edited December 1969

    Hi Casual Looking Good well done

    I downloaded MF2t , I see it's a DOS Prompt, so users may find this a problem to use

    Usage: mf2t [-mnbtv] [-f n] [midifile [textfile]]

    translate midifile to textfile.

    I wasn't sure how to use this either, I assume you add the name of the midifile and give the textfile a name
    Could I ask you a favor, for an example of how to use this use, and where the MIDI file should be put etc

    Re Daz Crash

    I've had this problem,in my case it was not enough Memory, so i've now got 24 Gig
    I've even got close to using all this on some renders

    Daz Studio also crashed on the 32 bit version as the video Avi render hit the 2 Gig limit

    It also crashed on the 64 bit version as the video Avi render hit the 4 Gig limit

    So I exported all the frames as single frames jpgs and rebuilt it using the free Virtual DUB , this worked OK

    To save time I also scaled down the number of lights I was using and used open GL for a render as the software one takes a long time

  • mCasualmCasual Posts: 4,607
    edited December 1969

    keiron said:
    Hi Casual Looking Good well done

    I downloaded MF2t , I see it's a DOS Prompt, so users may find this a problem to use

    Usage: mf2t [-mnbtv] [-f n] [midifile [textfile]]

    translate midifile to textfile.

    I wasn't sure how to use this either, I assume you add the name of the midifile and give the textfile a name
    Could I ask you a favor, for an example of how to use this use, and where the MIDI file should be put etc

    the daz script will include a button that lets you specify where the mf2t.exe app is located
    this will only need to be done once

    then when you click the script's "Load midi" button, you will be able to specify which midi file you want to load

    the daz script will run mf2t.exe

    i only use the default settings

    so my command line will look like

    "C:\utilities\mf2t.exe" "C:\midifiles\jingle bells.mid"  "C:\midifiles\jingle bells.mid.txt"

    after mf2t has done its work, the daz script will load "C:\midifiles\jingle bells.mid.txt"

    this creates a node named midi, containing up to 16 channel nodes

    then there will be functions to transfer channel notes into animations

  • mCasualmCasual Posts: 4,607
    edited February 2015

    ideally one could modulate the hammering action proportionally to the volume of the midi note
    attack, decay, sustain, release?

    in this drum stick animation
    there's 3 poses

    rest position,
    anticipation position
    hit position
    return to the rest position

    ( still trying to figure this )

    in the end, the important point is the hit position

    the preparation and the recoil motions can be interpolated

    beatit2.gif
    960 x 391 - 279K
    beatit.gif
    400 x 300 - 352K
    Post edited by mCasual on
  • KeironKeiron Posts: 413
    edited December 1969

    Hi Casual

    I think your well on the right track

    Not forgetting, The MIDI info may also have after touch before the release
    Could use that for say a drum stick bounce - occilation before returning

    Thank you for all of you hard work it's much appreciated

  • mCasualmCasual Posts: 4,607
    edited March 2015

    keiron said:
    Hi Casual

    I think your well on the right track

    Not forgetting, The MIDI info may also have after touch before the release
    Could use that for say a drum stick bounce - occilation before returning

    Thank you for all of you hard work it's much appreciated

    there will be a standalone script to store on disk some motions

    for example, you can store the drum-hit motion

    notice that the shoulder, forearm and hand nodes are selected
    so only the poses of those limbs will be stored

    in this example it starts 5 frames before the Note-On event
    that's a 5 frames animation
    for the first 2 frame she pulls back/up the stick
    then the next 3 frames she brings it down
    the filename for this would be "Aiko3 Left Arm HiHat Attack"

    then you can store the drum release motion
    in my case it starts at frame 15 and ends 10 frames later
    it starts with the stick on the drum and ends with the stick pulled back/up
    the filename for this would be "Aiko3 Left Arm HiHat Release"

    there will possibly be an option to pre-program what happens during the note-sustain phase

    there will possibly be an option to store morphs
    ( like in the hyperactive video )
    https://www.youtube.com/watch?v=8IvHNzJhMA8
    or materials ( for lasers and color organs )

    once the motions are stored on disk

    there will be a script to connect the midi events to those stored animations

    -------

    i'm trying to keep this universal, who knows maybe instead of midi data it will be kinect, Wiimote or gamepad events

    storeme.jpg
    871 x 642 - 254K
    Post edited by mCasual on
  • atticanneatticanne Posts: 3,009
    edited December 1969

    This is very exciting. I've added it to my "want to do" list.

  • mCasualmCasual Posts: 4,607
    edited March 2015

    AtticAnne said:
    This is very exciting. I've added it to my "want to do" list.

    hoping to post at least a first version today

    if it's good enough to create an Amy drumming animation

    placeme.jpg
    1920 x 1080 - 703K
    blue.jpg
    1920 x 1080 - 967K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited December 1969

    i wont release the midi-to-daz kit today

    but, it's in a good enough state that i'm able to produce a demonstration video today !

    and this marks the return of Misstick! who will share the hihat drumming with Amy

    misstick.jpg
    1280 x 720 - 367K
  • mCasualmCasual Posts: 4,607
    edited December 1969

    YAY !!!!!!!!!!!!!1


    Demonstration video

    https://www.youtube.com/watch?v=DAYlJYktNTk


    the midi to DS kit will come out this week i'm quite very sure but then again


    note that unless there's a mac version of mf2t.exe this will only work on a PC

    but but but, if you run the midi-to-Text converter on a PC, or have a friend do it for you

    then you could do all the Daz Studio animation on your Mac

    mcj0690.jpg
    1280 x 720 - 435K
  • KeironKeiron Posts: 413
    edited December 1969

    Looking cool" Well done

    Love the Vids

    Great looking Drummer

    Now what about her friend playing keyboard !!

    Just a thought, I've used Animate2 to create blocks for specific animation sequencies
    in my case moving the hands left and right on the Keyboard and others for the finger movements

    The problem I found was I had no Midi Timing reference on the Animate 2 time line or on a normal time line so there was a lot of guess work

    Keep up the great work

  • mCasualmCasual Posts: 4,607
    edited March 2015

    keiron said:
    Looking cool" Well done

    Love the Vids

    Great looking Drummer

    Now what about her friend playing keyboard !!

    Just a thought, I've used Animate2 to create blocks for specific animation sequencies
    in my case moving the hands left and right on the Keyboard and others for the finger movements

    The problem I found was I had no Midi Timing reference on the Animate 2 time line or on a normal time line so there was a lot of guess work

    Keep up the great work

    there will be the not-too-much-work possibility of automating the keyboard keys-down movements ( like a mechanical piano )

    visually you'll be able to see the keys being played, so you can position the hand in the vicinity of those keys

    a few frames ( ex: 3 ) before the key being fully depressed, then animating the 3-frames of the finger going down

    ( someday i may make a full pianist animator but i think that someday is not soon )

    ...

    well actually the finger-bend movement could be fully automated with the upcoming scripts

    but the hand position and side-side finger movements would need to be adjusted per chord/note

    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited December 1969

    over here

    https://poserdazfreebies.orain.org/wiki/Musical_Resources/Keyboards

    there's poser/daz compatible keyboards

    among them are even MIDI-animatable ones, when used in the context of Poser ( python scripts )


    personally i reworked Zippo's keyboard

    http://lab108.x0.com/lab108/inst.html

    i made each key, button, slider and wheel

    a separate prop part

    with its individual material

    eventually, with lab108's permission, that animatable version of his/her keyboard will be made available

    kb.jpg
    1920 x 1080 - 597K
  • KeironKeiron Posts: 413
    edited December 1969

    Thank you for all those links much appreciated

  • mCasualmCasual Posts: 4,607
    edited December 1969

    i'll probably build a 1 minute animation

    of "My Sharona"

    Amy on drums,
    Misstick on keyboard for part of the melody i guess

    and the rest "played" by visual (light?) effects or robots or something

    if the scripts can help build this animation, they'll be good enough for the release

    for daz scripters
    here's a little script snippet that lists the instruments in a TXT file produced by mf2t.exe

     var file = new DzFile( "I:\\aoa\\midi\\pop\\msharona.txt" );
     file.open( file.ReadOnly );
     while( ! file.eof() )
     {
      var str = file.readLine();
      if( str.indexOf( "PrCh" ) >= 0 )
      {
       fields = str.split( " " )
       if( fields[2] != "ch=10" )
       {
        p = fields[3].replace( "p=", "" );
        p = p.replace( "\n", "" );
        p = p.replace( "\r", "" );
        instr.pushIfNotExists( p )
       }
      } 
     }
     file.close();
     debug( filenames, instr );
    
  • mCasualmCasual Posts: 4,607
    edited March 2015

    well evidently it will be more complicated than expected

    case in point .... handling the drums


    -----

    we need a sort of dope-sheet or track sheet

    there.jpg
    1280 x 720 - 191K
    ohmy.jpg
    1916 x 798 - 558K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited March 2015

    here you see i selected only the cymbals

    and the "links" list shows only midi events for them

    this way we can quickly see that the two cymbals are never used at the same exact time

    so we could assign them to the same hand/stick animation

    -----

    fig. 3 : the channels get labeled with the first instrument ( program change ) encountered

    but each channel also has a "program" property
    so if there's more than one Program-Change for this channel,
    it is part of the midi-channel timeline

    channames.jpg
    444 x 260 - 52K
    setitup.jpg
    1920 x 1080 - 507K
    ymbalic.jpg
    1150 x 658 - 285K
    Post edited by mCasual on
  • KeironKeiron Posts: 413
    edited December 1969

    Hi Casual

    Hows it going

    Looking cool so far

    I found a set of MIDI Piano's from Content Paradise MIDI Bundle, that allows you to create a pose for animation
    but alas for Daz Studio it didn't work very well

    It comes with a program that you add a MIDI file, It then generate the Pose. It imported MIDI type 1 but wouldn't accept MIDI type 0

    You then add a MIDI piano Prop to the Daz Studio Scene and then import the created Pose
    ,you end up with frames for the song on the time line

    Each Piano Key has an object and they are also linked in Octaves
    So you can animate each key

    The piano did play, but The Keys that were animated were a bit dodgy, some stayed down, so it was nearly imposible to use
    I believe it's was designed mainly for Poser.

    Wishing you well with your project

    Kind wishes

    Keiron

Sign In or Register to comment.