Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: Elliott Lee Newsgroups: scee.yaroze.programming.sound Subject: Re: never-ending sound with SsUtKeyOn Date: Tue, 03 Mar 1998 10:31:29 -0800 Organization: . Lines: 68 Message-ID: <34FC4C81.C99331E3@netmagic.net> References: <34FB4BA9.41C6@bournemouth.ac.uk> Reply-To: tenchi@netmagic.net NNTP-Posting-Host: dhcp-e-39-245.cisco.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.03 [en] (Win95; U) Anna wrote: > > After finally managing to coax some sound outta me Yaroze, I'm now > having problems using it. Basically, I have one sound effect, a "ping" > noise which happens when the player collides with objects. Now, if I > set that off with SsUtKeyOn when the player's object detects collision, > then i get a never ending noise which is never switched off again. Which means one of three things: 1) your waveform editor put in a sample loop so a section of it repeats. Solution: check to make sure that there are no loop points. 2) when you converted the waveform to VAG, it was encoded with loops. Solution: there is a command-line option to force no looping. (Run aiff2vag without options to get the listing.) 3) your collision detection routines repeatedly trigger the sound. Solution: check your code. :) (This doesn't sound like the case, tho.) > However, if I put SsUtKeyOff in, it switches the sound off as soon as it > goes on, so the result is no noise. I know that both SsUtKeyOn and > SsUtKeyOff are working, cos they're returning valid values. > > So my question is: When should I use SsUtKeyOff? Is there some kind of You should use SsUtKeyOff() when you want the sound to be stopped. If you key on and then immediately key off, then chances are the sound never reached its full attack volume (the fist node in the ADSR graph). And, if you set the decay rate fairly high, then when the note is keyed off it almost immediately stops. The easiest way to resolve this is probably to make sure your sound has no loops and then you'll never have to worry about keying off. The other way is to have some kind of sound effects array which holds counters for each voice you key on. After some delay, then you key off the voice. (On a side note: this is what I was planning to do in writing a MOD player, but MOD->MIDI converter may be the way to go instead.) Another way of solving this is (if your sample has loops) put in a decay value which smoothly drops the amplitude from its sustain level to 0. This will make it key off after a while. > way of doing a sound sync, in the same way that Vsync does screen > drawing? I basically just want the noise to last as long as the sample > "ping" it comes from. Do the vag files contain infomation about the > length of a sound? Yes, but it's automatically calculated for you. When you create your VAB, you have that DEF file, aye? Do this after you create it: mkvab -r MyVab.vab -o debug.def Look at DEBUG.DEF. You'll note that some of the field values have changed and there is a section at the very end that's appended. They should be the exact sizes of your VAGs in the order that you specified them. > Cheers, Anna. - e! tenchi@netmagic.net http://www.netmagic.net/~tenchi/yaroze/