GetSoundWaveData: Difference between revisions
Jump to navigation
Jump to search
(More senseble example) |
mNo edit summary |
||
Line 15: | Line 15: | ||
===Returns=== | ===Returns=== | ||
Returns a [[table]] of '''iSamples''' | Returns a [[table]] of '''iSamples''' ''floats'' representing the current audio frame waveform. | ||
Returns ''false'' if the sound is not playing yet or hasn't buffered in the | Returns ''false'' if the sound is not playing yet or hasn't buffered in the | ||
case of streams. | case of streams. |
Revision as of 18:22, 10 July 2018
This function gets the wave form data for an audio stream which is a table of floats representing the current audio frame as a wave. This allows things like visualisations.
If the element is a player, this function will use the players voice.
Syntax
table getSoundWaveData ( element sound, int iSamples )
OOP Syntax Help! I don't understand this!
- Method: sound:getWaveData(...)
Required Arguments
- sound: a sound element that is created using playSound or playSound3D. Streams are also supported
- iSamples: allowed samples are 256, 512, 1024, 2048, 4096, 8192 and 16384.
Returns
Returns a table of iSamples floats representing the current audio frame waveform. Returns false if the sound is not playing yet or hasn't buffered in the case of streams.
Example
Click to collapse [-]
ClientsoundHandler = playSound ( "sound.wav" ) function onSoundPlayRender ( ) if ( soundHandler ) then local waveData = getSoundWaveData ( soundHandler, 256 ) if ( waveData ) then for i=0,255 do dxDrawRectangle ( i, 128, 1, waveData[i] * 256) end end end end addEventHandler ( "onClientRender", getRootElement(), onSoundPlayRender )
Changelog
Version | Description |
---|
1.3.2 | Added player element to use a players voice |
See Also
- getRadioChannel
- getRadioChannelName
- getSFXStatus
- getSoundBPM
- getSoundBufferLength
- getSoundEffectParameters
- getSoundEffects
- getSoundFFTData
- getSoundLength
- getSoundLevelData
- getSoundMaxDistance
- getSoundMetaTags
- getSoundMinDistance
- getSoundPan
- getSoundPosition
- getSoundProperties
- getSoundSpeed
- getSoundVolume
- getSoundWaveData
- isSoundLooped
- isSoundPanningEnabled
- isSoundPaused
- playSFX3D
- playSFX
- playSound3D
- playSound
- setRadioChannel
- setSoundEffectEnabled
- setSoundEffectParameter
- setSoundLooped
- setSoundMaxDistance
- setSoundMinDistance
- setSoundPan
- setSoundPanningEnabled
- setSoundPaused
- setSoundPosition
- setSoundProperties
- setSoundSpeed
- setSoundVolume
- stopSound
- Shared
- playSoundFrontEnd