Module Sound :: Class Sound

Class Sound

source code

The Sound object

This object gives access to Sounds in Blender.

Instance Methods
string
getName()
Get the name of this Sound object.
source code
string
getFilename()
Get the filename of the sound file loaded into this Sound object.
source code
None
setName()
Set the name of this Sound object.
source code
None
setFilename()
Set the filename of the sound file loaded into this Sound object.
source code
 
setCurrent()
Make this the active sound in the sound buttons window (also redraws).
source code
 
play()
Play this sound.
source code
 
getVolume()
Get this sound's volume.
source code
 
setVolume(f)
Set this sound's volume.
source code
 
getAttenuation()
Get this sound's attenuation value.
source code
 
setAttenuation(f)
Set this sound's attenuation.
source code
 
getPitch()
Get this sound's pitch value.
source code
 
setPitch(f)
Set this sound's pitch.
source code
none
pack()
Packs the sound into the current blend file.
source code
none
unpack(mode)
Unpacks the sound to the samples filename.
source code
Instance Variables
bool fakeUser
When set to True, this datablock wont be removed, even if nothing is using it.
  filename
The filename (path) to the sound file loaded into this Sound
string or None lib
path to the blend file this datablock is stored in (readonly).
string name
unique name within each blend file.
  packed
Boolean, True when the sample is packed (readonly).
IDGroup properties
Returns an IDGroup reference to this datablocks's ID Properties.
bool tag
A temporary tag that to flag data as being used within a loop.
int users
The number of users this datablock has.
Method Details

getVolume()

source code 
Get this sound's volume. rtype: float

setVolume(f)

source code 
Set this sound's volume.
Parameters:
  • f (float) - the new volume value in the range [0.0, 1.0].

getAttenuation()

source code 
Get this sound's attenuation value. rtype: float

setAttenuation(f)

source code 
Set this sound's attenuation.
Parameters:
  • f (float) - the new attenuation value in the range [0.0, 5.0].

getPitch()

source code 
Get this sound's pitch value. rtype: float

setPitch(f)

source code 
Set this sound's pitch.
Parameters:
  • f (float) - the new pitch value in the range [-12.0, 12.0].

pack()

source code 
Packs the sound into the current blend file.
Returns: none
nothing

Note: An error will be raised if the sound is already packed or the filename path does not exist.

unpack(mode)

source code 
Unpacks the sound to the samples filename.
Parameters:
  • mode (int) - One of the values in Blender.Unpackmodes dict.
Returns: none
nothing

Note: An error will be raised if the sound is not packed or the filename path does not exist.


Instance Variable Details

fakeUser

When set to True, this datablock wont be removed, even if nothing is using it. All data has this disabled by default except for Actions.
Type:
bool

lib

path to the blend file this datablock is stored in (readonly).

lib will be None unless you are using external blend files with (File, Append/Link)

Note: the path may be relative, to get the full path use Blender.sys.expandpath
Type:
string or None

name

unique name within each blend file.

The name is case sensitive and 21 characters maximum length.

Note: a blend file may have naming collisions when external library data is used, be sure to check the value of lib.

Note: Setting a value longer then 21 characters will be shortened
Type:
string

tag

A temporary tag that to flag data as being used within a loop. always set all tags to True or False before using since blender uses this flag for its own internal operations.
Type:
bool

users

The number of users this datablock has. (readonly) Zero user datablocks are de-allocated after reloading and saving.
Type:
int