//
// Spherical Harmonics Ear Project (*SpHEAR)
//
// Octathingy, Second Order Ambisonics Microphone
//
// based on:
// "A second-order soundfield microphone with improved polar pattern shape"
// by Eric Benjamin, Audio Engineering Society Convention Paper 8728,
// October 2012, San Francisco
// Copyright 2015-2016, Fernando Lopez-Lezcano, All Rights Reserved
// nando@ccrma.stanford.edu
//
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
// 3d Models released under the Creative Commons license as follows:
// Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
// http://creativecommons.org/licenses/by-nc-sa/4.0/
include
////
//// model parameters
// dimensions of the electret microphone capsule
capsule_radius = 5;
capsule_height = 4.5;
// distance between face of capsule and center of array
mic_radius = 14;
// dimensions of capsule holder connection legs
leg_width = 5;
leg_thick = 1.75;
// width of the ridge that connects to the mount
ridge_width = 2;
ridge_length = 2;
// depth of the connector mount ridge
ridge_depth = 3.0;
// add to the thickness of ridges
ridge_wfit = 0.1;
ridge_hfit = 3;
// wall thickness of capsule holder
wall = 1;
// dimensions of microphone holder
mount_radius = 4.5;
mount_wall = 0.75;
// height of mount
mount_height = 4;
// type of octathingy
// 0 -> regular octathingy (equilateral triangles in the square antiprism)
// 1 -> tetrahedral compatible octathingy (same elevation angle as the tetrahedral mic)
tetra_compat = 0;
//// end of model parameters
////
//// rendering control
// what type of connection to use between capsule holders:
// 0 -> original cylindrical angled legs
// 1 -> interlocking horizontal legs
// 2 -> interlocking vertical legs
connect = 1;
// adjustment for the radius of the capsule
// measured inside diameter of a trial print was around 7.5 to 8.2
// instead of 10, capsule diameter was 9.99)
fudge = 0.15;
// adjustment for fit of slots in connection legs and mount
fit = 0.1;
// number of facets for rendering cylinders
facets = 64;
//// end of rendering control
////
// define the elevation angle of the upper and lower rings
//
// http://eusebeia.dyndns.org/4d/antiprism4
//
// The Cartesian coordinates of the square antiprism,
// centered on the origin and having edge length 2, are:
//
// (0, ±√2, 1/∜2)
// (±√2, 0, 1/∜2)
// (±1, ±1, −1/∜2)
//
// the elevation angle for the two rings of 4 is:
//
// 1/2*∜2 = 0.420448207627 (z for edge length = 1)
// atan(1/(2*∜2) / 0.707) = 30.7358671024
elev_angle = 90 - (tetra_compat == 0 ? atan(1 / (2 * sqrt(sqrt(2))) * sqrt(2)) : atan(sqrt(1/2)));
// calculate half angle between vertices in the square antiprism
// these angles define the length of the connecting legs
//
// z coordinate of antiprism vertices
vert_z = (sqrt(2) / 2) / tan(elev_angle);
// vector length (same for all antiprism vertices)
vert_n = norm([-0.5, -0.5, vert_z]);
// half angle between adjacent vertices in either the upper or lower rings
vert_angle_h = acos(([-0.5, -0.5, vert_z] / vert_n) * ([0.5, -0.5, vert_z] / vert_n)) / 2;
// half angle between adjacent vertices in the upper and lower rings
vert_angle_v = acos(([0.0, -1 / sqrt(2), -vert_z] / vert_n) * ([0.5, -0.5, vert_z] / vert_n)) / 2;
// angles of the connection legs and adjacent capsule holders
leg_angles = tetra_compat == 0 ?
[
[-63, 90 - vert_angle_h],
[63, 90 - vert_angle_h],
[-141, 90 - vert_angle_v],
[141, 90 - vert_angle_v]
] :
[
[-60.5, vert_angle_h],
[60.5, vert_angle_h],
[-144.5, vert_angle_v],
[144.5, vert_angle_v]
];
// microphone holder geometry
capsule_sep_min = (mic_radius - capsule_height) * sin(elev_angle) - (capsule_radius + wall) * cos(elev_angle);
capsule_sep_max = mic_radius * sin(elev_angle) - (capsule_radius + wall) * cos(elev_angle);
capsule_bottom = mic_radius * cos(elev_angle) + (capsule_radius + wall) * sin(elev_angle);
mount_radius_capsule = capsule_sep_max;
// render the capsule array
//
module render_octa_capsule_array(z_offset) {
translate([0, 0, z_offset]) {
for (az = [45, 135, -45, -135]) {
rotate([0, elev_angle, az]) {
translate([0, 0, mic_radius - capsule_height]) {
capsule(leg_angles, 180, 0, 0.0, 0.0, 0);
}
}
rotate([0, 180 - elev_angle, az + 45]) {
translate([0, 0, mic_radius - capsule_height]) {
capsule(leg_angles, 0, 1, 0.0, 0.0, 0);
}
}
}
}
}
// render individual capsules
//
module render_octa_capsule_top() {
capsule(leg_angles, 180, 0, 0.0, 0.0, 0);
}
module render_octa_capsule_bot() {
capsule(leg_angles, 0, 1, 0.0, 0.0, 0);
}
// render simple microphone stand mount
//
module render_simple_stand_mount(z_offset) {
translate([0, 0, z_offset]) {
mount([-45, 135], mount_wall, mic_mount_wall, mic_mount_height + mount_top_height + mount_height + capsule_bottom);
}
}