Re: Libaudioverse Preview 1

Here is the fixed sim3d (what are the value limits?):


#demonstrates how to use the 3d simulation.
import libaudioverse
import collections

sim = libaudioverse.Simulation(device_index = -1)
world = libaudioverse.WorldObject(sim, "mit.hrtf")
source = libaudioverse.SourceObject(sim, world)
print """Enter a path to a sound file.
For best results, this should be mono.  If not, only the first (usually left) channel will be used."""
filepath = raw_input()

print """Enter python expressions that evaluate to 3-tuples (x, y, z).
this would look like:
1,0,0
Positive x is to your right, positive y is above you, and positive z is
behind you.
Enter quit to quit."""

a = True
vect = (0,0,0)

while a:
    z = raw_input("give a command")
    if z == "quit":
    &nb sp;   a = False
    elif z.strip() != "":
        vect = eval(z)

    f = libaudioverse.FileObject(sim, filepath)
    source.inputs[0] = f, 0
    source.position = vect
    sim.output_object = world
print "done"



#here is a little scene that will show the sound playing at different locations without you doing anything


#demonstrates how to use the 3d simulation.
import libaudioverse, time
import collections

t = time.sleep

sim = libaudioverse.Simulation(device_index = -1)
world = libaudioverse.WorldObject(sim, "mit.hrtf")
source = libaudioverse.SourceObject(sim, world)

filepath = "sounds/sword.ogg"

def s(vect=(0,0,0)):
    """Is the script to play the sound. The sound needs time to play, so that is why there is sleeping at the end. the sleeping at the start is for your screen reader to say what the sound is. Pass in the sound location as a tupal like the default"""
    t(1)
    f = libaudioverse.FileObject(sim, filepath)
    source.inputs[0] = f, 0
    source.position = vect
    sim.output_object = world
    t(1.5)

print "listen to the sword in front of you"
s((0,0,0))
print "now hear it move to your left"
s((-1,0,0))
print"now it will move behind you"
s((-1,0,1))
print"now it will continue moving behind you"
s((0,0,1))
print "You hear it behind you to your right"
s((1,0,1))
print "Now it will move to your right, in front"
s((1,0,0))
print "and now we are back to the front"
s((0,0,0))

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Development room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : Aminiel via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Development room : camlorn via Audiogames-reflector

Reply via email to