substyle
07-11-2002, 08:34 PM
Hi there,
First I want to say that this is a great Forum !
Yes, i havev leared a lot, just form reading, but now the time has come that i´ve got to ask a question ;-)
The problem I have is, that i want to link an wave-audio-file as input for the extrusion of faces at various geometric bodies, like e.g. spheres, cubes ect.
So i started in Mel to developp a script, to draw the mathematic normals of all selected faces as splines.
This way i thought to have found the best way to extrude the faces along the created splines.
This is what we came up with:
//********************** **************
global proc createFaceNormalSpline()
{
string $selection[] = `ls -sl`;
string $faceSelection[];
float $normal[];
float $startPoint[];
float $endPoint[];
string $face;
string $sel;
float $mult = 10;
for($sel in $selection)
{
select -r $sel;
ConvertSelectionToFaces ;
$faceSelection = `ls -sl -fl`;
waitCursor -st 1;
for($face in $faceSelection)
{
select -r $face;
$normal = `getNormalArray`;
$startPoint = `getFaceCenter`;
$endPoint[0] = $startPoint[0] + $normal[0] * $mult;
$endPoint[1] = $startPoint[1] + $normal[1] * $mult;
$endPoint[2] = $startPoint[2] + $normal[2] * $mult;
curve -d 1 -p $startPoint[0] $startPoint[1] $startPoint[2]
-p $endPoint[0] $endPoint[1] $endPoint[2]
-k 0 -k 1 ;
}
}
waitCursor -st 0;
}
global proc float [] getFaceCenter()
{
ConvertSelectionToVertices;
string $selection[] = `ls -sl -fl`;
string $sel;
float $center[];
float $point[];
int $i;
for($sel in $selection)
{
$point = `xform -ws -q -t $sel`;
$center[0] += $point[0];
$center[1] += $point[1];
$center[2] += $point[2];
$i++;
}
$center[0] = $center[0]/$i;
$center[1] = $center[1]/$i;
$center[2] = $center[2]/$i;
return $center;
}
global proc float [] getNormalArray()
{
string $allNormals[] = `polyInfo -fn`;
string $oneNormal;
string $tokResult[];
float $normalArray[];
clear $normalArray;
int $i = 0;
for($oneNormal in $allNormals)
{
tokenize $oneNormal "FACE_NORMAL :" $tokResult;
$normalArray[$i] = $tokResult[1];
$normalArray[$i+1] = $tokResult[2];
$normalArray[$i+2] = $tokResult[3];
$i+=3;
}
return $normalArray;
}
//********************* ***************
I think this works very well.
But now the problems came up.
How may i extract the information of the amplitude from a wave file ?? Is there a way to do this in Mel ??
Must be one, sure ...
I found a method called FFT (Fast Fourier Transform, which is the one, most audio players use e.g. Winamp ect.)
But to use it, i´d have to write a standalone programm in c++ (cause i´ve to use the dll libarys and so on)
But as you all know, when we import a file to maya, it decodes the amplitude information, which can be proved by a correct graphical display of the amplitude to the timeline.
How is this done ??
(No chance to view this by watching the "echo-command" lines)
And even if, i´ll catch these procedures, how may i link them to the extrusion ammount of the faces?
The last chance i see is to extract the Information given by FFT to a txt-file and to readd them back from there.
I´m really serching hart to find a "maya-intern" solution to that problem. (Isn´t it possible to do dll-calls from maya??)
You see, it´s a hard thing and not even easy to find a solution.
Hope anybody could give me a hint or so.
subSTYLE
P.S.: Please excuse my bad english, i`m not very used to write in english language. Hope it might get better some day.
First I want to say that this is a great Forum !
Yes, i havev leared a lot, just form reading, but now the time has come that i´ve got to ask a question ;-)
The problem I have is, that i want to link an wave-audio-file as input for the extrusion of faces at various geometric bodies, like e.g. spheres, cubes ect.
So i started in Mel to developp a script, to draw the mathematic normals of all selected faces as splines.
This way i thought to have found the best way to extrude the faces along the created splines.
This is what we came up with:
//********************** **************
global proc createFaceNormalSpline()
{
string $selection[] = `ls -sl`;
string $faceSelection[];
float $normal[];
float $startPoint[];
float $endPoint[];
string $face;
string $sel;
float $mult = 10;
for($sel in $selection)
{
select -r $sel;
ConvertSelectionToFaces ;
$faceSelection = `ls -sl -fl`;
waitCursor -st 1;
for($face in $faceSelection)
{
select -r $face;
$normal = `getNormalArray`;
$startPoint = `getFaceCenter`;
$endPoint[0] = $startPoint[0] + $normal[0] * $mult;
$endPoint[1] = $startPoint[1] + $normal[1] * $mult;
$endPoint[2] = $startPoint[2] + $normal[2] * $mult;
curve -d 1 -p $startPoint[0] $startPoint[1] $startPoint[2]
-p $endPoint[0] $endPoint[1] $endPoint[2]
-k 0 -k 1 ;
}
}
waitCursor -st 0;
}
global proc float [] getFaceCenter()
{
ConvertSelectionToVertices;
string $selection[] = `ls -sl -fl`;
string $sel;
float $center[];
float $point[];
int $i;
for($sel in $selection)
{
$point = `xform -ws -q -t $sel`;
$center[0] += $point[0];
$center[1] += $point[1];
$center[2] += $point[2];
$i++;
}
$center[0] = $center[0]/$i;
$center[1] = $center[1]/$i;
$center[2] = $center[2]/$i;
return $center;
}
global proc float [] getNormalArray()
{
string $allNormals[] = `polyInfo -fn`;
string $oneNormal;
string $tokResult[];
float $normalArray[];
clear $normalArray;
int $i = 0;
for($oneNormal in $allNormals)
{
tokenize $oneNormal "FACE_NORMAL :" $tokResult;
$normalArray[$i] = $tokResult[1];
$normalArray[$i+1] = $tokResult[2];
$normalArray[$i+2] = $tokResult[3];
$i+=3;
}
return $normalArray;
}
//********************* ***************
I think this works very well.
But now the problems came up.
How may i extract the information of the amplitude from a wave file ?? Is there a way to do this in Mel ??
Must be one, sure ...
I found a method called FFT (Fast Fourier Transform, which is the one, most audio players use e.g. Winamp ect.)
But to use it, i´d have to write a standalone programm in c++ (cause i´ve to use the dll libarys and so on)
But as you all know, when we import a file to maya, it decodes the amplitude information, which can be proved by a correct graphical display of the amplitude to the timeline.
How is this done ??
(No chance to view this by watching the "echo-command" lines)
And even if, i´ll catch these procedures, how may i link them to the extrusion ammount of the faces?
The last chance i see is to extract the Information given by FFT to a txt-file and to readd them back from there.
I´m really serching hart to find a "maya-intern" solution to that problem. (Isn´t it possible to do dll-calls from maya??)
You see, it´s a hard thing and not even easy to find a solution.
Hope anybody could give me a hint or so.
subSTYLE
P.S.: Please excuse my bad english, i`m not very used to write in english language. Hope it might get better some day.
