Playing sound files
Moderator: Moderator
Playing sound files
DarkGod, you said before that you can get a file to play at different pitches by calling on a lua sound file for the game with certain settings. Would you mind explaining that thoroughly? I'd like to play about with this a lot.
Re: Playing sound files
DGrey, instead of playing the sound as such:
do it instead as:
Note that the sound file is specified as a table, not a string. I think "pitch" is a scale value, such as if the initial sound was middle C, 2.0 would be an octave higher, and 0.5 would cause it to be an octave lower.
If you want to play one of many sound files randomly (such as "many_sounds5", "many_sounds6", "many_sounds7"), you can do:
OpenAL offers more ways to tweak sounds, and I'm sure extra functionality could be added to t-engine if you request it.
Code: Select all
game:playSound("the_sound_name")
Code: Select all
game:playSound({"the_sound_name", pitch=1, vol=0.5})
If you want to play one of many sound files randomly (such as "many_sounds5", "many_sounds6", "many_sounds7"), you can do:
Code: Select all
game:playSound({"many_sounds%d", 5, 7, pitch=1, vol=0.5})
darkgod wrote:OMFG tiger eye you are my hero!
Re: Playing sound files
Thanks, tiger_eye! Got this implemented in Mosaic now and it sounds way better :D
Re: Playing sound files
What about echo and reverb? Do you think those could be implemented in-engine?tiger_eye wrote: OpenAL offers more ways to tweak sounds, and I'm sure extra functionality could be added to t-engine if you request it.