electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
Live streaming at radio.electro-music.com

  host / artist show at your time
  EdisonRex Edison's Electronic Review
Please visit the chat
 Forum index » DIY Hardware and Software » ChucK programming language
Spatial Localization Game
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [2 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Wed Dec 17, 2008 3:50 am    Post subject: Spatial Localization Game
Subject description: Can you hit the moving audio source?
Reply with quote  Mark this post and the followings unread

Folks, after coding up some MAUI games and stuff I am eager to code a fun game that everybody can play. And I want it to ROCK! By that I mean I want to hear my rock music (or your choice of music) while playing the game.

I thought about it for a while and for some reason spatial localization came to mind. This is the technique where you vary the sound in the left and right channels to create the impression of the audio source's position. My thinking is that the ChucK game would receive audio from iTunes via an audio routing program and vary the phase and perhaps amplitude to create the impression that the sound is moving with respect to the player. The player must then steer and shoot the enemy.

I did a little googling and found out that the time delay is given by t=(a/c)*2sin(theta) for frequencies below 500 Hz and t=(a/c)*(theta+sin(theta)) for frequencies above 2kHz, where a is the radius of a spherical head (a=87.5mm) and c is the speed of sound in air. The maximum time delay is 660us, so a good formula to use might be 660us*sin(theta). BTW theta is zero in front of you and 90 degrees to your right. I figure distance can be approximated by varying the sound intensity somewhat.

I'm thinking that perhaps the enemy can fly around continuously without dying and everytime you line up a shot and hit the enemy you get a point. There are also 3D spatialization techniques but I figure KISS formula and do it in 2D with sideways mouse motions rotating the player and the spacebar for firing.

I'm still planning this out, so I'm open to suggestions from you on how to go about this properly. Maybe I'll have some code by the time you read this, I dunno. Comments welcome as always.

_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Wed Dec 17, 2008 5:16 am    Post subject: Reply with quote  Mark this post and the followings unread

Hehe, got something already. In the ChucK game program below, you pipe in audo from SoundFlower (Mac) or Jack (Mac/Linux) and the program rotates it around your head. Headphones are strongly recommended. You move the mouse sideways to rotate the player, and press the spacebar to shoot. A score appears in the text window each time you make a shot.

The program still needs lots of work. The enemy might shoot at the player and the player must avoid the shot, or the enemy could close in on the player in time with shots pushing it away. Also some orthogonal Galaga-like player and enemy motion might be cool.

But anyway it's a start. Give it a try!


SpatialGame3.ck
 Description:

Download
 Filename:  SpatialGame3.ck
 Filesize:  3.01 KB
 Downloaded:  115 Time(s)


_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [2 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
mps board

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use