|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I've been tinkering a little with JOAL. JOAL is Java Bindings for OpenAL.
https://joal.dev.java.net/
OpenAL is a cross-platform 3D audio API appropriate for use with gaming
applications and many other types of audio applications.
http://www.openal.org/
The point of it all is that I've attached sound emitters (so-called sources)
to some points in my POV-Ray scene and written a java program to "render"
the sound. This is my first test of the system. View the animation with your
speakers turned on of course.
There seems to be a little silence in the start and end of the animation - I
don't know why.
The complete scene file for the attached animation is below.
// +kf10 +kc +kff300
#declare camera_location = <0,0.3,1.2-0.5*clock>;
#declare camera_forward = z+0.1*x*clock;
#declare camera_up = y;
#declare ship1_translate = <sin(clock*2*pi/5)*10,0,1>;
#declare ship2_translate = <1,0.6,cos(clock*2*pi/5)*10>;
camera {
location camera_location
look_at camera_location+camera_forward
up camera_up
}
light_source {<1,2,-3>*1000, color 0.5*<1,1,0.7>}
light_source {<0,3,-1>*1000, color 1*<0.7,0.7,1>}
sky_sphere {
pigment {gradient y color_map {[0,rgb 1][1,blue 1]}}
}
superellipsoid {
<0.2,0.2> scale <0.3,0.2,0.2> translate ship1_translate+0.2*y
pigment {blue 1} finish {reflection 0.2}
}
sphere {
0, 1 scale <0.2,0.2,0.4> translate ship2_translate
pigment {red 1} finish {reflection 0.2}
}
plane {y, 0 pigment {checker rgb 1, rgb 0.1 scale 0.2}}
#include "povsound.inc"
// START POVSOUND
sound_start("soundtest.txt")
sound_set_time(clock*1000)
sound_set_gain(0.5)
sound_set_dobbler_factor(1.0)
sound_set_dobbler_velocity(100)
sound_set_listener(camera_location,camera_forward,camera_up)
// name starttime endtime translate gain pitch
sound_point("ship1", 1000*0, 1000*10, ship1_translate, 2.0, 1.0)
// name sound_filename time
sound_point_loop("ship1","wavdata/engine.wav",1000*0)
// name starttime endtime translate gain pitch
sound_point("ship2", 1000*0, 1000*10, ship2_translate, 1.0, 1.0)
// name sound_filename time
sound_point_loop("ship2","wavdata/hovercraft.wav",1000*0)
sound_end()
// END POVSOUND
Rune
--
3D images and anims, include files, tutorials and more:
rune|vision: http://runevision.com
POV-Ray Ring: http://webring.povray.co.uk
Post a reply to this message
Attachments:
Download '3d_sound_1.mpg' (631 KB)
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Very cool. Strangely enough on my computer the right and left seem to be reversed.
My speaker connections look ok, but maybe I've done something
wrong. Very cool animation anyway.
Rune wrote:
> I've been tinkering a little with JOAL. JOAL is Java Bindings for OpenAL.
> https://joal.dev.java.net/
>
> OpenAL is a cross-platform 3D audio API appropriate for use with gaming
> applications and many other types of audio applications.
> http://www.openal.org/
>
> The point of it all is that I've attached sound emitters (so-called sources)
> to some points in my POV-Ray scene and written a java program to "render"
> the sound. This is my first test of the system. View the animation with your
> speakers turned on of course.
>
> There seems to be a little silence in the start and end of the animation - I
> don't know why.
>
> The complete scene file for the attached animation is below.
>
>
> // +kf10 +kc +kff300
>
> #declare camera_location = <0,0.3,1.2-0.5*clock>;
> #declare camera_forward = z+0.1*x*clock;
> #declare camera_up = y;
>
> #declare ship1_translate = <sin(clock*2*pi/5)*10,0,1>;
> #declare ship2_translate = <1,0.6,cos(clock*2*pi/5)*10>;
>
> camera {
> location camera_location
> look_at camera_location+camera_forward
> up camera_up
> }
>
> light_source {<1,2,-3>*1000, color 0.5*<1,1,0.7>}
> light_source {<0,3,-1>*1000, color 1*<0.7,0.7,1>}
>
> sky_sphere {
> pigment {gradient y color_map {[0,rgb 1][1,blue 1]}}
> }
>
> superellipsoid {
> <0.2,0.2> scale <0.3,0.2,0.2> translate ship1_translate+0.2*y
> pigment {blue 1} finish {reflection 0.2}
> }
> sphere {
> 0, 1 scale <0.2,0.2,0.4> translate ship2_translate
> pigment {red 1} finish {reflection 0.2}
> }
> plane {y, 0 pigment {checker rgb 1, rgb 0.1 scale 0.2}}
>
> #include "povsound.inc"
>
> // START POVSOUND
> sound_start("soundtest.txt")
>
> sound_set_time(clock*1000)
>
> sound_set_gain(0.5)
> sound_set_dobbler_factor(1.0)
> sound_set_dobbler_velocity(100)
>
> sound_set_listener(camera_location,camera_forward,camera_up)
>
> // name starttime endtime translate gain pitch
> sound_point("ship1", 1000*0, 1000*10, ship1_translate, 2.0, 1.0)
> // name sound_filename time
> sound_point_loop("ship1","wavdata/engine.wav",1000*0)
>
> // name starttime endtime translate gain pitch
> sound_point("ship2", 1000*0, 1000*10, ship2_translate, 1.0, 1.0)
> // name sound_filename time
> sound_point_loop("ship2","wavdata/hovercraft.wav",1000*0)
>
> sound_end()
> // END POVSOUND
>
>
> Rune
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I am also getting reversed stereo sound.
You asked for help in how to make the system easier to use, so let me give
you my thoughts...
> #declare camera_location = <0,0.3,1.2-0.5*clock>;
> #declare camera_forward = z+0.1*x*clock;
> #declare camera_up = y;
You should make it possible to read these values automatically if screen.inc
has been included. This lets the user use an interface that they may be more
familiar with (and is also more flexible).
> sound_set_dobbler_velocity(100)
I notice this is the only place where velocity seems to be mentioned. It
seems to me like it would be more intuitive for the user to be allowed to
specify the camera's velocity as a vector and each sound's velocity as a
vector. (Or maybe they could specify the positions of these objects through
macros and then you could calculate their velocities that way.) Geting an
object's velocity relative to the camera would be a simple subtraction, and
then the amount of doppler effect on an object would probably have something
to do with the dot product of the object's velocity with the direction from
the object to the camera. This way your macros do the work and I only have
to think about where everything's moving.
I guess maybe you're already doing that just by using the object's positions
from the text file in your java program.
> sound_set_listener(camera_location,camera_forward,camera_up)
>
> // name starttime endtime translate gain pitch
> sound_point("ship1", 1000*0, 1000*10, ship1_translate, 2.0, 1.0)
> // name sound_filename time
> sound_point_loop("ship1","wavdata/engine.wav",1000*0)
>
> // name starttime endtime translate gain pitch
> sound_point("ship2", 1000*0, 1000*10, ship2_translate, 1.0, 1.0)
> // name sound_filename time
> sound_point_loop("ship2","wavdata/hovercraft.wav",1000*0)
>
> sound_end()
This part all seems pretty intuitive.
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Slime wrote:
> I am also getting reversed stereo sound.
It may be me who have a problem then... :O
I'll wait and see what a few more say.
> You asked for help in how to make the system easier to use, so let me
> give you my thoughts...
Thanks!
>> #declare camera_location = <0,0.3,1.2-0.5*clock>;
>> #declare camera_forward = z+0.1*x*clock;
>> #declare camera_up = y;
>
> You should make it possible to read these values automatically if
> screen.inc has been included. This lets the user use an interface
> that they may be more familiar with (and is also more flexible).
Good point. I'll look into it.
>> sound_set_dobbler_velocity(100)
>
> I notice this is the only place where velocity seems to be mentioned.
Yes.
> It seems to me like it would be more intuitive for the user to be
> allowed to specify the camera's velocity as a vector and each sound's
> velocity as a vector. (Or maybe they could specify the positions of
> these objects through macros and then you could calculate their
> velocities that way.)
That's what I'm doing. The velocities of the camera/listener and the objects
are automatically calculated. In this scene file they're calculated from the
points ship1_translate, ship2_translate and camera_location.
The macro sound_set_dobbler_velocity() is only used to specify the speed of
sound (measured in units per second, where a unit is whatever unit you use
in your scene).
> This way your macros do the work and I only have to
> think about where everything's moving.
That should be the case already. :)
> I guess maybe you're already doing that just by using the object's
> positions from the text file in your java program.
Yep. Actually doppler effect is a part OpenAL, so I don't even calculate it,
I just pass on positions and other info to OpenAL and then it takes care of
it. My system basically just transforms information from one form into
another form, but that alone can be complicated enough.
Rune
--
3D images and anims, include files, tutorials and more:
rune|vision: http://runevision.com
POV-Ray Ring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Awesome! I, too, get reversed stereo, so I guess it's probably on your end.
And I'm really sure that everything is set up correctly, mainly because I
bought new speakers yesterday and they have a nice R and L on the back. ;-)
A good method to check this is to use some some Soundfile and play it. Use
the Windows-Speaker Settings to shift the sound to right and left, and you
should easily identify if you've switched the speakers.
Regarding the system itself: I'm impressed! I hope you'll release it once
you get a fully functional version done. I guess a lot of us Povers would be
very interested for animation purposes (e.g. IRTC)...
Regards,
Tim
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
in news:414adb2a@news.povray.org Rune wrote:
> I've been tinkering a little with JOAL. JOAL is Java Bindings for
> OpenAL. https://joal.dev.java.net/
>
Excelent!!!!
Indeed, left and right seem to be swapped.
Ingo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Tim Nikias wrote:
> Awesome! I, too, get reversed stereo
Yeah, my speakers were indeed reversed.
> Regarding the system itself: I'm impressed! I hope you'll
> release it once you get a fully functional version done.
Well it's more or less fully functional. But I don't know how I can wrap up
a java program in a way that's easy for others to install and/or use. I
think I'll just do my best and then hope someone comes along with
suggestions for a better solution.
> I guess a lot of us Povers would be very interested for
> animation purposes (e.g. IRTC)...
Yeah, I hope so. It kind of surprises me that no efforts have been made in
this direction before...
Rune
--
3D images and anims, include files, tutorials and more:
rune|vision: http://runevision.com
POV-Ray Ring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
ingo wrote:
> Excelent!!!!
Thanks. :)
Rune
--
3D images and anims, include files, tutorials and more:
rune|vision: http://runevision.com
POV-Ray Ring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Spock wrote:
> Very cool. Strangely enough on my computer the right and left seem
> to be reversed. My speaker connections look ok, but maybe I've done
> something wrong. Very cool animation anyway.
Thanks!
It was my speakers that were reversed. I'll fix that right away, so the next
version should have non-reversed stereo... :)
Rune
--
3D images and anims, include files, tutorials and more:
rune|vision: http://runevision.com
POV-Ray Ring: http://webring.povray.co.uk
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Yeah, I hope so. It kind of surprises me that no efforts have been made in
> this direction before...
Well, given our common history of doing similiar things at the same time, I
guess I would have stumbled onto this sooner or later, but it's just
recently that I've begun working on *real* animations, instead of just
tech-demos. But like many times before, you started earlier! :-)
Regards,
Tim
--
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|