Loop separate sounds, separate intervals 
Author Message
 Loop separate sounds, separate intervals

I asked this question of someone else, and got an eloquent response,
that turned out to be WAY over my head. I figure someone out there knows
how to do it, has done in before, and wouldn't mind sending me a
snippett of code.

Upon entering a world, I wish to have about four sounds loop in the
background for the sake of ambience...

1) A "white noise" breeze blowing, file is about a 3-second loop.
2) A Blue Jay, file is a half-second, play every nine seconds.
3) A Crow, file is 3/4 seconds, play every seven seconds.
4) A Dog, file is 1.2 seconds, play every twelve seconds.

...or anything similar to above. I was told the following:

For each time interval you need to create a TimeSensor of that duration.
Then
route the fraction_changed event into a Script node that trips everytime
you
loop past a certain time. Then the event time from that script can be
routed to
the startTime of the Sound.

I know it sounds a bit complex, but that is what you need to do.

You could also have a more random effect by having a single looping
TimeSensor
wired into the Script and then play sounds based on a Math.random()
statement.
= = = = (end of quote) = = = =

That all is well and good, but I am making worlds with CosmoWorlds, and
haven't the first clue about the syntax of VRML. Every time I tried to
make any change to the ASCII text of the test world I was futzing with,
Cosmo (or NetScape) would say that it wasn't a valid vrml file. I'm
pretty sure it's really saying that I don't know what I'm doing, and
that would be accurate. ;-)

Anyone feel like e-mailing me a WRL that does anything similar to that,
so I can futz with something that started out working?

KDO
--
==============================================================
Kelvin D. Olson                     Director of Media Services

(612) 522-1200 x302                            Minneapolis, MN



Sun, 04 Jun 2000 03:00:00 GMT  
 Loop separate sounds, separate intervals

Well, the easieast thing would be if you were to read up on the VRML
spec and/or get a book on VRML.  There are links to various resources on
http://vrml.sgi.com.  However, in the spirit of trying to get you
started as quickly as possible I went ahead and wrote up a little wrl
that does what you want.  Note that you can get more fancy if you want,
but this is the most basic version of what you want:

#VRML V2.0 utf8

Sound {
   # This tells it not to spatialize the sound.  Since you mentioned
   # you want background sounds, I assume this is what you want.
However,
   # if you want it to come from a particular location, set this to TRUE
   spatialize FALSE
   # I'm making these very large so that they will be heard throughout
   # your wrl.  If you want them to be localized to a particular area,
   # you will have to set them appropriately.
   minFront 10000
   maxFront 10000
   minBack  10000
   maxBack  10000
   source DEF BREEZE AudioClip {
      # This will cause the breeze to play continuously, starting as
soon
      # as it downloads
      loop TRUE
      url "breeze.wav"
   }

Quote:
}

Sound {
   spatialize FALSE
   minFront 10000
   maxFront 10000
   minBack  10000
   maxBack  10000
   source DEF BLUEJAY AudioClip {
      # you wanted this one to repeat at a 9 second interval and the
      # sound is only 0.5 seconds, so you don't want it looping.
      loop FALSE
      url "bluejay.wav"
   }

Quote:
}

Sound {
   spatialize FALSE
   minFront 10000
   maxFront 10000
   minBack  10000
   maxBack  10000
   source DEF CROW AudioClip {
      loop FALSE
      url "crow.wav"
   }

Quote:
}

Sound {
   spatialize FALSE
   minFront 10000
   maxFront 10000
   minBack  10000
   maxBack  10000
   source DEF DOG AudioClip {
      loop FALSE
      url "dog.wav"
   }

Quote:
}

# for controlling the BlueJay sound
DEF BJTIME TimeSensor {
   # Loops at a rate of once every 9 seconds
   cycleInterval 9
   # Loops continuously, starting when the wrl loads
   loop TRUE

Quote:
}

# for controlling the crow sound
DEF CROWTIME TimeSensor {
   cycleInterval 7
   loop TRUE

Quote:
}

# for controlling the dog sound
DEF DOGTIME TimeSensor {
   cycleInterval 12
   loop TRUE

Quote:
}

# Connect the TimeSensors to their associated AudioClips.  
ROUTE BJTIME.cycleTime TO BLUEJAY.startTime
ROUTE CROWTIME.cycleTime TO CROW.startTime
ROUTE DOGTIME.cycleTime TO DOG.startTime

--


A Silicon Graphics Company  |   http://reality.sgi.com/chamber
  Phone: (650) 933-6414     |          http://doh.engr/



Mon, 05 Jun 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Separate keyword and separate compilation with GNAT?

2. separate keyword and separate compilation with GNAT?

3. parsing comma separated field

4. separating data from a file.

5. Grab info, store in separate file

6. newbie would like to break input file and output to separate files

7. How to separate the fields using AWK

8. Making a menu bar from separated parts in Visual Age Smalltalk (VAST)

9. setting RS for records separated by white space

10. Make changes based on values from separate file

11. HELP. Separating a huge wrapped file

12. Q: Howto enclose comma separated words with "

 

 
Powered by phpBB® Forum Software