top of page

Exploring the magic and limitations of ChatGPT in generating Python code for acoustic design - Day 1

  • Su
  • Apr 15, 2023
  • 1 min read

Creating an omni-directional sound source

On the internet, ChatGPT is hailed as a coding wizard, capable of conjuring up web pages from mere sketches and crafting apps in a single day. But how does ChatGPT fare when it comes to generating Python code for acoustic design in Grasshopper? I put both GPT3.5 and GPT4 to the test, and while they were able to quickly convert prompts into clean code, more often than not, the resulting code failed to run properly. Asking ChatGPT to debug its own code proved to be a fruitless endeavor.


That being said, ChatGPT did manage to produce an impressive Python code for representing an omni-directional sound source. When using rays to represent such a source, the end points of each ray on the radiation sphere should be evenly spaced. This seemingly simple requirement is actually a fascinating mathematical problem, as it turns out that for more than 20 points on a sphere, it is impossible to achieve perfect evenness. However, mathematicians have devised several methods to achieve the most even distribution possible.


Using the Fibonacci spiral method, ChatGPT submitted a well-executed solution, as shown below.




Comments


bottom of page