Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Direction of the Sound in 3D

(69 views • 4 replies)

This topic is 1 page long.

<< < > >>
Shouting

souled

Reply To Post Reply & Quote

Posted at: 7/5/08 08:10 AM

souled NEUTRAL LEVEL 14

Sign-Up: 09/18/06

Posts: 1,528

I asked the Audio forum for help, so everything's explained there but I was wondering if anyone here could give me some help on this.

Basically in my game (which will be in a mock 3D environment) I want the player to hear sounds as though they are in front, behind or to the left or right. Like this. I've looked over all the information on Wikipedia but I'm struggling to find some sort of equation.

Thanks, hopefully you may some advice.


None

henke37

Reply To Post Reply & Quote

Posted at: 7/5/08 10:34 AM

henke37 NEUTRAL LEVEL 16

Sign-Up: 09/10/04

Posts: 2,565

There is no easy equation for back/front. Given that we humans only have two ears. Left/right on the other hand is very easy in Flash, just use the pan property of the SoundChannel class.

Move on to ActionScript 3! And please, drop the mysql PHP extension, it's so stale that it lacks features that is no longer considered new! Go mysqli or pdo instead.


None

RiotFlash

Reply To Post Reply & Quote

Posted at: 7/5/08 10:58 AM

RiotFlash NEUTRAL LEVEL 08

Sign-Up: 12/11/06

Posts: 1,146

its EXTREMELY difficult. you have to have different volumes and frequencies in both ears. experiment with that video. only have one earphone in. you hear sort of an echo, i think its in a different frequency. perhaps not. anyway, to code this in a game would be basically impossible. here's how i guess I would do it:

so you got some boxes. like a grid. maybe box A1 in the grid would play soundfrequency1 on the right side and soundfrequency2 on the left on hittest. and then maybe box A2 would play soundfrequency1 and soundfrequency3 on hittest? idk. do TONS of experimenting.

get back to me on this, i'd love to hear about it. sounds awesome.

Siggy for rent.
$2 a month.
PM for details.


None

DougyTheFreshmaker

Reply To Post Reply & Quote

Posted at: 7/5/08 11:17 AM

DougyTheFreshmaker NEUTRAL LEVEL 02

Sign-Up: 07/30/07

Posts: 480

Adjusting the balance based on whether or not something is to the left/right of you should be trivial. As well, making things that are farther away quieter is pretty straightforward. And that's about all you can do.

It isn't possible to make something sound like it's 'behind you'. We only hear in one dimension. In "real life" we can figure out whether sounds are in front/behind/above/below by adjusting the position and angle of our head, as well as through logical deduction (if you hear a jet, you look up, not down, because jets fly in the air).

Read through the last few paragraphs of this page on hearing. Simulating the echos to provide more 'clues' based on room size etc, which is I believe what the barber example does, could very slightly help, but it'd be a huge investment on your part and would probably impact the performance of your program considerably, in particular since it's already some variant of 3D in Flash (and you need those cycles).

We should take care not to make the intellect our god; it has, of course, powerful muscles, but no personality.
Freshmaking
Brainscrape

BBS Signature

None

Ansel

Reply To Post Reply & Quote

Posted at: 7/5/08 01:40 PM

Ansel LIGHT LEVEL 17

Sign-Up: 09/02/06

Posts: 4,014

At 7/5/08 08:10 AM, souled wrote: Basically in my game (which will be in a mock 3D environment) I want the player to hear sounds as though they are in front, behind or to the left or right. Like this.

I shat bricks. That was super amazing.

As for the actual programming aspect, I really don't know :c

BBS Signature

All times are Eastern Daylight Time (GMT -4) | Current Time: 04:53 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!