top of page
  • streng20

Music and Structural Dynamics

Updated: Dec 1, 2020

Engineering structures vibrate when subjected to wind or earthquakes. During these vibrations, the air surrounding the building is compressed and rarefied accordingly. But, different buildings vibrate at different frequencies. This implies that if were able to hear the compression and rarefaction of air surrounding the building (i.e. the sound), cities would be an orchestra with thousands of instruments. (Un)Fortunately, our ears can't hear this sound, because the frequency of vibration of buildings is outside the range of frequencies that our ears can detect.


Under these circumstances, we can only imagine what it would be like. To help your imagination, take a look at this short video:

It should be noted that the frequencies of sounds in the video above do not accurately match with the deformed shapes and vibrations of the buildings (as I said before, such a sound cannot be heard by our ears).


To play around with this "piano", which I guess only civil and structural engineers would be interested to, I invite you to download the free app from Play Store following the link down below.


If you want to play around with the code, improve it or build upon it, I would love to hear from you. Here is the code:


# -*- coding: utf-8 -*-
"""
Created on October 4 15:27:51 2020
@author: EarthquakeApps
"""

from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.screenmanager import ScreenManager, Screen

from kivy.uix.button import Button
from kivy.uix.image import Image
from kivy.core.audio import SoundLoader

class PianoPage(GridLayout):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.cols = 8
        
        self.gifet=["1ktGIF.gif", "2ktGIF.gif", "3ktGIF.gif", "4ktGIF.gif", "5ktGIF.gif", "6ktGIF.gif", "7ktGIF.gif", "8ktGIF.gif"]
        self.kt=["kt1", "kt2","kt3","kt4","kt5","kt6","kt7","kt8"]
        buton=["buton1", "buton2","buton3","buton4","buton5","buton6","buton7","buton8"]
        self.butonText=["1", "2", "3", "4", "5", "6", "7", "8"]
        self.soundz=[SoundLoader.load("snd1.wav"), SoundLoader.load("snd2.wav"), SoundLoader.load("snd3.wav"), SoundLoader.load("snd4.wav"), SoundLoader.load("snd5.wav"), SoundLoader.load("snd6.wav"), SoundLoader.load("snd7.wav"), SoundLoader.load("snd8.wav")]
        
        #static images:
        for i in range(8):
            self.kt[i] = Image(source=self.gifet[i], anim_delay = 0.05, anim_loop=1)
            self.add_widget(self.kt[i])

        for i in range(8):
            buton[i] = Button(text=self.butonText[i], size_hint_y=1)
            buton[i].bind(on_press=self.buttonPressed)
            self.add_widget(buton[i])             
              
    def buttonPressed(self, i): 
        
        j = self.butonText.index(i.text) 
            
        self.kt[j].source=self.gifet[j]
        self.kt[j].anim_delay = j/80
        self.kt[j].anim_loop=2
        self.kt[j]._coreimage.anim_reset(True)     
        self.soundz[j].play()
        
class pianoAPP(App):

    def build(self):
        self.screen_manager = ScreenManager()
        
        self.piano_page = PianoPage()
        screen = Screen(name="Piano")
        screen.add_widget(self.piano_page)
        self.screen_manager.add_widget(screen)
        
        return self.screen_manager

if __name__ == "__main__":
    currentAPP = pianoAPP()
    currentAPP.run()

If you found the post, the video and the app interesting, I would appreciate it if you share it with your friends, comment down below and join the site by signing up to get notified whenever there is a new post. Here is the link to the app:

Post: Blog2_Post
bottom of page