Author Topic: Looping WAV sounds  (Read 9517 times)

0 Members and 2 Guests are viewing this topic.

Offline gumby

Looping WAV sounds
« on: May 27, 2012, 03:11:24 PM »
This doesn't seem to work.  When using the STD.DRV the sound loops just fine, but when I switch over to SNDBLAST.DRV to enable the appended digital sounds it only plays once.

Here's my code (straight from the template game)
Code: [Select]
(send gTheMusic:
prevSignal(0)
stop()
number(2)
loop(-1)
play()


Anyone have any ideas?


In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline gumby

Re: Looping WAV sounds
« Reply #1 on: May 27, 2012, 03:59:03 PM »
Here's a workaround, just put the sound call in a doit().  Don't tell the sound resource to loop, the looping is handled by the doit.

Code: [Select]
   (method (doit)
      (if( == (send gTheMusic:state()) 0
        or == (send gTheMusic:state()) 1 )
     
         (send gTheMusic:
prevSignal(0)
stop()
number(2)
play()
         )
      )
   )
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Collector

Re: Looping WAV sounds
« Reply #2 on: May 28, 2012, 12:59:58 AM »
How about a little one room demo scene?
KQII Remake Pic

Offline Cloudee1

Re: Looping WAV sounds
« Reply #3 on: May 28, 2012, 01:09:19 AM »
Are you using a sound of your own or one from the template?
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline gumby

Re: Looping WAV sounds
« Reply #4 on: May 28, 2012, 01:43:23 AM »
I'm using a sound I created myself.  Started with Anvil & exported the midi, then imported it into Soundbox and saved it, creating an 'empty' snd resource.  Then I ran AddWav to append the wave resource.  I'll try using a template sound & see what happens.

I'll see what I can do about putting a demo together.
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Collector

Re: Looping WAV sounds
« Reply #5 on: May 28, 2012, 02:50:52 AM »
I am assuming that we won't be able to play two SOUND resources at the same time, in other words we can't play a separate MIDI SOUND resource and one with an embedded wav at the same time.
KQII Remake Pic

Offline gumby

Re: Looping WAV sounds
« Reply #6 on: May 28, 2012, 08:42:56 AM »
True, we cannot have two sounds at the same time.  Here's a related thread on how to prevent one sound from clobbering another:

http://sciprogramming.com/community/index.php/topic,308.0.html

Appending one of the example sounds from the template game has the same behavior as a sound that I create from scratch, no looping.  Another bad side effect in performing our own sound looping is that it stops when you are interacting with the parser.
« Last Edit: May 28, 2012, 09:11:12 AM by gumby »
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline gumby

Re: Looping WAV sounds
« Reply #7 on: June 02, 2012, 06:43:38 PM »
I extracted several digital sounds from SQ3 & attempted to loop them in a test game & they won't obey the loop command either.  So at it's not a problem with the sound resoures I created with the AddWav utility.
« Last Edit: June 02, 2012, 06:47:21 PM by gumby »
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Doan Sephim

Re: Looping WAV sounds
« Reply #8 on: June 03, 2012, 01:52:55 PM »
I have had a similar problem, but I think I got it to work. When I create something in anvil, I often put a small rest at the very beginning, that way when I set the loop point I can choose the point right before the sound starts. I have had no looping problems when I did that, and it didn't require the doit method work around.

The only annoyance is that you have to manually listen to the whole track in soundbox and try and error till you find the perfect loop point.

Offline gumby

Re: Looping WAV sounds
« Reply #9 on: June 03, 2012, 07:00:11 PM »
Doan - this works with WAV files?  Sounds like you might be referring to looping midi sounds, since you are referring to Anvil.

How do you set the loop point (or were you just referring to the process of modifying the sound at point which made the looping sound acceptable)?

EDIT:  Okay, I found out how to set loop points in Soundbox, but the WAV doesn't seem to use them.  How are loop points used anyway?  The only example I've seen of looping is an entire loop of the sound by using:
Code: [Select]
  loop(-1)
« Last Edit: June 03, 2012, 09:10:46 PM by gumby »
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Doan Sephim

Re: Looping WAV sounds
« Reply #10 on: June 09, 2012, 01:36:51 PM »
Doan - this works with WAV files?  Sounds like you might be referring to looping midi sounds, since you are referring to Anvil.

EDIT:  Okay, I found out how to set loop points in Soundbox, but the WAV doesn't seem to use them.  How are loop points used anyway?  The only example I've seen of looping is an entire loop of the sound by using:
Code: [Select]
  loop(-1)
Oops. My mistake. I was talking about midis made with Anvil, not WAVs. The loop(-1) is all I know how to do also...


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.027 seconds with 22 queries.