Skip to content

Commit

Permalink
Update exportMesh2HRTF.py
Browse files Browse the repository at this point in the history
fix for Ticket #15: If calculating witout reciprocity, microphone area is now set to 1 and receiver center is taken from the point source coordinates.

original commit fbrinkmann 2020-05-05
  • Loading branch information
f-brinkmann committed Sep 23, 2020
1 parent 5e9e758 commit 86bddd1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Mesh2Input/exportMesh2HRTF.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ def calculateReceiverProperties(obj, obj_data, unitFactor):
fw(";\n")
fw("\n")

# add information about the reciever/point source
if reciprocity:

# get the receiver/ear centers and areas
Expand All @@ -832,10 +833,15 @@ def calculateReceiverProperties(obj, obj_data, unitFactor):
nn = 2

fw("% right ear / receiver\n")
fw("receiverCenter(%d,1:3)=[%f %f %f];\n" %(nn, earCenter[1][0], earCenter[1][1], earCenter[1][2]))
fw("receiverArea(%d,1) =%g;\n" %(nn, earArea[1]))
fw("receiverCenter(%d,1:3) = [%f %f %f];\n" %(nn, earCenter[1][0], earCenter[1][1], earCenter[1][2]))
fw("receiverArea(%d,1) = %g;\n" %(nn, earArea[1]))

fw("\n")
else:

fw("% point source / receiver\n")
fw("receiverCenter(1,1:3) = [%s %s %s];\n" % (sourceXPosition, sourceYPosition, sourceZPosition))
fw("receiverArea(1,1) = 1;\n")

fw("frequencyDependency=")
if frequencyDependency:
Expand All @@ -859,12 +865,7 @@ def calculateReceiverProperties(obj, obj_data, unitFactor):
fw("speedOfSound = " + speedOfSound + "; % [m/s]\n")
fw("densityOfAir = " + densityOfMedium + "; % [kg/m^3]\n\n")

fw("Output2HRTF_Main(cpusAndCores,objectMeshes,reciprocity,")
if reciprocity:
fw("receiverCenter")
else:
fw("[0 0 0; 0 0 0]")
fw(",frequencyDependency,nearFieldCalculation,receiverArea,reference,speedOfSound,densityOfAir);")
fw("Output2HRTF_Main(cpusAndCores,objectMeshes,reciprocity,receiverCenter,frequencyDependency,nearFieldCalculation,receiverArea,reference,speedOfSound,densityOfAir);")
file.close

# ----------------------- Render pictures of the model -------------------------
Expand Down

0 comments on commit 86bddd1

Please sign in to comment.