Add Chromium-only Blender WebEngine parity work
This commit is contained in:
13
blender-5.2.0/extern/audaspace/bindings/python/examples/binaural.py
vendored
Normal file
13
blender-5.2.0/extern/audaspace/bindings/python/examples/binaural.py
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/python
|
||||
import aud, sys, time, multiprocessing
|
||||
device = aud.Device()
|
||||
hrtf = aud.HRTF().loadLeftHrtfSet(".wav", sys.argv[2])
|
||||
threadPool = aud.ThreadPool(multiprocessing.cpu_count())
|
||||
source = aud.Source(0, 0, 0)
|
||||
sound = aud.Sound.file(sys.argv[1]).rechannel(1).binaural(hrtf, source, threadPool)
|
||||
handle = device.play(sound)
|
||||
|
||||
while handle.status:
|
||||
source.azimuth += 1
|
||||
print("Azimuth: " + str(source.azimuth))
|
||||
time.sleep(0.1)
|
||||
10
blender-5.2.0/extern/audaspace/bindings/python/examples/convolution.py
vendored
Normal file
10
blender-5.2.0/extern/audaspace/bindings/python/examples/convolution.py
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
import aud, sys, time, multiprocessing
|
||||
device = aud.Device()
|
||||
ir = aud.ImpulseResponse(aud.Sound.file(sys.argv[2]))
|
||||
threadPool = aud.ThreadPool(multiprocessing.cpu_count())
|
||||
sound = aud.Sound.file(sys.argv[1]).convolver(ir, threadPool)
|
||||
handle = device.play(sound)
|
||||
handle.volume = 0.1
|
||||
while handle.status:
|
||||
time.sleep(0.1)
|
||||
20
blender-5.2.0/extern/audaspace/bindings/python/examples/dynamicmusic.py
vendored
Normal file
20
blender-5.2.0/extern/audaspace/bindings/python/examples/dynamicmusic.py
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import aud, sys, time
|
||||
|
||||
device=aud.Device()
|
||||
dMusic = aud.DynamicMusic(device)
|
||||
sound1 = aud.Sound.file(sys.argv[1])
|
||||
sound2 = aud.Sound.file(sys.argv[2])
|
||||
effect = aud.Sound.file(sys.argv[3])
|
||||
|
||||
dMusic.addScene(sound1)
|
||||
dMusic.addScene(sound2)
|
||||
dMusic.addTransition(1,2,effect)
|
||||
|
||||
dMusic.fadeTime=3
|
||||
dMusic.volume=0.5
|
||||
|
||||
dMusic.scene=1
|
||||
time.sleep(5)
|
||||
dMusic.scene=2
|
||||
|
||||
time.sleep(500)
|
||||
27
blender-5.2.0/extern/audaspace/bindings/python/examples/playbackmanager.py
vendored
Normal file
27
blender-5.2.0/extern/audaspace/bindings/python/examples/playbackmanager.py
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import aud, sys, time
|
||||
|
||||
device=aud.Device()
|
||||
manager = aud.PlaybackManager(device)
|
||||
sound1 = aud.Sound.file(sys.argv[1])
|
||||
sound2 = aud.Sound.file(sys.argv[2])
|
||||
sound3 = aud.Sound.file(sys.argv[3])
|
||||
sound4 = aud.Sound.file(sys.argv[4])
|
||||
|
||||
manager.play(sound1, 0)
|
||||
manager.play(sound2, 0)
|
||||
manager.play(sound3, 1)
|
||||
manager.play(sound4, 1)
|
||||
|
||||
manager.setVolume(0.2, 0)
|
||||
time.sleep(5)
|
||||
manager.setVolume(0.0, 1)
|
||||
time.sleep(5)
|
||||
manager.pause(0)
|
||||
time.sleep(5)
|
||||
manager.setVolume(0.5, 1)
|
||||
manager.setVolume(1.0, 0)
|
||||
time.sleep(5)
|
||||
manager.stop(1)
|
||||
manager.resume(0)
|
||||
|
||||
time.sleep(500)
|
||||
7
blender-5.2.0/extern/audaspace/bindings/python/examples/player.py
vendored
Normal file
7
blender-5.2.0/extern/audaspace/bindings/python/examples/player.py
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import aud, sys, time
|
||||
device = aud.Device()
|
||||
sound = aud.Sound.file(sys.argv[1])
|
||||
handle = device.play(sound)
|
||||
while handle.status:
|
||||
time.sleep(0.1)
|
||||
21
blender-5.2.0/extern/audaspace/bindings/python/examples/randomSounds.py
vendored
Normal file
21
blender-5.2.0/extern/audaspace/bindings/python/examples/randomSounds.py
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import aud, sys, time
|
||||
|
||||
device=aud.Device()
|
||||
sound1 = aud.Sound.file(sys.argv[1])
|
||||
sound2 = aud.Sound.file(sys.argv[2])
|
||||
sound3 = aud.Sound.file(sys.argv[3])
|
||||
sound4 = aud.Sound.file(sys.argv[4])
|
||||
list=aud.Sound.list(True)
|
||||
|
||||
list.addSound(sound1)
|
||||
list.addSound(sound2)
|
||||
list.addSound(sound3)
|
||||
list.addSound(sound4)
|
||||
mutable=aud.Sound.mutable(list)
|
||||
|
||||
device.lock()
|
||||
handle=device.play(mutable)
|
||||
handle.loop_count=2
|
||||
device.unlock()
|
||||
|
||||
time.sleep(500)
|
||||
7
blender-5.2.0/extern/audaspace/bindings/python/examples/simple.py
vendored
Normal file
7
blender-5.2.0/extern/audaspace/bindings/python/examples/simple.py
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import aud, time
|
||||
device = aud.Device()
|
||||
sine = aud.Sound.sine(440)
|
||||
square = sine.threshold()
|
||||
handle = device.play(square)
|
||||
time.sleep(3)
|
||||
19
blender-5.2.0/extern/audaspace/bindings/python/examples/siren.py
vendored
Normal file
19
blender-5.2.0/extern/audaspace/bindings/python/examples/siren.py
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/python
|
||||
import aud, math, time
|
||||
length = 0.5
|
||||
fadelength = 0.05
|
||||
|
||||
device = aud.Device()
|
||||
high = aud.Sound.sine(880).limit(0, length).fadein(0, fadelength).fadeout(length - fadelength, length)
|
||||
low = aud.Sound.sine(700).limit(0, length).fadein(0, fadelength).fadeout(length - fadelength, length).volume(0.6)
|
||||
sound = high.join(low)
|
||||
handle = device.play(sound)
|
||||
handle.loop_count = -1
|
||||
|
||||
start = time.time()
|
||||
|
||||
while time.time() - start < 10:
|
||||
angle = time.time() - start
|
||||
|
||||
handle.location = [math.sin(angle), 0, -math.cos(angle)]
|
||||
|
||||
23
blender-5.2.0/extern/audaspace/bindings/python/examples/siren2.py
vendored
Normal file
23
blender-5.2.0/extern/audaspace/bindings/python/examples/siren2.py
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/python
|
||||
import aud, math, time
|
||||
length = 0.5
|
||||
fadelength = 0.05
|
||||
runtime = 10
|
||||
distance = 100
|
||||
velocity = 2 * distance / runtime
|
||||
|
||||
device = aud.Device()
|
||||
high = aud.Sound.sine(880).limit(0, length).fadein(0, fadelength).fadeout(length - fadelength, length)
|
||||
low = aud.Sound.sine(700).limit(0, length).fadein(0, fadelength).fadeout(length - fadelength, length).volume(0.6)
|
||||
sound = high.join(low)
|
||||
handle = device.play(sound)
|
||||
handle.loop_count = -1
|
||||
|
||||
handle.velocity = [velocity, 0, 0]
|
||||
|
||||
start = time.time()
|
||||
|
||||
while time.time() - start < runtime:
|
||||
location = -distance + velocity * (time.time() - start)
|
||||
|
||||
handle.location = [location, 10, 0]
|
||||
66
blender-5.2.0/extern/audaspace/bindings/python/examples/tetris.py
vendored
Normal file
66
blender-5.2.0/extern/audaspace/bindings/python/examples/tetris.py
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/python
|
||||
import aud, math, time
|
||||
|
||||
def parseNotes(notes, bpm, basefreq, rate = 44100,
|
||||
notechars = "XXXCXDXEFXGXAXHcXdXefXgXaXhp"):
|
||||
pos = 0
|
||||
fadelength = 60/bpm/10
|
||||
halfchars = "#b"
|
||||
durationchars = "2345678"
|
||||
sound = None
|
||||
|
||||
while pos < len(notes):
|
||||
char = notes[pos]
|
||||
mod = None
|
||||
dur = 1
|
||||
pos += 1
|
||||
while pos < len(notes) and notes[pos] not in notechars:
|
||||
if notes[pos] in halfchars:
|
||||
mod = notes[pos]
|
||||
elif notes[pos] in durationchars:
|
||||
dur = notes[pos]
|
||||
pos += 1
|
||||
|
||||
freq = notechars.find(char)
|
||||
if mod == '#':
|
||||
freq += 1
|
||||
elif mod == 'b':
|
||||
freq -= 1
|
||||
|
||||
freq = math.pow(2, freq/12)*basefreq
|
||||
length = float(dur)*60/bpm
|
||||
|
||||
snd = aud.Sound.square(freq, rate)
|
||||
if char == 'p':
|
||||
snd = snd.volume(0)
|
||||
snd = snd.limit(0, length)
|
||||
snd = snd.fadein(0, fadelength)
|
||||
snd = snd.fadeout(length - fadelength, fadelength)
|
||||
|
||||
if sound:
|
||||
sound = sound.join(snd)
|
||||
else:
|
||||
sound = snd
|
||||
return sound
|
||||
|
||||
def tetris(bpm = 300, freq = 220, rate = 44100):
|
||||
notes = "e2Hcd2cH A2Ace2dc H3cd2e2 c2A2A4 pd2fa2gf e3ce2dc H2Hcd2e2 c2A2A2p2"
|
||||
s11 = parseNotes(notes, bpm, freq, rate)
|
||||
|
||||
notes = "e4c4 d4H4 c4A4 G#4p4 e4c4 d4H4 A2c2a4 g#4p4"
|
||||
s12 = parseNotes(notes, bpm, freq, rate)
|
||||
|
||||
notes = "EeEeEeEe AaAaAaAa AbabAbabAbabAbab AaAaAAHC DdDdDdDd CcCcCcCc HhHhHhHh AaAaA2p2"
|
||||
s21 = parseNotes(notes, bpm, freq, rate, notechars = "AXHCXDXEFXGXaXhcXdXefXgXp")
|
||||
|
||||
notes = "aeaeaeae g#dg#dg#dg#d aeaeaeae g#dg#dg#2p2 aeaeaeae g#dg#dg#dg#d aeaeaeae g#dg#dg#2p2"
|
||||
s22 = parseNotes(notes, bpm, freq/2, rate)
|
||||
|
||||
return s11.join(s12).join(s11).volume(0.5).mix(s21.join(s22).join(s21).volume(0.3))
|
||||
|
||||
if __name__ == "__main__":
|
||||
dev = aud.Device()
|
||||
handle = dev.play(tetris(300, 220, dev.rate))
|
||||
while handle.status:
|
||||
time.sleep(0.1)
|
||||
|
||||
64
blender-5.2.0/extern/audaspace/bindings/python/examples/tetris2.py
vendored
Normal file
64
blender-5.2.0/extern/audaspace/bindings/python/examples/tetris2.py
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/python
|
||||
import aud, math, time
|
||||
|
||||
def parseNotes(notes, bpm, basefreq, rate = 44100,
|
||||
notechars = "XXXCXDXEFXGXAXHcXdXefXgXaXhp"):
|
||||
pos = 0
|
||||
fadelength = 60/bpm/10
|
||||
halfchars = "#b"
|
||||
durationchars = "2345678"
|
||||
position = 0
|
||||
sequence = aud.Sequence()
|
||||
|
||||
while pos < len(notes):
|
||||
char = notes[pos]
|
||||
mod = None
|
||||
dur = 1
|
||||
pos += 1
|
||||
while pos < len(notes) and notes[pos] not in notechars:
|
||||
if notes[pos] in halfchars:
|
||||
mod = notes[pos]
|
||||
elif notes[pos] in durationchars:
|
||||
dur = notes[pos]
|
||||
pos += 1
|
||||
|
||||
freq = notechars.find(char)
|
||||
if mod == '#':
|
||||
freq += 1
|
||||
elif mod == 'b':
|
||||
freq -= 1
|
||||
|
||||
freq = math.pow(2, freq/12)*basefreq
|
||||
length = float(dur)*60/bpm
|
||||
|
||||
note = aud.Sound.square(freq, rate).fadein(0, fadelength).fadeout(length - fadelength, fadelength)
|
||||
|
||||
entry = sequence.add(note, position, position + length, 0)
|
||||
if char == 'p':
|
||||
entry.muted = True
|
||||
|
||||
position += length
|
||||
|
||||
return sequence.limit(0, position)
|
||||
|
||||
def tetris(bpm = 300, freq = 220, rate = 44100):
|
||||
notes = "e2Hcd2cH A2Ace2dc H3cd2e2 c2A2A4 pd2fa2gf e3ce2dc H2Hcd2e2 c2A2A2p2"
|
||||
s11 = parseNotes(notes, bpm, freq, rate)
|
||||
|
||||
notes = "e4c4 d4H4 c4A4 G#4p4 e4c4 d4H4 A2c2a4 g#4p4"
|
||||
s12 = parseNotes(notes, bpm, freq, rate)
|
||||
|
||||
notes = "EeEeEeEe AaAaAaAa AbabAbabAbabAbab AaAaAAHC DdDdDdDd CcCcCcCc HhHhHhHh AaAaA2p2"
|
||||
s21 = parseNotes(notes, bpm, freq, rate, notechars = "AXHCXDXEFXGXaXhcXdXefXgXp")
|
||||
|
||||
notes = "aeaeaeae g#dg#dg#dg#d aeaeaeae g#dg#dg#2p2 aeaeaeae g#dg#dg#dg#d aeaeaeae g#dg#dg#2p2"
|
||||
s22 = parseNotes(notes, bpm, freq/2, rate)
|
||||
|
||||
return s11.join(s12).join(s11).volume(0.5).mix(s21.join(s22).join(s21).volume(0.3))
|
||||
|
||||
if __name__ == "__main__":
|
||||
dev = aud.Device()
|
||||
handle = dev.play(tetris(300, 220, dev.rate))
|
||||
while handle.status:
|
||||
time.sleep(0.1)
|
||||
|
||||
63
blender-5.2.0/extern/audaspace/bindings/python/examples/tetris3.py
vendored
Normal file
63
blender-5.2.0/extern/audaspace/bindings/python/examples/tetris3.py
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/python
|
||||
import aud, math, time
|
||||
|
||||
def parseNotes(notes, bpm, basefreq, rate = 44100,
|
||||
notechars = "XXXCXDXEFXGXAXHcXdXefXgXaXhp"):
|
||||
pos = 0
|
||||
fadelength = 60/bpm/10
|
||||
halfchars = "#b"
|
||||
durationchars = "2345678"
|
||||
position = 0
|
||||
sequence = aud.Sequence()
|
||||
|
||||
while pos < len(notes):
|
||||
char = notes[pos]
|
||||
mod = None
|
||||
dur = 1
|
||||
pos += 1
|
||||
while pos < len(notes) and notes[pos] not in notechars:
|
||||
if notes[pos] in halfchars:
|
||||
mod = notes[pos]
|
||||
elif notes[pos] in durationchars:
|
||||
dur = notes[pos]
|
||||
pos += 1
|
||||
|
||||
freq = notechars.find(char)
|
||||
if mod == '#':
|
||||
freq += 1
|
||||
elif mod == 'b':
|
||||
freq -= 1
|
||||
|
||||
freq = math.pow(2, freq/12)*basefreq
|
||||
length = float(dur)*60/bpm
|
||||
|
||||
if char != 'p':
|
||||
note = aud.Sound.square(freq, rate).fadein(0, fadelength).fadeout(length - fadelength, fadelength)
|
||||
|
||||
sequence.add(note, position, position + length, 0)
|
||||
|
||||
position += length
|
||||
|
||||
return sequence.limit(0, position)
|
||||
|
||||
def tetris(bpm = 300, freq = 220, rate = 44100):
|
||||
notes = "e2Hcd2cH A2Ace2dc H3cd2e2 c2A2A4 pd2fa2gf e3ce2dc H2Hcd2e2 c2A2A2p2"
|
||||
s11 = parseNotes(notes, bpm, freq, rate)
|
||||
|
||||
notes = "e4c4 d4H4 c4A4 G#4p4 e4c4 d4H4 A2c2a4 g#4p4"
|
||||
s12 = parseNotes(notes, bpm, freq, rate)
|
||||
|
||||
notes = "EeEeEeEe AaAaAaAa AbabAbabAbabAbab AaAaAAHC DdDdDdDd CcCcCcCc HhHhHhHh AaAaA2p2"
|
||||
s21 = parseNotes(notes, bpm, freq, rate, notechars = "AXHCXDXEFXGXaXhcXdXefXgXp")
|
||||
|
||||
notes = "aeaeaeae g#dg#dg#dg#d aeaeaeae g#dg#dg#2p2 aeaeaeae g#dg#dg#dg#d aeaeaeae g#dg#dg#2p2"
|
||||
s22 = parseNotes(notes, bpm, freq/2, rate)
|
||||
|
||||
return s11.join(s12).join(s11).volume(0.5).mix(s21.join(s22).join(s21).volume(0.3))
|
||||
|
||||
if __name__ == "__main__":
|
||||
dev = aud.Device()
|
||||
handle = dev.play(tetris(300, 220, dev.rate))
|
||||
while handle.status:
|
||||
time.sleep(0.1)
|
||||
|
||||
Reference in New Issue
Block a user