From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

General improvements

The results of this milestone are mainly internal and mostly not visible to the user, but are required for the project, I'll try to show what changed from a user point of view here:

Memory improvements

There have been issues with memory management regarding the responsibility for freeing resources when python gets in the game. These have been addressed and now it's possible to access internal sounds via the python API and also access the sounds of sound actuators in the Blender Game Engine!

Example:

f = bpy.data.sounds[1].factory
 
for i in range(1, 11):
  aud.device().play(f)

Dynamic Parameters

The two important parameters channels and samplerate have been made dynamically changable during runtime. Previously those settings were fixed for the sequencer to 44.1 kHz stereo audio, so even if you exported at a higher sampling rate the quality was like 44.1 kHz maximum. Now that's different, you get the quality of the sampling rate you choose and you can set the channel count when outputting. Another thing that works now thanks to these changes is the pitch setting with SDL and Jack in the Blender Game Engine for Sound Actuators, this previously only worked for OpenAL (which is the standard output device, so you might haven't noticed).

Speed improvements

The library gained some speed via an essential architectural change. There's one use case where the change is disadvantageous but the difference is not important. I did some testing to prove the improvements, here are the results. Values are in milliseconds.

Playback of a synthesised sound

import tetris, aud
 
for i in range(1, 11):
  tetris.play()
New Old Improvement
631 641 10
635 645 10
632 645 13
633 646 13
637 652 15
639 652 13
637 650 13
635 649 14
654 651 -3
633 652 19

Results: Standard Deviation: 5.75; Expected Value: 11.7; Median: 13

Streaming a file

New:

f = bpy.data.sounds[1].factory
 
for i in range(1, 11):
  aud.device().play(f)

Old:

f = aud.Factory.file('../tests/sound/pink_panther.ogg')
 
for i in range(1, 11):
  aud.device().play(f)
New Old Improvement
350 356 6
351 357 6
351 357 6
352 357 5
351 362 11
350 359 9
351 360 9
350 358 8
362 360 -2
350 365 15

Results: Standard Deviation: 4.42; Expected Value: 7.3; Median: 7

Playback of a memory buffered sound

f = f.buffer()
 
for i in range(1, 11):
  aud.device().play(f)
New Old Improvement
6 1 -5
5 0 -5
5 0 -5
5 0 -5
5 1 -4
5 0 -5
5 0 -5
5 0 -5
6 0 -6
6 0 -6

Results: Standard Deviation: 0.57; Expected Value: -5.1; Median: -5

Other

Severall small things and bug fixes have been made, that most likely won't be noticed by users, like improved streaming for example.