<< Chapter < Page Chapter >> Page >

We performed an analysis on the volume of the song to determine how quickly the pieces in tetris should fall. The thinking behind this is that songs generally grow louder when they are growing more intense. Therefore, the game should become more intense when the song does.

Envelope generation

We compute a constant based on the relative volume of the song such that the current drop speed can be determined as a fraction of the maximum fall speed. We determine the relative volume from the songs envelope. The envelope is computed by first taking the normalized magnitude of the signal and then setting each second of the song to the max value in that segment of the song.

S = Number of Samples in Signal
Envelope[ τ ] = n = τ τ + S abs(signal[n]) S max abs(signal)

Envelope from raw signal

Raw signal and Generated Envelope
The normalized envelope is generated from the raw signal by take max values from the absolute value of the signal

Speed calculation

Because the signal is normalized, the value of the envelope at time t is equivalent to the fractional value of the maximum speed that the current speed is to be set at.

Speed[ τ ] = Envelope[ τ ] * Max Speed

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Tetris sound: using music to affect gameplay. OpenStax CNX. Dec 20, 2013 Download for free at http://cnx.org/content/col11609/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Tetris sound: using music to affect gameplay' conversation and receive update notifications?

Ask