It is currently Wed Oct 18, 2017 2:50 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Mon Nov 16, 2015 6:48 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1771
Location: DIGDUG
Recently, I rewrote my music engine... and it got me to thinking.

What do you guys consider standard features of an all-purpose music engine for a game. I actually removed pitch shifts (other than vibrato) because I never use them. And I considered adding an echo effect, but that would take up a huge chunk of RAM space (possibly).

Currently, I have all channels available to music, and sound effects available on SQ2, Noise, and DMC. And only have volume envelopes on the Square Channels.

Another consideration, is I don't have a good way to generate data. Currently, I just type it in. I suppose I could write a script to turn a Famitracker text export to work with my engine, but to be honest, I never liked the Famitracker interface. I think, ideally, a good engine should have ease of imputing new data in mind... Which would mean another rewrite, since my engine is not designed for ease of use in mind.

Oh, I think I stop there. I could go on...

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Mon Nov 16, 2015 9:44 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19096
Location: NE Indiana, USA (NTSC)
My music engine has sound effects on all four tone channels. Drums are considered sound effects: each of 25 drums in a kit has one or two sound effect IDs associated with it. For example, a kick drum might have both a triangle and a noise component. Each sound effect is a list of 2-byte records, with a (duty, volume) value in the first byte and a semitone number in the second.

It also has a primitive priority system. If I start a sound effect on sq1 while sq1 has a sound effect running, it'll spill to sq2. If I start a sound effect on sq1 while both sq1 and sq2 have a sound effect running, it'll spill to whichever channel has fewer bytes left in the current sound effect. If I start a sound effect on a channel that has more bytes left than the length of the sound effect I'm starting, it won't start at all. Finally, the sound effect and musical instrument on each channel are compared every frame for whichever is louder.

An instrument's envelope consists of an attack, which is structured very similarly to a sound effect but with a transpose value instead of an absolute pitch, followed by a volume ramp down.

Because a pattern can be started on any row (not just the first in an "order"), I can set up some channels to loop faster than others (e.g. SMB1 drums), and I can play only the beginning of one pattern with another pattern as its end.


Top
 Profile  
 
PostPosted: Sat Nov 21, 2015 2:59 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3943
Put duty cycles and volume control together.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
PostPosted: Sat Nov 21, 2015 4:11 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1771
Location: DIGDUG
@Dwedit

I have that.

I think my current weakness is Sound Fx, and ease of use.

I have this crazy idea of making (one day) a Mario Paint style NES game that can save a song (SRAM) in a usable format for a music engine. In my mind, all you should have to do (to import the song into a game), would be slapping a label "Song1:" with .incbin to the saved song data. But, I think I will need to write a script to parse the saved song, first, into a .asm file with pseudo-labels generated. Or something like that.

Anyway, another project that will get done "in the distant future".

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Sat Nov 21, 2015 7:49 pm 
Offline
User avatar

Joined: Thu Jan 03, 2008 1:48 pm
Posts: 540
Is your engine meant for game programmers or meant for musicians?


Top
 Profile  
 
PostPosted: Sat Nov 21, 2015 9:45 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1771
Location: DIGDUG
Currently, it's meant for me.

But, eventually I want to get it to a point where it can work as a tool that other people might want to use. Anyway, I'm speaking hypothetically.

And, that's why I was asking what features and special effects it should have.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Fri Dec 18, 2015 1:38 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1771
Location: DIGDUG
I've decided to abandon all work on my own music engine, now that I've figured out how to do 95% of what I want with Famitone2...

Volume column, can be simulated by having extra instruments who's volume pattern peaks at 8 (or 4) rather than F.

Tremolo, done by looping a volume pattern '| f e d c b c d e'

Vibrato, done by looping a pitch pattern '| -2 -1 1 2 2 1 -1 -2'

Arpeggio can also be done with a looped pitch pattern... '| -30 -40 70'
(or maybe several, since they will be out of tune as you go up or down on the base note)

Pitch bends, looped pitch pattern '| 0 -1'

I think Famitone2 uses fewer bytes to store data (not counting sound fx) than mine.

And, I finally figured out how to utilize an external MIDI keyboard without tearing my hair out. Apparently, in Famitracker, press 'insert' to bump everything below the highlighted point down one.(needed, because I thought I'd have to cut/paste every note after keying them in). [and 'backspace' to bump everything below highlighted point up one, (will delete the line above highlighted line)].

_________________
nesdoug.com -- blog/tutorial on programming for the NES


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 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