BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

Audio.getDetune()

Audio.getDetune()three.jsAudio 类的一个函数,用于获取音频文件的音调偏移量。

语法

audio.getDetune();

返回值

getDetune() 函数返回一个数字,表示音调偏移量,当该值为正数时,表示音调整高,为负数时表示音调降低。

示例

const listener = new THREE.AudioListener();
const audio = new THREE.Audio(listener);

const loader = new THREE.AudioLoader();
loader.load('myAudio.mp3', function(buffer) {
  audio.setBuffer(buffer);
  audio.play();
});

console.log(audio.getDetune()); // 输出 0

备注

默认情况下,getDetune() 函数返回 0,也就是说音频文件没有进行音调的偏移。

音调偏移可以通过设置 Audio 实例的 detune 属性来实现,例如:

audio.detune.value = 100;

此时,调用 audio.getDetune() 的返回值就为 100,表示将音调整高了 100 个半音。