It is currently Fri Nov 17, 2017 12:40 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Thu May 16, 2013 8:46 am 
Offline
User avatar

Joined: Thu May 16, 2013 8:25 am
Posts: 5
Hello everyone!
I'm working on a project, built in AS3, that will look and sound like a very early NES game. I'm using palette and sprite limitations, trying to stay as close as possible to something from that era and that hardware. At first I used prerecorded sound and music, but since I'm trying to get a small final swf, I decided to check if it was possible to play nsf files on as3 and found a port of Game Music Emu by Blargg compiled as a swc library via adobe Alchemy. Then I created a nsf file that contains music and sfx. When using this nsf, I cannot get music and sfx to play at the same time; whenever I play some sound, music stops. I've tried different approaches (separating music and sfx on different nsf files, creating multiple instances of the gme library, and a combination of both) but nothing works. The moment the sound starts playing, the music stops. If anyone is familiar with Game Music Emu (on flash or otherwise), I'd really appreciate the help.


Last edited by Ikki666 on Thu May 16, 2013 2:23 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu May 16, 2013 10:15 am 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
GME plays NSF files, which only support one track playing at a time. You'd need to run two instances of GME if you want sound effects at the same time. Though, I didn't do the swf porting, so maybe the author did something to help with sound effects (I vaguely remember an email about this issue, but can't find it offhand in my mailbox).


Top
 Profile  
 
PostPosted: Thu May 16, 2013 10:28 am 
Offline

Joined: Sat Jan 23, 2010 11:41 pm
Posts: 1161
Is there something that prevents playing music as NSFs using GME, but playing prerecorded sound effects as MP3? Prerecorded sound effects shouldn't take much room, and storing the music in NSF would save a lot of room alone.


Top
 Profile  
 
PostPosted: Thu May 16, 2013 2:39 pm 
Offline
User avatar

Joined: Thu May 16, 2013 8:25 am
Posts: 5
First of all: Blargg, your libraries are absolutely awesome! Thanks for sharing such a really great work!

Now, about the nsf playing issue: I've tried using two instances of gme, playing each a copy of the nsf file, or playing each a different nsf file (one with music, and one with sfx). Neither approach is working. When loading two copies of the same file, I get the same original error (that is, music stops after the first sfx plays). When I use two different nsf on two different instances of gme, only the audio of the last loaded file plays. I'll recheck all my code to see if I've done something wrong, cause I understand some games (Super Mario Crossover comes to mind) managed to do all of the audio with nsf files. Anyway, if I can't make it work, I'll probably try using nsf for music and prerecorded for sfx, like Shiru suggests. Thx a lot for your answers, I'll post my results if I can make this thing work.

(Please, excuse if my english is not very good, it's not my native language)


Top
 Profile  
 
PostPosted: Thu May 16, 2013 3:15 pm 
Offline

Joined: Thu Apr 14, 2011 9:27 pm
Posts: 85
In order to make this sound completely authentic, you would have to modify the NSF driver you are using (I assume Famitracker's) to store both the music and sound effect that is playing and support channel stealing to only drop certain channels out of the music while the sound effect plays.

Using WAV files for sound effects and muting the corresponding sound channel in Game Music Emu would be much easier.


Top
 Profile  
 
PostPosted: Thu May 16, 2013 6:09 pm 
Offline
User avatar

Joined: Thu May 16, 2013 8:25 am
Posts: 5
I am using Famitracker, but I've just started using it. In fact, I've never composed any music or sound, this is a first. I'm using three channels for music (pulse1, triangle and noise), leaving one channel for sfx (the sfx tracks are all composed on pulse2). When you say 'modify the driver' are you refering to source code, or can it be done on the software as an option before exporting nsf?


Top
 Profile  
 
PostPosted: Thu May 16, 2013 6:45 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
Grapeshot wrote:
In order to make this sound completely authentic, you would have to modify the NSF driver you are using (I assume Famitracker's) to store both the music and sound effect that is playing and support channel stealing to only drop certain channels out of the music while the sound effect plays.

...and write a custom emulator for it, since NSF doesn't allow any communication with the player, and clears memory when starting a new track.


Top
 Profile  
 
PostPosted: Thu May 16, 2013 7:48 pm 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19220
Location: NE Indiana, USA (NTSC)
blargg wrote:
...and write a custom emulator for it, since NSF doesn't allow any communication with the player

The custom emulator need not be written from scratch. It should be possible to extend NSF to establish a page of shared memory ($0700-$07FF?) between the NSF player and the program using it, so long as the code in the NSF is aware of the shared memory.


Top
 Profile  
 
PostPosted: Fri May 17, 2013 11:30 am 
Offline
User avatar

Joined: Thu May 16, 2013 8:25 am
Posts: 5
Since I don't think I'm skillful enough to mess with emulator code, I settled for checking all the as3/alchemy compilation mess. I'm not really sure, but I believe that all instances of the gme library create static emulators (in flash at least). Anyway, I solved my problem in a very simple way: linking two different swc of gme to my project. Now it works wonderfully. Is not a good solution, since it requires recompiling gme with alchemy into two different swc libraries that work in exactly the same way, but are in different packages, and it takes more space on the final swf than it should (but can be reduced by using just the nsf part of gme). I'll keep trying to find a better solution. Thx for all your answers.


Top
 Profile  
 
PostPosted: Tue Apr 01, 2014 1:35 am 
Offline

Joined: Sun Aug 25, 2013 3:38 pm
Posts: 4
I know this post is old, but there's a version of GME that now uses FlasCC / CrossBridge. You can find it at https://github.com/mcannizz/gme-flascc

It uses SWIG and is much faster than the GME Alchemy SWC from https://code.google.com/p/game-music-emu-flash/ assuming that's where you got the SWC from.


Top
 Profile  
 
PostPosted: Tue Apr 01, 2014 6:18 am 
Offline
User avatar

Joined: Thu May 16, 2013 8:25 am
Posts: 5
Great news! Thx for the reply. I'll check this version of gme as soon as possible.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group