Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411500 Posts in 69373 Topics- by 58429 Members - Latest Member: Alternalo

April 25, 2024, 01:10:47 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)TutorialsSound spatialization for 2D games
Pages: [1]
Print
Author Topic: Sound spatialization for 2D games  (Read 3798 times)
Martin 2BAM
Level 10
*****


@iam2bam


View Profile WWW
« on: May 09, 2009, 10:04:43 PM »

I wrote a guide/tutorial on how to make sounds sound like they should depeding on their position (sound spatialization), also to work the way that it's expected for 2D games.

The tutorial is written for SFML actually, but the theory can be applied to other libraries like OpenAL or such.

Is kind of lengthy, but has graphics to make it less painful.

As spanish is my mother languaje, if you find any errors in the writing or also if you do in the theory or code, be free to point them out. Any feedback is welcome!

It includes code examples in C++ for SFML and a working example project.

I hope you like it
Link:
http://blog.tbam.com.ar/2009/05/sound-spatiaiization-for-2d-games-in.html

-Martín Durr...?Hand Point Right

« Last Edit: June 17, 2009, 09:53:22 AM by nitram_cero » Logged

Working on HeliBrawl
Mir@k
Level 1
*


Pffffffft


View Profile WWW
« Reply #1 on: May 10, 2009, 10:42:19 PM »

No spanish version? Sad
Logged

Martin 2BAM
Level 10
*****


@iam2bam


View Profile WWW
« Reply #2 on: May 13, 2009, 05:05:36 PM »

No, sorry Well, hello there!
Logged

Working on HeliBrawl
Reiss
Level 1
*



View Profile
« Reply #3 on: May 29, 2009, 01:12:14 PM »

thanks!  i haven't ever gotten deep into audio programming before, so that tutorial was pretty helpful.
Logged
Martin 2BAM
Level 10
*****


@iam2bam


View Profile WWW
« Reply #4 on: June 09, 2009, 03:23:10 PM »

You're welcome Smiley
Logged

Working on HeliBrawl
ChevyRay
Guest
« Reply #5 on: June 17, 2009, 07:13:55 AM »

That was an excellent read! Your wonderful diagrams made it all the better, too Grin

You mention at the beginning that the tutorial is long, but I thought it was just perfect. Too many tutorials do just that, explain the guts of the coding, and don't really start out by explaining the actual topic at hand in a language we can all speak.

Write more!
Logged
Martin 2BAM
Level 10
*****


@iam2bam


View Profile WWW
« Reply #6 on: June 17, 2009, 09:51:28 AM »

I'm glad you liked it! Beer!

I have some other not-easily-found topics on my mind but, even if it doesn't seem so, it's really an exhausting task for me!

I think graphics are a must, but making them and writing not in my mother language, and trying to make it readable for people that are new to the subject... takes a while Smiley

Thanks for the support!

I'll drop a little publicity here :D: you can check a real-life example of how it works in this game I'm making (link).
It's subtle, but I think realistic.
I use almost the same code as the one from the spatialization tutorial.

Next I'll be writing one about priority sound managers for a limited amount of sound sources.
* The basic one, just a resource handler.
* A priority handler that can reown a resource at any time depending on:
  * Priority: More important sounds (e.g.: dialogs over gunshots) always should play.
  * and Distance: Discarding "really far away" spatialized sound from playing with a coarse square root table. And modifying the real priority if given a sound distance from the listener.

Also making an advice about how SFML says that it's Sound class is a flyweight (like "Sprite" for graphics) but actually each object owns an OpenAL sound source (a resource!)
So having, for example, enemy objects owning Sounds, even if they're not playing any, will inabilitate others to work (they can be out of resources)
In some OpenAL implementations, sources are limited to 64... or even 16!

Regards
-Martín


Logged

Working on HeliBrawl
Martin 2BAM
Level 10
*****


@iam2bam


View Profile WWW
« Reply #7 on: June 26, 2009, 01:20:15 PM »

Oh, spammers indeed.
« Last Edit: June 28, 2009, 02:32:58 PM by nitram_cero » Logged

Working on HeliBrawl
Melly
Level 10
*****


This is how being from "da hood" is like, right?


View Profile
« Reply #8 on: June 28, 2009, 10:16:56 AM »

Oh, spammers.
Logged

Feel free to disregard the above.
Games: Minus / Action Escape Kitty
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic