<< Chapter < Page Chapter >> Page >

In order facilitate on the fly sound analysis requiring demanding DSP algorithms, we implemented a parallel three-stage pipelined sound engine that allows sound events to be time correlated to in game events. This pipelined implementation allows the analysis of the song to be performed on chunks of the song simultaneously along with loading new chunks from the input device and playing already analyzed chunks. This method gives the analyzer ample time to perform the analysis, as long as that analysis takes less time to perform than the chunk it is analyzing takes to play. Because each stage of the analysis (the Loader, the Analyzer, and the Player) each run in their own threads, this system can take advantage of multiprocessor systems such as the multi-core processors found in most of today's computers.

The pipelined sound engine

The full sound engine pipeline system.
The full sound engine pipeline system.
  • Stage 1 - Loader: This stage translates the input song file from its source format (e.g. MP3 or WAV) to an internal uncompressed format and buffers the result into buffer chunks that will be set to other to other pipeline stages.
  • Stage 2 - Analyzer: This stage takes the uncompressed buffer chunk and performs various bits of time domain and frequency domain analysis, generating a chunk of time-correlated events and the buffer of song that goes with those events.
  • Stage 3 – Player: This stage takes the sound and event buffers from the Analyzer and plays them, correlating any events to what is currently being played.

Each stage communicates with the next via an adapter with a loadBuffer method.This method blocks the the current stage of the pipeline until the next stage of the pipeline is ready to receive the buffer. In this way, the pipeline will fill up as much as possible while the player stage is processing the buffer. The player also controls the speed of the pipeline indirectly through this loading method. Great care was taken to minimize the time the transfer of each buffer takes. Rather than copying the buffer from each stage to the next, each stage instead just passes on control of its buffer to the next stage, allocating a new buffer entirely. This allocation process is much faster than copying the data, though if the allocator is bad, it can use more memory than is necessary. Finally, each time a stage of the pipeline blocks to wait until the next stage is done processing or blocks waiting for new data, it relinquishes control of the processor resources, allowing the other stages to run at full speed.

Questions & Answers

calculate molarity of NaOH solution when 25.0ml of NaOH titrated with 27.2ml of 0.2m H2SO4
Gasin Reply
what's Thermochemistry
rhoda Reply
the study of the heat energy which is associated with chemical reactions
Kaddija
How was CH4 and o2 was able to produce (Co2)and (H2o
Edafe Reply
explain please
Victory
First twenty elements with their valences
Martine Reply
what is chemistry
asue Reply
what is atom
asue
what is the best way to define periodic table for jamb
Damilola Reply
what is the change of matter from one state to another
Elijah Reply
what is isolation of organic compounds
IKyernum Reply
what is atomic radius
ThankGod Reply
Read Chapter 6, section 5
Dr
Read Chapter 6, section 5
Kareem
Atomic radius is the radius of the atom and is also called the orbital radius
Kareem
atomic radius is the distance between the nucleus of an atom and its valence shell
Amos
Read Chapter 6, section 5
paulino
Bohr's model of the theory atom
Ayom Reply
is there a question?
Dr
when a gas is compressed why it becomes hot?
ATOMIC
It has no oxygen then
Goldyei
read the chapter on thermochemistry...the sections on "PV" work and the First Law of Thermodynamics should help..
Dr
Which element react with water
Mukthar Reply
Mgo
Ibeh
an increase in the pressure of a gas results in the decrease of its
Valentina Reply
definition of the periodic table
Cosmos Reply
What is the lkenes
Da Reply
what were atoms composed of?
Moses Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

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