Jump to content

Photo

RMT : Interrupt the music to play a sound effect

Raster music tracker rmt sound effect play

13 replies to this topic

#1 snicklin OFFLINE  

snicklin

    River Patroller

  • 2,193 posts
  • Location:Australia

Posted Mon Feb 9, 2015 7:49 PM

I am looking to add some sound effects into my game and was wondering how to handle it?

 

I have music already playing in the background and I would like to temporarily pause the music, play the sound effect once and then continue the music where it left off.

 

How do I do this with RMT? Do I need the sound effects somehow encoded into the RMT file with the music? Or can I load two files (one for music, one for effects) and then just point at which one I want?

 

Has anyone done this before? I guess it must have been...



#2 Rybags OFFLINE  

Rybags

    Gridrunner

  • 16,029 posts
  • Location:Australia

Posted Mon Feb 9, 2015 9:01 PM

It's been a while, but...

 

IIRC there's a seperate call you can do to RMT to playback pre-defined effects.  I'm not sure if you have to do your tune with less voices to begin with or if it just overrides given voice.

 

Alternatively you could just suspend your calls to playback, silence all voices and play your effect, then resume playback calls.

Alternately #2 you could alter the RMT playback routine, remove the end part where it stores to Pokey registers from the shadows.

Do that part yourself - if you have effects that need playing then they'll just override what RMT was going to do for that voice.

 

Note of course that there's potential for trouble there if you use a voice that's needed for multi-voice effects like 16-bit, filtered, saw/triangle etc.



#3 Xuel OFFLINE  

Xuel

    Dragonstomper

  • 740 posts
  • Location:US

Posted Mon Feb 9, 2015 9:47 PM

Example executable from rmt128:
 
Attached File  sfx.xex   2.07KB   132 downloads
 
Look in the asm_src/sfx directory of the rmt128.zip package (website) to see an example of playing a song and sound effects simultaneously.  No need to stop the music unless you really want to. Just call set RMTSFXVOLUME to the volume you want the effect played at, and call RASTERMUSICTRACKER+15 with the following parameters:
 
  A=note(0,..,60),X=channel(0,..,3 or 0,..,7),Y=instrument*2(0,2,4,..,126)
 
Create your sound effects as instruments in RMT. The sound effect will override the song's instruments for the given channel.

You can use a similar technique with TMC2 and CMC. Just create instruments for the effects and use the play-instrument interface to play them when desired while the music continues in the background.

#4 snicklin OFFLINE  

snicklin

    River Patroller

  • Topic Starter
  • 2,193 posts
  • Location:Australia

Posted Mon Feb 9, 2015 11:18 PM

Thank you both gentlemen for your input here.

 

Thanks to yourselves I am now able to play sound effects from within my code.

 

Now I have a couple more questions which lead off from here....

 

a) My music is currently overpowering the sound effects. I could lower the volume in RMT itself and save the file or I could lower it while the sound effects play and then increase the volume afterwards (perhaps faded back up). Is there a location that I can poke to amend the volume of the main music? I have the sfx at full volume.

 

b) I guess the answer to the following is "no" but I'll try anyhow. Is there a command line interface in any way so that I can import instruments into a .rmt file without doing it via the GUI? This isn't crucial but a nice to have for my build system.



#5 Rybags OFFLINE  

Rybags

    Gridrunner

  • 16,029 posts
  • Location:Australia

Posted Mon Feb 9, 2015 11:25 PM

I think you need to select certain options within the RMT created source file before assembling to enable volume control.  I suspect that global volume control though would also affect your sfx which makes it not useful in your case.

What's probably needed is to redefine the other instruments such that they're quieter.  Or maybe go the way of modifying the RMT routine such that it only maintains the Pokey shadows, then have your own routine that attenuates the volume if required when your sfx are active.  To do that you'd probably want some translation tables which alter each volume value, or maybe just use bitshift to divide by 2.

 

The way I'd go about it is probably just redefine instruments so they're quieter, e.g. nothing peaking above volume level 10, then have your effects at a higher peak to make them stand out more.



#6 snicklin OFFLINE  

snicklin

    River Patroller

  • Topic Starter
  • 2,193 posts
  • Location:Australia

Posted Mon Feb 9, 2015 11:42 PM

Yes, I've been looking through the defines for compiling the code for lower volume in the music but I couldn't find a control to be able to do that. However, I believe that I have probably just not spotted it. I'll keep on looking.

 

I'm kind of loathed to going in and changing the volumes of instruments and the song itself because I would like to use songs supplied by Miker (as-is with how they are supplied). And I want to leave myself open to the option of having lots of different songs (I currently have 2) depending on disk space. I don't want to change all instruments in all songs if I can help it. I'd rather run them through code which limits volume instead.

 

I could do that though if there is no other option. Thanks for your valuable input once more.



#7 MaPa OFFLINE  

MaPa

    Dragonstomper

  • 961 posts
  • Location:Czech Republic

