luaplayer.org
September 08, 2010, 03:26:57 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: IMPORTANT: Please read the following post http://luaplayer.org/forums/index.php?topic=693
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Sound Wave generation  (Read 169 times)
emcp
Sr. Member
****
Posts: 479



View Profile
« on: March 03, 2010, 04:26:26 PM »

How much change to pge source
would be required inorder for me to be capable of creating dynamic in-game music

Basically, im going to have several 'sine' waves, at different frequencies etc, use superposition and then pass it to the speakers

thanks
Logged
Criptych
Global Moderator
Hero Member
*****
Posts: 692


Why, oh why, didn't I take the blue pill?


View Profile WWW
« Reply #1 on: March 03, 2010, 07:20:29 PM »

What about creating your waveforms as strings and using pge.wav.loadmemory?  (Don't forget to add a RIFF header, too.)  Not sure how well this would perform in real-time, but generating sounds ahead-of-time shouldn't be too bad.

Alternatively, if your music only uses a limited range of sounds, you could store each one as a WAV file and just play them at the appropriate time and pitch, kind of like a synthesizer.  For example, you could play a simple tune with just one "piano key" sound, by changing the pitch across a full octave.
Logged

I used to be a schizophrenic - but we're okay now.
FFN Browser | Nanotank! PSP | Google Maps PSP
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.9 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!