Difference between revisions of "Lua:playSound"

From Cheat Engine
Jump to navigation Jump to search
(Created page with ''''function''' playSound(''stream'', ''waittilldone'') '''function''' playSound(''tablefile'', ''waittilldone'') Plays a sound file ===Function Parameters=== {|width="85%" cell…')
(mention speak command)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[Category:Lua]]
 
'''function''' playSound(''stream'', ''waittilldone'')
 
'''function''' playSound(''stream'', ''waittilldone'')
 +
 
'''function''' playSound(''tablefile'', ''waittilldone'')
 
'''function''' playSound(''tablefile'', ''waittilldone'')
  
Line 42: Line 44:
 
</pre>
 
</pre>
  
== See also ==
+
===Creating Files===
* [[findTableFile]]
+
I am unsure of the formats supported, but using [http://audacityteam.org/ Audacity]
* [[Stream]]
+
worked for me.  I recorded my microphone and selected just the portion I wanted, then
* [[FileStream]]
+
used "File->Export Selected Audio" to export it as 'WAV (Microsoft) signed 16-bit PCM'.
* [[MemoryStream]]
+
 
 +
You can use a free online text-to-speech wav file generator at http://www.text2speech.org/ or use [[Lua:speak]]
 +
 
 +
{{LuaSeeAlso}}
 +
 
 +
=== Related Functions ===
 +
* [[Lua:findTableFile|findTableFile]]
 +
 
 +
=== Related Classes ===
 +
* [[Lua:Class:Stream|Stream]]
 +
* [[Lua:Class:FileStream|FileStream]]
 +
* [[Lua:Class:MemoryStream|MemoryStream]]

Latest revision as of 17:35, 1 May 2018

function playSound(stream, waittilldone)

function playSound(tablefile, waittilldone)

Plays a sound file

Function Parameters[edit]

Parameter Type Description
stream Stream A Stream object, can be MemoryStream or FileStream
tablefile TableFile A TableFile object, a file added and stored in the cheat table
waittilldone Boolean If true, the next LUA instruction will not execute until the sound is done playing

Samples[edit]

Calling from LUA

playSound(findTableFile('protected.wav'))

Calling from an AA Script:

[enable]
luacall(playSound(findTableFile('protected.wav')))
globals+1034:
  dd 1

[disable]
luacall(playSound(findTableFile('cleared.wav')))
globals+1034:
  dd 2

Creating Files[edit]

I am unsure of the formats supported, but using Audacity worked for me. I recorded my microphone and selected just the portion I wanted, then used "File->Export Selected Audio" to export it as 'WAV (Microsoft) signed 16-bit PCM'.

You can use a free online text-to-speech wav file generator at http://www.text2speech.org/ or use Lua:speak

See also[edit]

Related Functions[edit]

Related Classes[edit]