1
0

first_order.scad 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. //
  2. // First Order (B-format) Ambisonics Microphone, or Bambi for short
  3. //
  4. // Copyright 2015 Fernando Lopez-Lezcano
  5. //
  6. // Code released under the GNU GPL License
  7. // http://www.gnu.org/licenses/gpl-3.0.en.html
  8. //
  9. // 3d models under Creative Commons Non-Commercial Share-alike, CC-NC-SA 3.0
  10. // http://creativecommons.org/licenses/by-nc-sa/3.0/
  11. // microphone capsule holder
  12. // azimuth: orientation of the capsule
  13. // elevation: orientation of the capsure
  14. // separation: how far from the center to displace the capsule
  15. // radius: radius of the microphone
  16. // height: height of the microphone
  17. // wall: thickness of the microphone housing walls
  18. // twist: adjust the angle of the mounts so they match
  19. // mounts: number of mounts to create (2 or 3)
  20. module capsule (azimuth, elevation, separation, radius, height, wall, twist, mounts) {
  21. rotate([0, 0, azimuth]) {
  22. rotate([0, (90 - elevation), 0]) {
  23. translate([0, 0, separation]) {
  24. // the capsule holder
  25. difference () {
  26. union () {
  27. // main capsule holder
  28. cylinder(r = radius + wall, h = height, $fn = 128);
  29. // ridge to stop capsule when inserted
  30. translate(v = [0, 0, - (wall / 2)]) {
  31. difference() {
  32. cylinder(r = radius + wall, h = wall / 2, $fn = 128);
  33. cylinder(r = radius - 0.4, h = wall / 2, $fn = 128);
  34. }
  35. }
  36. // the attachment point to the other capsules
  37. for (rot = [-120 : 120 : mounts == 2 ? 0 : 120]) {
  38. rotate(a = rot + twist, v = [0, 0, 1]) {
  39. translate(v = [radius + wall, 0, wall * 2]) {
  40. rotate(a = 145, v = [0, 1, 0]) {
  41. cube([wall * 2.5, wall * 2, 6], center=true);
  42. // cylinder(d=wall * 3, h = seaparation, center=true);
  43. }
  44. }
  45. }
  46. }
  47. }
  48. // the inside of the capsule holder
  49. cylinder(r = radius, h = height, $fn = 128);
  50. // remove the upper part of the attachment points
  51. translate(v = [0, 0, height]) {
  52. cylinder(r = radius + wall, h = wall);
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }
  59. // mounting stalk
  60. module stalk (radius_top, radius_bot, length, wall, separation) {
  61. // top cone
  62. translate([0, 0, -separation]) {
  63. difference() {
  64. cylinder(h = length, r1 = radius_bot, r2 = radius_top, center = true, $fn = 128);
  65. cylinder(h = length, r1 = radius_bot - wall, r2 = radius_top - wall, center = true, $fn=128);
  66. // carve out the two microphones, this is a hack
  67. translate([-(wall * 3), wall * 3, cap_sep * 1.5]) {
  68. rotate([0, 145 + 90, -45]) {
  69. cylinder(h = length * 1.4, r = mic_radius + wall, center = true, $fn=128);
  70. }
  71. }
  72. translate([wall * 3, -(wall * 3), cap_sep * 1.5]) {
  73. rotate([0, 145 + 90, 135]) {
  74. cylinder(h = length * 1.4, r = mic_radius + wall, center = true, $fn=128);
  75. }
  76. }
  77. }
  78. // mounting stalk
  79. translate([0, 0, -(1.5 * length)]) {
  80. difference() {
  81. cylinder(h = length * 2, r = radius_bot, center = true, $fn=128);
  82. cylinder(h = length * 2, r = radius_bot - wall, center = true, $fn=128);
  83. }
  84. }
  85. }
  86. }
  87. // vectors pointing in the directions of the four capsules
  88. direction1 = [1, 1, 1];
  89. direction2 = [-1, 1, -1];
  90. direction3 = [-1, -1, 1];
  91. direction4 = [1, -1, -1];
  92. dist = sqrt(3);
  93. // azimuths
  94. az1 = atan2(1, 1);
  95. az2 = atan2(1, -1);
  96. az3 = atan2(-1, -1);
  97. az4 = atan2(-1, 1);
  98. // elevations
  99. el1 = asin(1/dist);
  100. el2 = -asin(1/dist);
  101. el3 = asin(1/dist);
  102. el4 = -asin(1/dist);
  103. // dimensions for the EM182 electret microphone
  104. mic_radius = 5;
  105. mic_height = 4.5;
  106. // separation between capsules
  107. cap_sep = 6;
  108. // connect the four instances together
  109. capsule(az1, el1, cap_sep, mic_radius, mic_height, 1, 60, 3);
  110. capsule(az2, el2, cap_sep, mic_radius, mic_height, 1, 240, 2);
  111. capsule(az3, el3, cap_sep, mic_radius, mic_height, 1, 60, 3);
  112. capsule(az4, el4, cap_sep, mic_radius, mic_height, 1, 240, 2);
  113. // the mount
  114. stalk(mic_radius * 1.25, mic_radius * 2/3, 8, 1, 12);
  115. // just one to test
  116. //capsule(0, -90, -mic_height, mic_radius, mic_height, 1, 0);