1
0

first_order.scad 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. // 0 -> capsule holder
  12. // 1 -> whole microhone
  13. rendermic = 0;
  14. // number of facets for cylinders
  15. facets = 64;
  16. // adjustment for the size of the capsule
  17. // (measured inside diameter was around 7.5 to 8.2 instead of 10, capsule diameter was 9.99)
  18. fudge = 0.1;
  19. // microphone capsule holder
  20. // azimuth: orientation of the capsule
  21. // elevation: orientation of the capsure
  22. // separation: how far from the center to displace the capsule
  23. // radius: radius of the microphone
  24. // height: height of the microphone
  25. // wall: thickness of the microphone housing walls
  26. // twist: adjust the angle of the mounts so they match
  27. // mounts: number of mounts to create (2 or 3)
  28. module capsule (azimuth, elevation, ambradius, radius, height, wall, twist, mounts) {
  29. rotate([0, 0, azimuth]) {
  30. rotate([0, (90 - elevation), 0]) {
  31. translate([0, 0, ambradius - height]) {
  32. // the capsule holder
  33. difference () {
  34. union () {
  35. // main capsule holder
  36. cylinder(r = radius + wall, h = height, $fn = facets);
  37. // ridge to stop capsule when inserted
  38. // translate(v = [0, 0, - (wall / 2)]) {
  39. // difference() {
  40. // cylinder(r = radius + wall, h = wall / 2, $fn = facets);
  41. // cylinder(r = radius - 0.4, h = wall / 2, $fn = facets);
  42. // }
  43. // }
  44. // the attachment point to the other capsules
  45. for (rot = [-120 : 120 : mounts == 2 ? 0 : 120]) {
  46. rotate(a = rot + twist, v = [0, 0, 1]) {
  47. translate([radius - wall, 0, height - wall]) {
  48. rotate(a = 145, v = [0, 1, 0]) {
  49. cylinder(d = wall * 4, h = 6, center = false, $fn = facets);
  50. }
  51. }
  52. }
  53. }
  54. }
  55. // make the hole for the capsule
  56. translate ([0, 0, -2]) {
  57. cylinder(r = radius + fudge, h = height + 2, $fn = facets);
  58. }
  59. // remove any extra connecting beam material from the face of the holder
  60. translate ([0, 0, height]) {
  61. cylinder(r = radius + wall * 2, h = 2, $fn = facets);
  62. }
  63. }
  64. }
  65. }
  66. }
  67. }
  68. // mounting stalk
  69. module stalk (radius_top, radius_bot, length, wall, separation) {
  70. // top cone
  71. translate([0, 0, -separation]) {
  72. difference() {
  73. cylinder(h = length, r1 = radius_bot, r2 = radius_top, center = true, $fn = 128);
  74. cylinder(h = length, r1 = radius_bot - wall, r2 = radius_top - wall, center = true, $fn=128);
  75. // carve out the two microphones, this is a hack
  76. translate([-(wall * 3), wall * 3, cap_sep * 1.5]) {
  77. rotate([0, 145 + 90, -45]) {
  78. cylinder(h = length * 1.4, r = mic_radius + wall, center = true, $fn=128);
  79. }
  80. }
  81. translate([wall * 3, -(wall * 3), cap_sep * 1.5]) {
  82. rotate([0, 145 + 90, 135]) {
  83. cylinder(h = length * 1.4, r = mic_radius + wall, center = true, $fn=128);
  84. }
  85. }
  86. }
  87. // mounting stalk
  88. translate([0, 0, -(1.5 * length)]) {
  89. difference() {
  90. cylinder(h = length * 2, r = radius_bot, center = true, $fn=128);
  91. cylinder(h = length * 2, r = radius_bot - wall, center = true, $fn=128);
  92. }
  93. }
  94. }
  95. }
  96. // vectors pointing in the directions of the four capsules
  97. direction1 = [1, 1, 1];
  98. direction2 = [-1, 1, -1];
  99. direction3 = [-1, -1, 1];
  100. direction4 = [1, -1, -1];
  101. dist = sqrt(3);
  102. // azimuths
  103. az1 = atan2(1, 1);
  104. az2 = atan2(1, -1);
  105. az3 = atan2(-1, -1);
  106. az4 = atan2(-1, 1);
  107. // elevations
  108. el1 = asin(1/dist);
  109. el2 = -asin(1/dist);
  110. el3 = asin(1/dist);
  111. el4 = -asin(1/dist);
  112. // dimensions for the EM182 electret microphone
  113. mic_radius = 5;
  114. mic_height = 4.5;
  115. // separation between capsules
  116. cap_sep = 7;
  117. // distance between face of capsule and center of array
  118. amb_radius = 11.5;
  119. // connect the four instances together
  120. if (rendermic == 1) {
  121. capsule(az1, el1, amb_radius, mic_radius, mic_height, 1, 60, 3);
  122. capsule(az2, el2, amb_radius, mic_radius, mic_height, 1, 240, 2);
  123. capsule(az3, el3, amb_radius, mic_radius, mic_height, 1, 60, 3);
  124. capsule(az4, el4, amb_radius, mic_radius, mic_height, 1, 240, 2);
  125. // the mount
  126. //stalk(mic_radius * 1.25, mic_radius * 2/3, 8, 1, 12);
  127. }
  128. // just one to test
  129. if (rendermic == 0) {
  130. capsule(0, 270, 0, mic_radius, mic_height, 1, 0);
  131. }