Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

FamiStudio

FamiStudio - NES Music Editor for chiptune artists & homebrewers · By BleuBleu

New Song !! Mental Imperialism

A topic by MaxWar created Jun 21, 2020 Views: 816 Replies: 9
Viewing posts 1 to 7

Here it is!   Making this was quite an adventure. I went a bit overboard and used the MMC5 expansion for 2 extra square channels. It would have been hard to make the more atmospheric parts without them. 

I love Famistudio.  In a Normal DAW I  just get lost in synthesizer settings and can't finish a project.  The simplicity of the NES sound chip helps me focus on just making music.  I still have some issues controlling phase interference as when you play the song twice it never sounds exactly the same. Using envelopes help mitigate interference artifacts but I still get a few random glitches here and there.  I would be curious playing this on a real Famicom.

The title Mental Imperialism is at least in part conceptually inspired by the first novel of Frank Herbert's Dune. Which I re-read recently. Paul Atreides is faced with a cruel destiny and seemingly impossible odds. Yet he triumphs and becomes emperor through the sheer power of his superhuman mind. 

Developer

Awesome dude! I guess you are ready for the movie to come out then? 

That's a valid point for phases. I never thought about that. Ill try asking around some of the chiptune gurus to see what they say. 

In the mean time if you have a simple ROM that shows the problem, i can run on my NES let you know, we could see how it reacts.

-Mat

I could probably make some kind of interference test demo. Playing octaves or unisson typically results in some unpleasantness. Using different duty cycles helps but the best cure I found is to use a tiny amount of vibrato just to force the waveforms out of phase. But it is not 100% and once in a while a note kinds of craps out. 

I am quite curious about the inner working of the sound generator in this regard.   The annoying part is that the waveforms are seemingly never aligned exactly the same each time you play the same song, which makes fixing the occasional phase interference weirdness difficult. Is emulation accurate to the real hardware in this regard ? If so, are there some techniques to better control this aspect when you make music ? 

Btw is your NES modified to play expansion audio ? I have a Famicom and I am contemplating getting a flashcart for it. 

Developer

Those are good questions.

I have seen songs, Castlevania comes to mind, where they will add or subtract 1 pitch unit from one of the square channel (by setting a single value of -1 or + 1 in the using the "Pitch" effect track on the very first note of the song). This seem to break the interference that you mention and it creates very interesting effects. Channels become much more audible all of a sudden.

I didn't write the sound emutation for the base NES (i did write some of the expansions that were missing tho) but it should be fairly accurate. It will not be helpful at all for you, but "the phase of the square channels resets every time hi-byte of the 16-bit period is written". That was quite a mouthful. In plain English it means that the phase will only reset when you cross over these notes (approximately) : A-3, A-2, D-2, A-1, F-1, D-1. I dont think its realistic for you to purposely reset the phase in your songs...

I just have an Everdrive N8. The base version (need to get the pro soon) does not have an NSF player, so i use my ROM exporter. And no, i dont have any mods so if i were to use expansion audio, it would be emulated by the Everdrive... which would kind of defeat the purpose of using real hardware. I heard of people having boards with VRC6 and other expansions on them, but I dont know much about those. If you have a Famicom, getting an FDS would be super cool. That's the one expansion chip that anyone can get and run on actual hardware easily.

-Mat

I actually DO have a FDS that I got in a ''Junk'' lot from Yahoo Japan for peanuts. Quite a long time ago. It was never able to read disks but it might do for playing music? Can the extra FDS channel be accessed with a flashcart ? The extra FDS channel kind of scares me though, hahaha. 

Also, I remember from years ago when I was pretty deep into console repair and modding, some folks were selling ''blank'' boards with expansion audio chips. They were intended for making repros. You just had to burn the ROM and install it in the board. I have a Gimmick NES repro that as far as I know was made with these. I meant to modify my NES to be able to play expansion audio but I never got around to it. My days of modding were a bit cut short when I became an ebay powerseller and my focus shifted.   

The one thing that bugs me is why are the waveforms not aligned the same at each playthrough? If the reset points are predictable, does that mean that there is some randomness to the initial state of the waveform when the generator resets ? Or do the channels drift from each others over time ?  Your explanation on what triggers the reset is indeed somewhat lost to me but what I do get is that it can be triggered by the right sequence of events.  Maybe this can be exploited by playing some short ghost notes, will the reset still occur if the volume of the note is 0 ?

Using the pitch enveloppe to further control these issues sound like a good idea. Somehow I had not realized it allowed for such fine adjustments. How is ''one pitch unit'' defined ? 

By the way I replied to your question on youtube in case you did not get a notification or something. 

Developer (3 edits)

I actually dont know if a Famicom cartdrige can access the FDS sound chip, very good question. Youll have to do some googling on that. 

For the phase stuff, FamiTracker has a sweep effect that happens to (almost accidentally) triggers a phase reset. I know some people use it as such. For us we could add a "phase reset" track in the effect panel. Like a simple thing that you set to 1 to trigger a phase reset. Feels hacky tho.

http://famitracker.com/wiki/index.php?title=Effects_Hxy_and_Ixy

Oh boy, a pitch unit is very fuzzy. Its the same units that you use in the pitch envelopes. Basically its gonna look something like this (this is in hexadecimal, trackers loooove hexadecimal):

http://famitracker.com/wiki/index.php?title=2A03/MMC5/VRC6_square_frequency_regi...

It basically measures the length of 1 cycle of the waveform.

So higher pitches have tiny values, which low pitches have HUGE values. So a delta of +1 or -1 will be a lot more significant in high-pitches.  FamiStudio does not try to compensate for any of this. You can probably hear it already on instrument with vibrato.

-Mat

(1 edit)

That Hardware sweep is intriguing :p 

Thanks for the clarifications. I looked at the formula for pitch in the link and it makes more sense. One thing I am still perplexed about is why the channel pitch enveloppe goes from -128 to + 128 but the instrument enveloppe goes from -63 to +63 ?  On a side note it is very difficult to fine tune the channel pitch enveloppe to a specific value. Maybe that level of precision is not actually useful, I don't know. But it triggers my OCD :p  Is there a hidden control to nudge it +1/-1 ? 


Ok let's move on to other matters, bugs. Today I tried to export my song to NSF and famitracker but I ran into issues. 

NSF export file had a glitch with the triangle channel, it stops after like 3 notes. I tried it a couple times with the same result.  The issue is present whether I Try to play the file with NSFplay or importing it back to famistudio.  

For famitracker: After loading the txt file in famitracker, the song was missing ( or did not play ) chunks of music which seem to correspond to the end of my custom pattern lengths. Also, the ghost notes that I used for pseudo reverb seemed abnormally loud. I would suspect the attack was now active but I did not look further into it as Famitracker is rather alien to me.

I am attaching my famistudio song file if you would like to try it yourself to see if you get the same results. 

https://www.dropbox.com/s/4wvreyfaqs7satc/Mental%20Imperialism.fms?dl=0

Developer

Ok, thanks for the file. Ill debug a bit.

The fact that track pitch goes from -127/128 and and envelope pitch goes from -63/64 is simply because of the way it ends up being encoded in the NSF.  One bit is reserved for special codes in envelopes. They both are in the same exact unit tho.

The sweep unit i have no plan to support in the short term.

-Mat

Ok thanks, all is clear regarding the pitch stuff! Thank you for the support and sorry to pester you with the technical questions :p

Developer

Haha keep em coming. I think the itch.io algorithm is giving us more follower since the board has been more active?

-Mat