Harmonic drums neural network

I’ve written before about my research group’s efforts at trying to find harmonic drums. One of those students wants to continue that work as a independent study so I’ve been putting some more thought into it. This post is about my fledgling efforts to use neural network technology to help us out.

Our continuing goal is to produce an 2D surface (drum) that has resonant frequencies that are harmonic. The parameter space to search in is huge (infinite?) but ultimately we’d love to find a shape (that we could 3D print!) that would sound cool. If we could find it we could print several different sizes to have a harmonic instrument.

For most instrument designs, if you name the lowest/dominant frequency that you want, you can usually pretty easily find the physical parameters you need to achieve that. Take a simple stringed instrument as an example. The three variables that matter are the length of the string, the tension in the string, and the linear mass density of the string:

f_\text{fundamental}=\frac{1}{2L}\sqrt{\frac{\text{tension}}{\text{linear mass density}}}

So it’s pretty easy to find a string that sounds right. After that the beauty of a string is that all the other resonances are simple multiples of that fundamental frequency, so all of them sound good (except the 7th harmonic, that sounds like crap – see the placement of pickups on electric guitars that try to kill that one).

The problem with drums is that most of the time the resonances don’t have such an easy integer ratio relationship. That’s why drums aren’t usually considered harmonic instruments.

So, in our case we’re hunting for a shape that has some interesting resonances. This post is trying to get some help from you fine folks on how to use a neural network to do that.

Here’s what we’d love: name a set of frequencies we’d like a drum to have and determine the shape that would do it. We’ve tried some other approaches, but here I’m trying to get some help on how to design a neural network to do it. Here’s our set-up (nearly all points welcome your challenges!):

  1. We are somewhat convinced that the resonances for a polygon shaped drum are pretty close to the resonances of a smoothed out shape that would hit the same points as the polygon (this allows speed on our end to generate the frequencies for a given drum – ie the opposite of what we’re looking for).
  2. We make a training set by setting the order of the polygon (n) and then repeating:
    1. generate n points in the plane
    2. Find the shortest tour of visiting them to give us a region that doesn’t cross itself
    3. Make the region (in Mathematica: BoundaryMeshRegion[points, FindShortestTour[pts, Line[Range[n]]][[2]]])
    4. Find the lowest 3 eigenfrequencies (in Mathematica: NDEigenvalues . . .)
    5. Have the new trainer be {f1, f2, f3} -> coordinates of polygon (note I say more about this point below)
  3. We make a neural network that takes 3 inputs and matches the number of coordinates for the polygon for the outputs.
    1. Mathematica allows us to quickly set up such a network and to go crazy with the number of nodes in each layer and how many layers. Here’s the syntax for a single hidden layer with 10 nodes, Sigmoid-based NN:
      1. NetTrain[NetChain[{10,LogisticalSigmoid, 7}], trainingset]
      2. NetTrain looks at the training set to get the input layer size, but you have to put in the output size. The 7 there is for a pentagon shape (see below).
    2. We’ve tried 7 hidden layers with 100 nodes each along with all kinds of different shapes and sizes. We’d love some ideas here
      1. Beyond a sigmoid nonlinearlity Mathematica lets you do all kinds of things like hyperbolic tangent and ramp

For n=5 (pentagons) I originally thought to try 5 ordered pairs for the coordinates of the pentagon. I realized, though, that there’s lots of redundancy built into that. For example, rotating a region or translating it doesn’t change the resonant frequencies. So instead, for the moment, I’m trying 4 lengths and 3 turning angles (because assuming the 5th link goes back to the first point – which I set at the origin – is enough) or 7 pieces of information. For triangles I use two lengths and one angle, which is also enough. I figure that savings should be useful.

Unfortunately, even after training tens of thousands of rounds with training sets containing of tens of thousands of trainers we’re not making much progress. Hence this post.

So, can you help? We’d love some challenges to our assumptions/approaches listed above. We’d also love to hear some good ideas for neural network structures to try. Luckily doing it in Mathematica is pretty easy, but if you’ve got a system you’d like to try we’re happy to provide the training set.

Some starters for you:

  • This is cool! I think point x.y above can be improved and here’s how . . .
  • This is really dumb. It’s obvious from point x.y above that you guys don’t know what you’re doing. What you should do is . . .
  • You didn’t italicize Mathematica at all in this post so I stopped reading.
  • I thought you said you were trying to do as much as you can using python these days. What gives?
  • What makes you think a neural network can actually solve this problem?
  • I don’t understand point x.y above. Please explain it better so I can get some sleep.
  • My band’s name is “7th harmonic” and we’re suing you because you said we sound like crap

 

About Andy Rundquist

Professor of physics at Hamline University in St. Paul, MN
This entry was posted in mathematica, programming, research. Bookmark the permalink.

2 Responses to Harmonic drums neural network

  1. B.i.: Often for regression problems, a ReLU or Leaky-ReLU activation fares better than sigmoid or tanh, because of the “vanishing gradient problem”.

    General comment: NN’s are terrible at extrapolation. Do you know if the set of freq’s with harmonic relationships is *included within* in the space of data you’re generating?

    • Andy "SuperFly" Rundquist says:

      Thanks for the advice about the activation functions, I’ll give that a try. My guess is that a pure harmonic progression isn’t possible in the current parameter space, but right now I’m just trying to get other similar trainers to fare well.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s