Difference between revisions of "Source:setPitch"
(Added example) |
|||
Line 9: | Line 9: | ||
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
+ | == Examples == | ||
+ | <source lang="lua"> | ||
+ | function love.load() | ||
+ | sound = love.audio.newSource("sound.wav") | ||
+ | |||
+ | sound:setPitch(0.5) -- One octave lower | ||
+ | sound:setPitch(2) -- One octave higher | ||
+ | sound:setPitch(1) -- Reset to normal pitch | ||
+ | end | ||
+ | </source> | ||
== See Also == | == See Also == | ||
* [[parent::Source]] | * [[parent::Source]] |
Revision as of 16:01, 3 November 2016
Sets the pitch of the Source.
Function
Synopsis
Source:setPitch( pitch )
Arguments
number pitch
- Calculated with regard to 1 being the base pitch. Each reduction by 50 percent equals a pitch shift of -12 semitones (one octave reduction). Each doubling equals a pitch shift of 12 semitones (one octave increase). Zero is not a legal value.
Returns
Nothing.
Examples
function love.load()
sound = love.audio.newSource("sound.wav")
sound:setPitch(0.5) -- One octave lower
sound:setPitch(2) -- One octave higher
sound:setPitch(1) -- Reset to normal pitch
end
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info