Audio2Face always exports the rotated mesh to me

I want to animate a character that I have in 3DS Max, I would like to be able to export it to Max with the animated blandeshapes (Morphs) but I can’t find the possibility, so I have opted for point cache, I have seen this tutorial https://www.youtube.com/watch?v=naToXY0RyFI and everything works fine for me except that when importing it In Max or any Software it is imported rotated, and when you add the skin the animation fails because it goes in another direction.
I have done several tests from various software and I always care about the mesh rotated forward and I can’t find any export options to prevent this from happening.
Can anyone help me? And can anyone tell me if there is any way to have animation with animated morphs in 3DS Max?. And if it is not possible, can I somehow edit some of the blendshapes that it creates for me? Some of them are terrible for me and I would like to modify them manually.
Thank you so much

To bring morphs from Audio2Face to 3dsMax, have you tried the 3DS Max Omniverse Connector?

To apply the morph animation, you need to write a script in 3dsMax that uses the exported .json file from Audio2Face and applies morph weights to your character.

And how is that script made? Is there a tutorial that shows the steps to follow to do it? In general, I find the system very cumbersome and I am not a programmer.

Not sure how in 3dsMax, but it looks like this in Maya:

import maya.cmds as mc
import json

with open(r'C:\tmp\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)

This could be totally wrong, but I asked ChatGPT to convert this script to 3dsMax, you’d probably need to change the blendShape1 to your morph name and also need to update the json file path. But it’s worth giving it a try:

import json
from MaxPlus import Core
from MaxPlus import Animatable
from MaxPlus import TimeValue

# Define your file path
file_path = r'C:\tmp\a2f_bs_weights.json'

# Open the JSON file and load data
with open(file_path, "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 = Core.GetINodeByName('blendShape1')
    for fr in range(numFrames):
        for i in range(numPoses):
            # Set keyframes
            facs_controller = bsNode.GetControlByIndex(i)
            facs_controller.SetValue(TimeValue(fr), weightMat[fr][i])
            facs_controller.SetKey(TimeValue(fr))

But what should I do with that code? Where do I put it? Couldn’t an FBX be exported with the blendshapes already animated like with the rest of the software?

Do you know how to run MaxScript? I found this video on how to use it if you don’t know already: 3DS Max - MaxScript - How to Install A MacroScript (youtube.com)

If so here’s the maxScript version:

-- Define your file path
file_path = @"C:\tmp\a2f_bs_weights.json"

-- Open the JSON file and load data
f = openFile file_path
json_data = execute ("(jsonReader.readFile \"" + file_path + "\")")

-- Extract data from JSON
facsNames = json_data["facsNames"]
numPoses = json_data["numPoses"]
numFrames = json_data["numFrames"]
weightMat = json_data["weightMat"]

-- Get the blend shape node
bsNode = getNodeByName "blendShape1"

-- Loop through frames and poses to set keyframes
for fr = 1 to numFrames do
(
    for i = 1 to numPoses do
    (
        -- Set keyframe value
        setValueAtTime fr bsNode[#(facsNames[i])] weightMat[fr][i]
    )
)