Module Sound
[hide private]
[frames] | no frames]

Source Code for Module Sound

  1  # Blender.Sound module and the Sound PyType object 
  2   
  3  """ 
  4  The Blender.Sound submodule. 
  5   
  6  Sound 
  7  ===== 
  8   
  9  This module provides access to B{Sound} objects in Blender. 
 10   
 11  Example:: 
 12          import Blender 
 13          from Blender import Sound 
 14          # 
 15          sound = Sound.Load("/path/to/my/sound.wav")    # load a sound file 
 16          print "Sound from", sound.filename, 
 17          print "loaded to obj", sound.name 
 18          print "All Sounds available now:", Sound.Get() 
 19   
 20  No way to get the actual audio data is provided by this library, 
 21  but it is included in the Python standard library (module audioop). 
 22  Note that using that module requires a full/normal Python installation. 
 23  """ 
 24   
25 -def Load (filename):
26 """ 27 Load the sound called 'filename' into a Sound object. 28 @type filename: string 29 @param filename: The full path to the sound file. 30 @rtype: Blender Sound 31 @return: A Blender Sound object with the data from I{filename}. 32 """
33
34 -def Get (name = None):
35 """ 36 Get the Sound object(s) from Blender. 37 @type name: string 38 @param name: The name of the Sound object. 39 @rtype: Blender Sound or a list of Blender Sounds 40 @return: It depends on the I{name} parameter: 41 - (name): The Sound object called I{name}, None if not found; 42 - (): A list with all Sound objects in the current scene. 43 """
44 45
46 -class Sound:
47 """ 48 The Sound object 49 ================ 50 This object gives access to Sounds in Blender. 51 @ivar filename: The filename (path) to the sound file loaded into this Sound 52 @ivar packed: Boolean, True when the sample is packed (readonly). 53 """ 54
55 - def getName():
56 """ 57 Get the name of this Sound object. 58 @rtype: string 59 """
60
61 - def getFilename():
62 """ 63 Get the filename of the sound file loaded into this Sound object. 64 @rtype: string 65 """
66
67 - def setName():
68 """ 69 Set the name of this Sound object. 70 @rtype: None 71 """
72
73 - def setFilename():
74 """ 75 Set the filename of the sound file loaded into this Sound object. 76 @rtype: None 77 """
78
79 - def setCurrent():
80 """ 81 Make this the active sound in the sound buttons window (also redraws). 82 """
83
84 - def play():
85 """ 86 Play this sound. 87 """
88
89 - def getVolume():
90 """ 91 Get this sound's volume. 92 rtype: float 93 """
94
95 - def setVolume(f):
96 """ 97 Set this sound's volume. 98 @type f: float 99 @param f: the new volume value in the range [0.0, 1.0]. 100 """
101
102 - def getAttenuation():
103 """ 104 Get this sound's attenuation value. 105 rtype: float 106 """
107
108 - def setAttenuation(f):
109 """ 110 Set this sound's attenuation. 111 @type f: float 112 @param f: the new attenuation value in the range [0.0, 5.0]. 113 """
114
115 - def getPitch():
116 """ 117 Get this sound's pitch value. 118 rtype: float 119 """
120
121 - def setPitch(f):
122 """ 123 Set this sound's pitch. 124 @type f: float 125 @param f: the new pitch value in the range [-12.0, 12.0]. 126 """
127
128 - def pack():
129 """ 130 Packs the sound into the current blend file. 131 @note: An error will be raised if the sound is already packed or the filename path does not exist. 132 @returns: nothing 133 @rtype: none 134 """
135
136 - def unpack(mode):
137 """ 138 Unpacks the sound to the samples filename. 139 @param mode: One of the values in Blender.Unpackmodes dict. 140 @note: An error will be raised if the sound is not packed or the filename path does not exist. 141 @returns: nothing 142 @rtype: none 143 @type mode: int 144 """
145 146 import id_generics 147 Sound.__doc__ += id_generics.attributes 148