Posted Tue Feb 10, 2015 2:24 AM

The RMT player source v 1.28 contains variables/labels named RMTGLOBALVOLUMEFADE and RMTSFXVOLUME so try use these.



#8 snicklin OFFLINE  

snicklin

    River Patroller

  • Topic Starter
  • 2,193 posts
  • Location:Australia

Posted Tue Feb 10, 2015 2:31 AM

I've got RMTGLOBALVOLUMEFADE set to 224 to try and keep the music low in volume but it doesn't seem to have made an effect. I also question that because it has the word "global" in it, will it also make the sound effects quieter?

 

I've got the RMTSFXVOLUME set to the highest volume so that they stand out above the game music.

 

Thanks for your input. I can confirm that I am using 1.28 by the way.



#9 Creature XL OFFLINE  

Creature XL

    Dragonstomper

  • 904 posts
  • Location:Hannover.De

Posted Tue Feb 10, 2015 3:41 AM


I'm kind of loathed to going in and changing the volumes of instruments and the song itself because I would like to use songs supplied by Miker (as-is with how they are supplied). And I want to leave myself open to the option of having lots of different songs (I currently have 2) depending on disk space. I don't want to change all instruments in all songs if I can help it. I'd rather run them through code which limits volume instead.

 

Ah you haven't quit understood how it works. Let me help you. You write an email to Miker and tell HIM to lower the volume of all instruments ;)

Seriously, I haven't thought about this till now, and it turned out quit Ok. But now I will tell my OSon to use lower volume Instruments from the start.

Haven't checked how the RMT replay does the lower volume, however, doing it manually before hand is the best option, I think.

What you should not forget: There is more then just the volume. A high pitch will be more recognizable then a lower pitched melody instruments.

Finally, music instruments use probably a volume envelope, so they are not always at level 15. And an explosion or pick-up of an item has a fast attack and can be very well recognizable when played. Additionally, the player has some expectation that he hears a sound when he picks up or does something. So he hears the sfx pretty easily.

Keep in mind, that there is some kind of limit in POKEY. Something along the lines that the added volume of all channels shouldn't be higher then 30 or so. Should be in the ABBUC-SW-Contest tips and tricks sheet. So, lowering the instruments is a good idea anyhow ;)



#10 Rybags OFFLINE  

Rybags

    Gridrunner

  • 16,029 posts
  • Location:Australia

Posted Tue Feb 10, 2015 3:53 AM

There was a mentioned limit, I think it was DeRe Atari with combined volume of 15 - IMO it's a total bunch of crap, we've all had Pokeys for over 30 years being belted with full volume.

 

The problem with just using much lower volume is the amplitude steps are very noticable at lower levels, e.g. cycling through 5-10  vs 10-15.



#11 Creature XL OFFLINE  

Creature XL

    Dragonstomper

  • 904 posts
  • Location:Hannover.De

Posted Tue Feb 10, 2015 10:41 AM

There was a mentioned limit, I think it was DeRe Atari with combined volume of 15 - IMO it's a total bunch of crap, we've all had Pokeys for over 30 years being belted with full volume.

 

So we should ask JAC! where he got his info from, I guess :)

http://www.wudsn.com.../tutorials/tips

 

This is defo not my expertise, so after I have mentioned this fact it's time for me to leave ;)



#12 JAC! OFFLINE  

JAC!

    Stargunner

  • 1,824 posts
  • Always looking for GFX and MSX for my demos
  • Location:Lebach, Germany

Posted Thu Feb 12, 2015 5:47 PM

Yes, that's from De Re. I had to rely on that as I'm over 40, so my personal judgement output audio quality is limited by my worn out ears.

>http://www.atariarch...pt07.php#H7_2_3

"The sum of the volumes of the four channels should not exceed 32, since this forces overmodulation of the audio output. The sound produced tends to actually lose volume and assume a buzzing quality."


Edited by JAC!, Thu Feb 12, 2015 5:48 PM.


#13 Rybags OFFLINE  

Rybags

    Gridrunner

  • 16,029 posts
  • Location:Australia

Posted Thu Feb 12, 2015 6:05 PM

"Overmodulation" - I've got doubts about that.

 

If it did happen, then surely a use would be found for it, it would almost be like being given new waveforms... though you'd need to use 3 voices minimum to actually get it.



#14 Creature XL OFFLINE  

Creature XL

    Dragonstomper

  • 904 posts
  • Location:Hannover.De

Posted Fri Feb 13, 2015 4:40 AM

"Overmodulation" - I've got doubts about that.

 

If it did happen, then surely a use would be found for it, it would almost be like being given new waveforms... though you'd need to use 3 voices minimum to actually get it.

 

New waveforms?

If the described effect is the one you hear in the Intro of my "MJO" then it is certainly unwanted an annoying.







Also tagged with one or more of these keywords: Raster music tracker, rmt, sound, effect, play

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users