1
0

first_order.scad 4.9 KB

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