Blender very rarely (if at all) instances from class.
Rather than add a new object with ob = bpy.types.Object("blah")
the blender way is to use the new
method, or for images and sounds the load
method of its data collection. eg bpy.data.objects.new("name", data)
or bpy.data.sounds.load(filepath)
To load a new sound
snd = bpy.data.sounds.load("/path/to/soundfile")
python console, add a speaker and add sound.
>>> D.speakers.new(
new()
BlendDataSpeakers.new(name)
Add a new speaker to the main database
>>> D.speakers.new("xxx")
bpy.data.speakers['xxx']
>>> D.speakers['xxx'].sound = D.sounds.load(
load()
BlendDataSounds.load(filepath, check_existing=False)
Add a new sound to the main database from a file
>>> D.speakers['xxx'].sound = D.sounds.load("/tmp/xxx.mp3")
>>> speaker_obj = bpy.data.objects.new("speaker", D.speakers['xxx'])
Link to scene in 2.79 and prior
>>> C.scene.objects.link(speaker_obj)
Alternatively with the operator, Add a new speaker object to the scene
bpy.ops.object.speaker_add(view_align=False, enter_editmode=False, location=(0, 0, 0), rotation=(0, 0, 0))
speaker_obj = context.object