I'm facing a bit of a challenge with this task.
My idea is to create a line consisting of cubes, each emitting a unique sound that can be heard when you approach it.
The objective is to navigate from the start of the line to the end, playing different sounds along the way to create a sort of 'music'.
The issue I'm encountering is that only 6 out of the 20 cubes are producing sound.
You can check out an online example here:
(Left click to move forward, Right click to move backward)
--
Here is the code snippet for generating the sound:
var Sound = function ( sources, radius, volume ) {
// Code for creating audio and handling sound volumes
}
--
This section covers the creation of the cubes:
// Code for creating cubes with specific positions and sounds
--
And here's how I update the sounds based on the camera position (inside my render function):
// Code for updating sound based on camera distance
--
I'm unsure whether the limitation of only hearing 6 sounds is due to an error in my implementation or a constraint of Three.js, the browser, or another factor.
Any insights would be greatly appreciated!
EDIT 08/06/14
I was able to resolve this issue by implementing the Web Audio API. Here's the updated code block for creating the sound using frequency:
// Code for creating sound using Web Audio API with frequency
Cheers!