Audio2face script maya json

Hello, i’ve got an issue, i try to use audio2face to create my animation but I want to use maya and the 46 blendshapes.
by following those tutorials,

BlendShape Generation in Omniverse Audio2Face - YouTube
I managed to export my character with blendshapes from audio2face to maya.

1

I also have my blendshape animation into audio2face that i’ve exported as a json file. Now, I just have to put this blendshape animation into my character in maya.
But the script used in the tutorial doesn’t work and I can’t figure out why.

if you have any idea, I’ll be grateful.

I’m sorry if my English is approximate

here’s the script

raise

import json

import maya.cmds as mc

with open (r’ F:\a2f\tst\aya1\a2f_bs_weights.json’, “r”) as f:
facs_data = json.loads(f.read())
facsNames = facs_data [“facsNames”]
numPoses = facs_data [“numPoses”]
numFrames = facs_data [“numFrames”]
weightMat = facs_data [“weightMat”]

bsnode = 'blendShape1'
for fr in range(numFrames) :
    for i in range(numPoses):
        mc.setKeyframe(bsnode+'.'+facsNames[i], v=weightMat[fr] [i], t=fr)

hi @celeber12 ,
I have a few questions:

  1. can you remove this line raise?
  2. Can you let us know what maya version you are using?
  3. Can you confirm the name of your blendshape node is `blendShape1’?
  4. There’s an empty space character before the F:\ in your path, can you try remove that?

Hope it helps :)

1 Like

firstly, thank you very much for your answer, this is my third topic and this is the third time that I have an answer quickly !

1/4 I have the same issue
unknown (12)

I’ve to admit, I’m really bad with python

3 i don’t think, if i understand, my blendshape’s names are
“browLowerL” “browLowerR”…, If you don’t speak about that then I’m sorry I don’t use Maya, this is one of my first try.
But, in the tutorial, the guy has the same blendshape. I’ve also tried to remove "bsnode+’.’’ but I still have an issue
:

image

I’m using Maya 2020, same that the tutorial.

I would also point out that I import my character in Maya as a .fbx,
I’ve exported from audio2face the usdskell that contain the blendshapes and from that, i’ve created a file .fbx that I’m using, I don’t import the .usd in Maya

Hi @celeber12, I see some python indentation/space faults in the code. maybe try copy-paste of this one?
You can also download the sample code from your localhost, if you’ve installed the nucleus server.
http://localhost:8080/omniverse://127.0.0.1/NVIDIA/Assets/Audio2Face/Samples/blendshape_solve/script/load_bs_weights_maya.py

import json
import maya.cmds as mc

with open (r'F:\a2f\tst\aya1\a2f_bs_weights.json', 'r') as f:
    facs_data = json.loads(f.read())
    facsNames = facs_data[“facsNames”]
    numPoses = facs_data[“numPoses”]
    numFrames = facs_data[“numFrames”]
    weightMat = facs_data[“weightMat”]

    bsnode = 'blendShape1'
    for fr in range(numFrames) :
        for i in range(numPoses):
            mc.setKeyframe(bsnode+'.'+facsNames[i], v=weightMat[fr][i], t=fr)
1 Like

OH
Awesome !
It works ! than you so much ! i made a mistake here :

with open (r’F:\a2f\tst\aya1\a2f_bs_weights.json’, ‘r’) as f:

I wrote “r” and not ‘r’…

than you all so much ! HAVE A GOOD DAY

Don’t mean to revive an old thread, but is there a tutorial for 3ds max using the Morpher from the modifier list rather than importing the USB geometry cache file format?

1 Like

@cgjd18, no we dont’ have 3ds max one at the moment unfortunately. But the approach should be the similar to the maya one, just use the morph instead of blendshape and 3ds max script instead of maya script.