How NES Music Was REALLY Composed

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
How NES Music Was REALLY Composed
by on (#72806)
Hello,
I thought I'd share something interesting with all of you. I have talked to countless NES composers and they've told me how they wrote their music. I'll share them with you guys:

Composer(s) - Program

Akito Nakatsuka - Family BASIC
Alberto Gonzalez - Compact Editor (ZX)
Barry Leitch - MODTracker (Amiga)
Brad Fuller - Hex Code
Charles Deenen - Hex Code
David Hayes - Cakewalk
David Warhol - Cakewalk
David Wise - Hex Code
Earl Vickers - Hex Code
Ed Bogas - Atari Music Studio (Atari ST)
Elliot Delman - Digital Performer
Frank Klepacki - Dr. T (Amiga)
Gavan Anderson - Hex Code
George Sanger - Digital Performer
Hirohiko Takayama - Hex Code
Hirokazu Tanaka - Family BASIC
Jeroen Tel - Hex Code
Jonathan Dunn - Hex Code.
Kinuyo Yamashita - Hex Code.
Koji Kondo - Family BASIC
Mark Knight - CuBase (Atari ST)
Mark Van Hecke - Dr. T (Atari ST)
Marshall Parker - Hex Code
Neil Baldwin - Hex Code.
Paul Webb - Hex Code
Paul Wilkinson - Cakewalk and Hex Code
Paul Webb - Hex Code.
Rob Wallace - Digital Orchestrator
Russell Ginns - Mastertracks (DOS)
Steven Samler - Digital Performer
Tania Smith - Hex Code
Zap Ajisai - Music Maker

by on (#72825)
Well personally I prototype with Cakewalk and convert it manually to .db statements (that you call hex code).
With appropirate definitions, this is not too much a pain.

Of course I could also write a MIDI->binary converter but it would take at least as much time.

PS : You really TALKED to all those guys ?

by on (#72829)
Wow, that's absolutely fascinating! The composers that used Family Basic, I wonder if they also wrote their engines with it, or just used Family Basic as a front-end for composing. (Or maybe the music engine was built into Family Basic? :o)

Heh, if you'd like, you can add me to that list -- I compose using raw hex code, and then I rely on my assembler to insert pointers (for jumping, looping, etc).

Sometimes, I'll "sketch out" a song using any number of tools (ModPlug, FLStudio, etc) before converting it to my engine, but most often, I'll simply compose directly in hex, assemble the music engine + data to an NSF file, and hear my work from that.

by on (#72833)
Bregalad wrote:
Well personally I prototype with Cakewalk and convert it manually to .db statements (that you call hex code).
With appropirate definitions, this is not too much a pain.

Of course I could also write a MIDI->binary converter but it would take at least as much time.

PS : You really TALKED to all those guys ?


I would love to have a MIDI>NES converter. David Warhol has one but he's too lazy to try getting the disks to run. Every time I've asked, he's given me some excuse.

I talked to about 95% of those guys. Hirokazu and Koji and a few others I haven't found a way to get a hold of. The rest of them I've got a hold of on Facebook.


Drag: Have you tried ripping those GBS files for me yet? Haha.
If you have done music for a game then I'll put on you there, though I'd prefer your real name on the list, but if you don't want that, that's fine. I wrote music for an NES game too for Gil-Galad. I'm just not sure if he's actually going to try and complete the game or not.

by on (#72836)
Doommaster1994 wrote:
I talked to about 95% of those guys. Hirokazu and Koji and a few others I haven't found a way to get a hold of. The rest of them I've got a hold of on Facebook.

Did they say anything for or against fan remixes like those heard at ocremix.org?

by on (#72842)
I've never asked them about that.

by on (#72848)
Doommaster1994 wrote:
Drag: Have you tried ripping those GBS files for me yet? Haha.

Oops, I finally got around to it just now. :P
Doommaster1994 wrote:
If you have done music for a game then I'll put on you there, though I'd prefer your real name on the list, but if you don't want that, that's fine. I wrote music for an NES game too for Gil-Galad. I'm just not sure if he's actually going to try and complete the game or not.

Hmm... I'm not sure if I'm ready to have my real name on the internet just yet. At any rate, I still have yet to complete a game that uses music I wrote, so I guess I'll hold off for now. :P

by on (#73174)
Sweet list! You've found a lot more than I have. :)

I was interesting in putting something similar together, something written in layman's terms to give a basic understanding of how NES music was made to someone who's curious but not already knowledgeable.

http://theshizz.org/forum/index.php?/to ... -was-made/

Sorry for the huge post, but I figure I might as well copy/paste it here.

- - - - - - - - - - - -

1 - Neil Baldwin
2 - Alberto Gonzalez
3 - David Wise
4 - Tommy Tallarico

1. Neil Baldwin - link
Composer of Magician, James Bond Jr, Lethal Weapon 3, Ferrari Grand Prix Challenge, The Jungle Book, Dropzone, and Hero Quest + Erik the Viking (both unreleased).

In short - He wrote most everything out in text files that were subsequently compiled with Eurocom's own 6502 assembler. A Yamaha keyboard and graph paper were some of the physical tools that assisted in the composition and transcription process, although the keyboard was in no way actually interfaced with the system.

Detailed explanation-

Quote:
NB: There were no tools to speak of so everything was entered as numbers in the assembler/editor. Later on I turned the numbers for command codes into macros to make entering and reading the sequences of notes a little easier but that's as sophisticated as it got. I worked out tunes on a little Yamaha keyboard and typed in the pitches and durations. Often I'd work out timings on some squared graph paper, mostly by trial and error.

- - -

Dennis: 'My big question is what kind of software you eventually fell into using, and if it resembled a tracker of any sort?

NB: All of my music was entered in text files and compiled with our own in-house 6502 assembler. I'd messed around with tracker-style programs on the Amiga but it's not a format that I ever really got on with. I did write some simple MIDI-to-text utility later on but it's use was very limited so 90% of the time I just typed everything in.


Further anecdotes on working with the NES-

Quote:
NB: We had no development hardware just half-a-dozen Famicom consoles and a badly photocopied hardware specification that was 99% written in Japanese! What we lacked in resources, we clearly made up for in boundless determination.

Luckily for us, our parent company (at the time) employed the skills of a really talented electronics engineer, Richard Alton, who managed to reverse engineer (and build) some flash-ROM cartridges and together with an old 6502 editor/assembler, "PDS", we had ourselves a rudimentary development kit!

I remember myself and Tim Rogers (now Technical Director at Eurocom) visiting the languages department at Sheffield University with the photocopied Japanese NES manual and with the help of two Japanese girls we deciphered a lot of the technical information. They're uncredited in the history of Eurocom but looking back, I'm not quite sure how we'd have progressed without their help!


2. Alberto Gonzalez - link
Composer of Asterix and The Smurfs.

In short - He wrote his own tracker for the ZX Spectrum, titled Compact Editor, and sequenced out the basics of the music (notes, lengths) on there. Then after it was converted to source code most of the percussion, instrument details, and other nuances were all done in a plain text file. Data was transferred across platforms using a piece of hardware known as the P.D.S.
http://www.worldofspectrum.org/infoseek.cgi?regexp=^P.D.S.$&pub=^P.D.+Systems+Ltd$&loadpics=1

Image

Image

Detailed explanation-

Quote:
B: Wait, so you even wrote NES music, for example, on the ZX Spectrum! Tell us a little bit more about your program Compact Editor, and how it basically functioned. Was it capable of tracking / composing a complete song from start to finish for the rest of your non-ZX 8-bit soundtracks?

AG: Compact Editor was a simple music sequencer, based on tracks, blocks, and instrument definitions, inspired by some Amiga computer trackers like NoiseTracker. A complementary PC program named “The Sourcer” was used to transform the binary data created with Compact Editor into raw source code, as a text language that I could understand (basic notes, lengths, etc). This way I could then edit the songs into its fullest detail.

- - -

AG: My entire process of making music for 8 bit consoles can be elaborated as such- First I used the Compact Editor to compose the basic idea of the song, with its different parts. Later the song was transformed into source code using The Sourcer, and then as a plain text file I put the small details and riffs into the song, as well the drum track and the final sound for each instrument. This process was done by changing the source code, compiling, sending it to the console, listening, and so on again and again until it sounded as I intended (or I ran out of time!). Finally, if required (most of the time), the compression stage took place, which consisted of finding and reusing small fragments of the song to make it use the least amount of memory possible.

Many times I adapted the sound driver for each game, adding new commands and effects, drum sounds or whatever. It was an evolving thing. I don’t know how the other musicians did their soundtracks, I’m still wondering, but don’t think it would be much different.


Further anecdotes on working with the NES-

Quote:
AG: ... The NES had something special. The triangle wave channel was a good source for percussive sounds and boomy basses, although it wasn’t very usable for other kind of sounds. I really enjoyed doing the music of Asterix & The Smurfs. Solstice by Tim Follin was my inspiration at that time. I had to learn 6502 and I liked it much more than I would have imagined.

AG: ... When I was writing Asterix for the NES and learning the sound chip, I didn’t find information about the right frequency values to use for the notes (the frequency table), and the values of my Game Boy driver didn’t work. So what I did was create a small program for the Game Boy to play each note (12*8 notes if I remember correctly), and another program in the NES to lower and raise the sound frequency with the controller. Then I played each note in the Game Boy and tried to mach its frequency on the NES “by ear”, to find the right value for the registers. How brute is that? Well it worked, but now when I listen to my NES soundtracks I notice that some notes are a bit out of tune.


3. David Wise - link
Composer / Sound Design for Battletoads, Wizards and Warriors, Marble Madness, Ironsword, Taboo: The Sixth Sense, Pin-bot and many others. http://en.wikipedia.org/wiki/David_Wise_(composer)#1987

The explanation is a bit short to summarize, so I'll skip the 'in short' here and go straight to the quote-

Quote:
OCR: What was the first week on the job like?

DW: Good - interesting. Video games were still in their infancy, and learning that the sound chip on the NES - the Nintendo Entertainment System - was somewhat compromised, compared to a Roland D-50, certainly made things challenging. But I like a challenge!

OCR: What was the most difficult thing to learn?

There was no MIDI, instead, notes were entered data style into a PC. I typed in hex numbers for pitch and length and a few commands for looping subroutines. And this method of writing video game music continued right through to the end of the SNES development.


4. Tommy Tallarico - link 1, link 2
Composer for Color a Dinosaur (NES), as well as many more post-NES soundtracks.

In short - Working with a limited sound driver, and approaching the NES from more of a musical background than a programming one, Tallarico used a midi (.mid) -> ascii (.asc) converter. The converter was programmed by Virgin vice president Dr. Stephen Clarke-Wilson. Music was initially sequenced with Cakewalk. The sounds were edited and finalized using a custom NES cart- a gutted copy of what was formerly a test version of Golf Power, replaced with "Tommy T's Play Me Sound Editor"-

http://www.youtube.com/watch?v=XoD0ERZntFI
(note that the video is about the discovery of the item, which is why the speaker didn't know much about it at the time)

Image

Detailed explanation-

Quote:
TT: I had never done music and sound fx for an NES game before...

The sound driver for the NES was horrid!! Before the G.E.M.S. tool for the Sega Genesis you pretty much had to be a computer programmer in order to do sound for video games, especially the NES. [Dr. Stephen Clarke-Wilson] who was not only a talented musician and programmer in his own right created a small conversion program in Cakewalk which enabled midi files (.mid) to be converted to ascii (.asc) files. With .asc files I could get the NES to sound like something as long as I stayed within the proper note ranges. As far as sound fx went I could tweak a bunch of numbers and make some interesting albeit annoying sounds...

I created the simplest midi files I could in the time I had and ran them through the midi to ascii converter...

There were all sorts of tweaking tricks one could do to get it to sound “not horrible”. Composer/programmers could write their own tools and incorporate things like vibrato and pitch bend. I mean lets face it the most memorable and popular songs in the entire history of the video game industry were created and performed on the NES! Of course I’m talking about the music from Mario Bros. Well, when it came to the NES I was no Kojii Kondo!! Especially considering I had a beat up piece of crap audio driver and a day to learn it and compose for it.


Further anecdotes on the NES sound editor-
Quote:
TT: I saw the pics of the carts in a forum. Yeah... those were my carts from almost 20 years ago. And the "Tommy T." label is my handwriting. The "Golf Power" was an old cartridge casing that I erased over... I was a game tester for Golf Power so when the game was completed I used the cart to put an NES sound engine on it for when I was working on Color A Dinosaur!

- - - - - - -
:D I realize some of the links don't work right on this forum. That's ok.
Emulator
by on (#73526)
Hey all, I am working on an emulator (on an XMEGA128) and right now I am doing sound. The DMC specifically. Does anyone have a short sample I can test with?

by on (#73530)
Grab samples out of your Windows directory, use Audacity to convert them to 33500 Hz mono, and run them through this converter.

by on (#73534)
Tnx. I didn't know you could do that!

by on (#73568)
Nice thread :)

Hi everyone! I thought I could share some vintage chiptune code with you.

This is the source code for the NES Game Over song of Asterix. All was written with macros. Each macro corresponds to an hexadecimal value or chunk of assembly code, this way it was much easier to program since you could write real words that had some meaning, instead of numbers and raw assembly code.

-------------------------

Code:
GAMEOVER   INCHA   GOMEL
   INCHB   GOCHRD
   INCHC   GOBASS
   RTS


GOMEL   DW   GOMEL1
   DW   0,GOMEL

GOCHRD   DW   GOCHRD1
   DW   0,GOCHRD

GOBASS   DW   GOBASS1
   DW   0,GOBASS

GOBASS1   DB   L10,VIB,0,4,5,TRA,-2
   PERC   10,GOPERC
   DB   L40
   DB   a1,__
   DB   __,g1
   DB   e1,__
   DB   __,e1

   DB   a1,__
   DB   __,g1
   DB   e1,__
   DB   __,g1

   DB   d1,__
   DB   __,d2
   DB   a1,__
   DB   __,a1
   DB   d1,__
   DB   __,d2
   DB   e1,__
   DB   gs1,B1
   DB   XM

GOCHRD1   DB   L10,SENV,$D1,3,$64,W1,EF1

   DO2
   DB   P9,a2,P3,c3,e3,a3,c4,a3,e3,c3
   LOP
   DO2
   DB   P9,e2,P3,g2,b2,e3,g3,e3,b2,g2
   LOP
   DO2
   DB   P9,a2,P3,c3,e3,a3,c4,a3,e3,c3
   LOP
   DO2
   DB   P9,e2,P3,g2,b2,e3,g3,e3,b2,g2
   LOP
   DO2
   DB   P9,d2,P3,f2,a2,d3,f3,d3,a2,f2
   LOP
   DO2
   DB   P9,a2,P3,c3,e3,a3,c4,a3,e3,c3
   LOP
   DO2
   DB   P9,d2,P3,f2,a2,d3,f3,d3,a2,f2
   LOP
   DO2
   DB   P9,EF5,e2,P3,gs2,b2,e3,gs3,e3,b2,gs2
   LOP
   DB   XM

GOMEL1   DB   L10,SENV,$39,5,$90,VIB,20,1,4,W1,REL,5,$02
   DB   e3,__,a3,__,c4,__,__,__
   DB   __,NN,a3,b3,c4,__,d4,__
   DB   b3,__,__,g3,e3,__,__,__
   DB   __,__,__,__,__,f3,e3,d3
   DB   e3,__,a3,__,c4,__,__,__
   DB   __,NN,a3,b3,c4,__,d4,__
   DB   b3,__,__,a3,g3,a3,b3,__
   DB   __,__,e3,__,__,__,f3,g3

   DB   a3,__,__,g3,f3,__,e3,f3
   DB   __,__,e3,__,d3,__,c3,__
   DB   d3,__,e3,__,e3,__,d3,e3
   DB   __,__,__,__,__,nn,f3,g3
   DB   a3,__,__,g3,f3,__,e3,f3
   DB   __,__,e3,__,c4,__,b3,__
   DB   e3,__,e3,__,d4,__,c4,__
   DB   c4,__,__,__,B3,__,__,__
   DB   XM
 
GOPERC   DB   1,0,6,5,2,0,6,5
   DB   1,0,6,5,2,5,1,5
   DB   END


If there is enough interest I could write some comments and details about what does all that code mean. :)

Cheers,
Alberto

by on (#73590)
I do the exact same in my unfinished project, I use .db statements but with definitions instead of using plain hex numbers. In the end it looks like that :
Code:
SucessTri
.ifndef PAL
   .db SetTempo, $88
.else   .db SetTempo, $a3
.endif   .db SetAttack+6
   .db Duty
   .db SetVolume+2
   .db SetSustain
   .db SetRelease
   .db SetOctave+4
   .db DblCr+Mi, DblCr+Mi, DblCr+Sil, DblCr+Mi, DblCr+Sil
   .db DblCr+Solb, DblCr+Sil, DblCr+Lab, Bl+La
   .db Stop

Of course if you don't understand french you won't understand it, but the notes are called Do Re Mi Fa Sol La Si instead of C D E F G A B (it's just very much easier to me to make them in my language).
So basically each .db satatement is either a command followed (or added) with an argument, or a note (or silence) added with a duration. This is just how my format works though.

PS : A second NESdev comeback from a former NES musician, that's great, welcome !

by on (#73594)
Bregalad wrote:
the notes are called Do Re Mi Fa Sol La Si instead of C D E F G A B

We have Do Re Mi in English, except they're relative to the key in which the piece was written.

by on (#73596)
While we're throwing our hats in the ring, here's a 'sequence' from Nijuu. The principles were very similar to my old NES drivers back in the day;

Code:
S14   I 8
   SI DCM_MODE,NOTE_LOOP
   SI DCM_SPEED,1
   SI DCM_START,0
   V 10
   D 16
   db C5,_,_,_,Ds5,_,_,_,C5,_,_,_,G5,_,_,_
   db C5,_,_,_,Ds5,_,_,_,C5,_,_,_,As5,_,_,_
   db C5,_,_,_,Ds5,_,_,_,C5,_,_,_,G5,_,_,_
   db C5,_,_,_,Ds5,_,_,_,C5,_,_,_,F5,_,_,_
   ES   

by on (#73601)
Neil! it's good to see you :D

Seems you have been around here for some time, 429 posts wow! I have much to read :)

I'm writing some comments to the source code I posted before. With my turtle-slow rubbish English abilities it will take me some time to finish.

Cheers,
Alberto

by on (#73623)
Er, what is your native language?

by on (#73625)
This is written in his profile information.

by on (#73626)
My native language is Spanish.

Once it's posted doesn't seem that difficult, but I write English pretty slow, just to be sure I don't make many mistakes. Then I see how miserably I fail sometimes. :lol:

by on (#73627)
OK, here is the commented source code.

I'm sure you all know that, but let me just remind you that in those times we had severe memory restrictions for both RAM and ROM, so the sound driver and the song data had to be designed to occupy the less bytes possible.

This is the initialization routine, very simple. It uses macros to set the song sound driver pointers to the data of this particular song. You can see how channels 1, 2 and 3 are set to GOMEL, GOCHRD and GOBASS tables.

Code:
GAMEOVER   INCHA   GOMEL
   INCHB   GOCHRD
   INCHC   GOBASS
   RTS


This is the table of tracks for channel 1. Since it's a very short tune it only lists one track. In a longer song it would address many more tracks or “chunks” of data. This is a never ending tune, so the final data instructs the driver to repeat the same table again and again.

Code:
GOMEL   DW   GOMEL1
   DW   0,GOMEL


Same for channel 2.

Code:
GOCHRD   DW   GOCHRD1
   DW   0,GOCHRD


Same for channel 3.

Code:
GOBASS   DW   GOBASS1
   DW   0,GOBASS


This is the “real” data of the song, and this concretely is what I used to call the Bass Track, because it would contain mostly the bass notes. With the NES you were almost forced to use the triangle wave channel always for the bass part.

The first command (VIB,0,4,5) tells the driver to set a vibrato with 0 initial delay, 4 depth and a speed of 5 frames. The second command (TRA,-2) sets this track to transpose the notes down 2 semitones.

The next line (PERC 10, GOPERC) initializes a drum track with a note length of 10 for each sound. Since drum sequences are usually cyclic, I used to “invoke” drum tracks and breaks from any of the other tracks (usually the bass track), at any time, instead of having a separated table with all the drum sequences. This reduced the amount of data in the song.

Next, there is a note length command (L40) which tells the driver to set the note length to 40 video frames.

The rest of the data are notes, and tied notes (__), which just leave the last note sounding for the last length set, in this case 40.

The last command (XM) marks the end of the track.

Code:
GOBASS1   DB   VIB,0,4,5,TRA,-2
   PERC   10,GOPERC
   DB   L40
   DB   a1,__
   DB   __,g1
   DB   e1,__
   DB   __,e1

   DB   a1,__
   DB   __,g1
   DB   e1,__
   DB   __,g1

   DB   d1,__
   DB   __,d2
   DB   a1,__
   DB   __,a1
   DB   d1,__
   DB   __,d2
   DB   e1,__
   DB   gs1,B1
   DB   XM


This is what I used to call the Chord Track, because it would contain most of the chords of the song, in the form of those fast arpeggios that made European chip music so distinctive.

The first command (L10) sets the length note to 10 frames.

The second command (SENV,$D1,3,$64) sets a volume envelope for the sound. The volume envelope routines of my NES and Game Boy drivers were very similar, so I could share code between them, but in the Game Boy I used hardware envelopes (because of hardware restrictions, nasty noises when changing volume), and in the NES I used a simulation by software.

The next command (W1) instructs the channel to set the square waveform to 25% duty. W0 was 50% and W2 12.5% I think.

Next there is an arpeggio command (EF0 to EF15). The arpeggios were defined globally for all the songs and consisted basically on tables of sequential notes used to transpose the current note. One arpeggio would contain a major chord (C,E,G,RET), other a minor chord (C,Ds,G,RET), and others may not contain a chord at all, only transpositions to different octaves. The transposition tables could be cyclic or not, depending on the final command (RET or END). This was another technique to reduce song data, since you didn't need to specify all the notes for a chord, only the root note and the chord type (if different than the previous one).

The next command (DO2 to DO8) instructs the driver to repeat 2 times the block of data found between this and the next LOP command. This was used to reduce the size of the song data too.

Next there is a “procedure” command (P1 to P9). Those commands were used to execute a portion of assembler code which modified whatever was needed in the sound driver. In this case I'm using the procedures to change the “instrument” of the song (sort of hard coded program change).


Code:
GOCHRD1   DB   L10,SENV,$D1,3,$64,W1,EF1

   DO2
   DB   P9,a2,P3,c3,e3,a3,c4,a3,e3,c3
   LOP
   DO2
   DB   P9,e2,P3,g2,b2,e3,g3,e3,b2,g2
   LOP
   DO2
   DB   P9,a2,P3,c3,e3,a3,c4,a3,e3,c3
   LOP
   DO2
   DB   P9,e2,P3,g2,b2,e3,g3,e3,b2,g2
   LOP
   DO2
   DB   P9,d2,P3,f2,a2,d3,f3,d3,a2,f2
   LOP
   DO2
   DB   P9,a2,P3,c3,e3,a3,c4,a3,e3,c3
   LOP
   DO2
   DB   P9,d2,P3,f2,a2,d3,f3,d3,a2,f2
   LOP
   DO2
   DB   P9,EF5,e2,P3,gs2,b2,e3,gs3,e3,b2,gs2
   LOP
   DB   XM


This is what I used to call the Melody Track, because usually it would contain the main melody of the song. There are some new commands here.
The first new command (REL,5,$02) is what I called the “release effect”. Literally, what this command instructs the driver is to set a decay envelope of $02 just 5 frames before the next note command is reached. This was used to shorten the sound of the notes, like if you released the key before pressing the next one (non-legato). This decay envelope means, in nibbles, no change in initial volume (0) and a decay time of 2, hence the $02 value.
The next new command (nn or NN = not note) is a simple command used to trigger the above mentioned “release effect”.

This particular track has lots of tied note commands, this is because it's a short tune and probably I had enough memory available. Usually I would pack the data so it occupied less bytes by using the note length commands. For example instead of leaving “L10,C3,__,__,__” I would changed it to “L40,C3”. This had to be done by hand at the end of the composition process for all the tracks. Every byte counted!!

Code:
GOMEL1   DB   L10,SENV,$39,5,$90,VIB,20,1,4,W1,REL,5,$02
   DB   e3,__,a3,__,c4,__,__,__
   DB   __,NN,a3,b3,c4,__,d4,__
   DB   b3,__,__,g3,e3,__,__,__
   DB   __,__,__,__,__,f3,e3,d3
   DB   e3,__,a3,__,c4,__,__,__
   DB   __,NN,a3,b3,c4,__,d4,__
   DB   b3,__,__,a3,g3,a3,b3,__
   DB   __,__,e3,__,__,__,f3,g3

   DB   a3,__,__,g3,f3,__,e3,f3
   DB   __,__,e3,__,d3,__,c3,__
   DB   d3,__,e3,__,e3,__,d3,e3
   DB   __,__,__,__,__,nn,f3,g3
   DB   a3,__,__,g3,f3,__,e3,f3
   DB   __,__,e3,__,c4,__,b3,__
   DB   e3,__,e3,__,d4,__,c4,__
   DB   c4,__,__,__,B3,__,__,__
   DB   XM



Finally, this is the drum track, a pretty simple one. Each number means one different drum sound, except 0 which is no sound. The default note length is set by the channel that initializes the drum track. Setting the length inside the track was also possible using L commands, but this way I could use the same drum track on different songs that used different base note lengths, again to reduce song data.

As you may figure if you listen to the song, 1=bass drum, 2= snare drum, 6 = short hit hat and 5 = slightly different short hit hat.

Code:
GOPERC   DB   1,0,6,5,2,0,6,5
   DB   1,0,6,5,2,5,1,5
   DB   END



I would really like to find commented code of other veteran musicians, just to know what commands and techniques they used on their sound drivers and compositions. Please let me know if you know of any place with such stuff :)

Cheers!

by on (#73633)
I'm not a veteran musician, but I still can outline how my music engine works. :P As far as I'm aware, Sivak is using it in Battle Kid 2. He also used an older version of my engine in Battle Kid 1.

First thing is to define the instruments. Instruments are defined globally, so they apply to all songs, and all sound effects.

Code:
envelopes
 dc.w   env_blank, env_s4_ch, env_s4_sd, env_s4_oh, env_s4_lead1
 dc.w   env_s4_lead2
env_blank
 hex   00 FF
env_s4_ch
 hex   0F 0E 0C 09 05 00 FF
env_s4_sd
 hex   0F 0E 0C 0A 08 06 05 04 03 03 02 02 02 01 01 01 01 00 FF
env_s4_oh
 hex   0C 0C 0B 0B 0A 0A 0A 09 09 09 09 08 FF
env_s4_lead1
 hex   4d 4d 4c 4b 4a 4a 49 49 48 48 48 47 46 45 44 44 44 44 44 43 FF
env_s4_lead2
 hex   4f 08 0c 08 09 08 07 06 06 05 05 04 FF

You have a table of instruments, and then the data for each instrument.

Since this runs on the NES, these are just sequences of bytes that get written to the volume/duty register for each channel. The exception being the triangle channel; I have the envelope code set up to write a constant instead. "FF" signals the end of the envelope, it just stops. "10 xx" is a "goto" command, for looping (I don't use that here).

Next, if you want to use any pitch envelopes (like vibrato, for instance), you define those.
Code:
pitch_envelopes
 dc.w   penv_1
penv_1
 hex 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 hex 01 FF 00 00 00 FF 01 00 00 00 01 00 FF 00 00
 hex FF 00 01 00 01 00 01 FF FF FF 00 FF 01 01 8022

This is a little different, this is a table of differences, and these are signed bytes. That 80xx is the "goto" command again. As an extra point of interest, I copied this particular vibrato out of Dr. Mario. :P

Now comes the actual song data.
Code:
songs
 dc.w   silence, song4

silence
 dc.w   $0000, $0000, $0000, $0000
 dc   $00

song4
 dc.w   song4_sq1, song4_sq2, song4_tri, song4_nse
 dc $57

Like with the instruments and the pitch envelopes, you start with a table that defines each song. I usually start with a "silence" song that basically sets a tempo of 00, and then just clears the channels. After that is an actual song. There's a pointer for each channel (use $0000 for unused channels), and then a tempo byte.

For the sake of simplicity, here's just one of the channels:
Code:
song4_sq1
 hex ee 01 e4 04 c0 82 92 c3 a2 d1 13 e1 EB 0A c2 62 e0 c0 42 ca 52
 hex e4 05 EB 0F c2 42 52 EB 07 52 EB 0F c0 52 c1 e0 EB 0F
 hex e4 04 c2 33 13 a2 92 82 62 c5 32 82 c2 62 72
 hex e4 05 c2 42 52 EB 07 52 EB 0F E3 05 c5 52 e0 52 E3 00 EB 07 c5 52 c1 52 c0 e0
 hex e4 04 EB 0F c5 e0 c2 13 e0 e0 03 e0 e0 a2 c8 e0 e4 05 EB 08 c2 a2 a2 e4 04 EB 0F c5 32
 dc      $e5
 dc.w   song4_sq1


  • EE 01: set pitch envelope to 1 (EE 00 turns it off)
  • E4 04: set instrument to 4 (which, in reality, is the fifth instrument defined in the table)
  • C0: set a note length to 1. C0-DF is actually a one-byte alias for the two-byte note length command E2 xx. So for example, putting C6 is the same as putting E2 06.
  • 82 92 are notes (F-2 and F#2). This is probably where I differ from a lot of engines, my notes are defined as (<semitone><octave>), so 33 53 73 83 a3 04 24 34 is a full scale (C, D, E, ... B, C). Note that 0x is A, instead of C. I'll explain that in a bit.

    I went with <semitone><octave> (versus a linear table) for programming reasons. <semitone> is an index into my pitch table, and <octave> is how many times to shift it right. Basically, if you have a pitch, you can raise it to the next octave by halving it, which is the same as shifting it right. This is very easy (and quick) for the CPU to decode, while also being easily human-readable.

    Next, the lowest pitch available to the NES APU is an A, which is why I chose to start my pitch table with A. Theoretically, this maximizes the amount of notes possible with the engine, because A, A#, and B are given 1 extra bit of resolution, rather than if I had started with C instead.
  • C3: note length is set to 4, and then a G is played.
  • D1: note length is set to 18 ($12)
  • 13: A#2 plays for 18 ticks. (Remember what I explained above, even though it's written as A#3, it's actually A#2)
  • E1: This is the "note tie" command, so that A# will continue for another 18 ticks.
  • EB 0A: Set volume to 10 ($A). 0 is silence, F is full volume.
  • C2: Note length is set to 3
  • 62: D#2 plays for 3 ticks
  • E0: Rest for 3 ticks
  • C0, 42: C#2 for 1 tick
  • CA, 52: D2 for 11 ticks.

Basically, stuff like this continues until that $e5 down there, which is the "goto" command. Here, it just loops the track over and over.

Sound effects follow the same format, except they have a slightly different header, and sound effects always play at tempo FF, regardless of the tempo of the current song.

The next cool thing is that you can have a track play sound effects instead of notes. That's actually how you do drums. :P

I'm still working on things though. Lately, I've been playing around with the Nintendo SPC engine. If you want to know something crazy, it works very similarly to this. :P

by on (#73645)
Quote:
This is the “real” data of the song, and this concretely is what I used to call the Bass Track, because it would contain mostly the bass notes. With the NES you were almost forced to use the triangle wave channel always for the bass part.

Well, why ? There is no reason Triangle can't be used in it's higer tones ! The only restriction is that you can't go really high either it sounds off-tune, but you can go pretty high before that happens anyways.

Quote:
Once it's posted doesn't seem that difficult, but I write English pretty slow, just to be sure I don't make many mistakes. Then I see how miserably
I fail sometimes.

Or do it like me I write everything fast, do a lot of mistakes and don't give a damn about it. :roll:

Quote:
I'm not a veteran musician, but I still can outline how my music engine works. As far as I'm aware, Sivak is using it in Battle Kid 2. He also used an older version of my engine in Battle Kid 1.

And you're ok about him making profit using your engine ? Man I don't understand you.

Quote:
Since this runs on the NES, these are just sequences of bytes that get written to the volume/duty register for each channel. The exception being the triangle channel; I have the envelope code set up to write a constant instead. "FF" signals the end of the envelope, it just stops. "10 xx" is a "goto" command, for looping (I don't use that here).

This is a flexible system (i.e. it can allow anything), but can be a bit wasteful of bytes, especially since apparently duty cycle and volumes envelope comes together so it's impossible for example to use the same volume enveloppe with a different duty cycle without re-coding it.

Also, if you wanted for example the volume to fade out really slowly, it would take a whole **** of bytes to get it done, when it could be otherwise done by software.
So I guess if I ever do that "ultimate" sound engine I wanted to do, I'd allow both software fades (when doing it slow) or hard-wired volume enveloppes like the ones you showed (when doing it fast).



Quote:
I'm still working on things though. Lately, I've been playing around with the Nintendo SPC engine. If you want to know something crazy, it works very similarly to this.

I guess it's not so surprising. You don't change a forumla that works :wink:
However, the hardware is very different on SNES, and all volume envelopes can be done by hardware. Also the use of instrument samples makes arpeggios mostly useless (unless you're imitating a chiptune).

by on (#73653)
@Drag
That's a very interesting way of programming tunes. I couldn't do with so much HEX though, first I would do is define a bunch of macros to manage that driver :D
I mean, I can understand Rob Hubbard doing it that way in 1983 because of not having proper compilers and editors, but not now!
I was very lucky to have the PDS since I programmed my first line of assembler code. It was an absolutely amazing and powerful editor and compiler / debugger. I used it for all my Spectrum / Amstrad / MSX, NES, GB and Master System / Game Gear soundtracks

The cyclic envelopes in your driver are very cool. I used a similar approach for certain effects in my Spectrum sound driver. The main theme of Light Corridor used a modulation envelope on top of the main volume envelope to simulate a tremolo, and I used them in other unreleased works to simulate delays.

My NES driver was quite simple, but I was pretty proud of it at the time. I had to learn 6502 (which I hated at first for having only 3 registers) and also draw the sprites of the games, so I didn't had much time to spend on the driver. But since it was written from scratch I did some things better than before. In the end I loved the 6502, and the sound of the NES too.
Instead of having the properties of the instruments defined in a table, I used that "procedure" approach to change the sound of each one, by poking directly the driver variables as needed. I also did this on the Master System driver, but all my other sound drivers worked in a different way: instrument definitions were just like any other chunk of music data, with the same commands, and the sound effects worked the same way. The problem with this method is that changing the instrument was much more expensive in CPU cycles.

Code:
;instruments P9 and P3 in Asterix

SDAT MACRO
    LDY   #@1
    STA   (CHL),Y
ENDM

_P9 LDA  #<EEF6
    SDAT CHORDH
    LDA   #>EEF6
    SDAT CHORDL
    LDA  #0
    SDAT CHORDP
    LDA  #$F1
    SDAT ENVELOPE
    LDA  #5
    SDAT SENVCNT
    SDAT SENVCNTR
    LDA  #$92
    SDAT SENV2ENV
    JP   NEWNOTE2


_P3 LDA  #<EEF13
    SDAT CHORDH
    LDA  #>EEF13
    SDAT CHORDL
    LDA  #0
    SDAT CHORDP
    LDA  #$A0
    SDAT ENVELOPE
    LDA  #5
    SDAT SENVCNT
    SDAT SENVCNTR
    LDA  #$52
    SDAT SENV2ENV
    JP   NEWNOTE2


@Bregalad
Quote:
Well, why ? There is no reason Triangle can't be used in it's higer tones ! The only restriction is that you can't go really high either it sounds off-tune, but you can go pretty high before that happens anyways.

Yes I know, but since it had that big bass sound it was best suited for it, and drums. I used it once for melody, though, in the ending theme of Asterix.

Quote:
Or do it like me I write everything fast, do a lot of mistakes and don't give a damn about it. Rolling Eyes

That's something I should apply to more than one thing in my life...

Cheers

by on (#73692)
Not sure if anyone cares, but here's the instruction set of my sound engine thus far:

Code:
Instruction        Code       Param A   Param B
Start Note         %1AABBBBB  Channel   Note to play
Octave Set         %000AABBB  Channel   Octave (0-7)
Envelope           %0010AABB  Channel   Envelope # (0-3)
Note Mode          %0011AABB  Channel   0 = Normal
                               1 = Arpeggio
                                        2 = Duty Cycle Shift
                                       
Wait               %0100AAAA  (A + 1) 16th notes to wait           
Loop To            %01010AAA  Loop times (0 = infinite) + Next two bytes is location to loop to
SqWave Duty Cycle  %01011ABB  Channel   Duty Cycle
Play DMC           %01100AAA  DMC #
Stop Note          %011010AA  Channel
Currently Unused   %011011XX
Start Arpeggio     %01110000
Currently Unused   %01110001
Stream 2 Jump To   %01110010
Stream 2 Restart   %01110011
Stream 2 Start     %01110100
Stream 2 Stop      %01110101
Describe Arpeggio  %01110110
Currently Unused   %01110111-%01111111


I found that creating an underlying loop (Stream 2) and playing notes on top of that saves a lot of data. My data format is by no means easily human readable, nor does it lend itself to hard coded opcodes, so I created a separate script to parse a more human readable format to this.

by on (#73695)
Quote:
Yes I know, but since it had that big bass sound it was best suited for it, and drums. I used it once for melody, though, in the ending theme of Asterix.

Well, it sounds good I think ! Squares in the lower tones sounds good as well, I think it's best to explore different possibilities instead of relying on a fixed patter all the time.

Quote:
My NES driver was quite simple, but I was pretty proud of it at the time.

Well it probably was quite complex in fact. Apparently it supports complex arpeggio effects and drums on triangle that interrupts the actual note triangle plays (I think you understand what I mean). My driver, which I designed to be very compact and simple, doesn't support any of this the only effect I do is extremely simple volume decay and duty-cycle switch on the first frame.

On a side note I really like this "short Triangle plugs" (combined with noise) way to make drums, that both Alberto and Neil used in their works. I think it sounds more accurate than DPCM ironically and it doesn't eat ROM space stupidly.
However I have no idea how to implement this, so for now I go with noise-only drums (or another channel, but that is fully used for drums and never plays some melody and drums at the same time).

The best I could attempt is for some kind of techno to have a note sliding downwards on beats (simulate a loud electronic bass drum) and a normal tone for counter-beats.

I guess to fully implement this I'd need to have internally 2 triangle channels (one who plays fast percussion stuff and the other a melody) and have one take over another when needed, like how I have internally multiple channels for music and sound effects, and the the latter take over the former. So I'd end up with 3 triangle channels :wink:

by on (#73696)
The music engine in LJ65 and Concentration Room uses the sound effects system for percussion. So a kick drum would be stored as a sound effect and activated whenever the drum channel calls for it. In fact, the game might even reuse the kick drum as a sound effect proper, such as when an object lands.

It also limits the pitches in a phrase to the two octaves above the base pitch at which the phrase is played. This frees three bits for duration: a note is either 1, 2, 3, 4, 6, 8, 12, or 16 divisions long, with in-between durations handled by the "tie" command. The base pitch allows for transpositions, like the way the Comic Bakery theme is played twice in different keys in the first outdoor level of Jurassic Park, or like a bass line can be played at multiple pitches depending on what chord is on top.

by on (#73697)
Quote:
In fact, the game might even reuse the kick drum as a sound effect proper, such as when an object lands.

The method you use is interesitng, but in my opinion it is a very bad idea to reuse a sound effect like that.
Because the player will think a sound effect is playing when in fact it's just the music. This is very disturbing.

This has just happened to me when playing Mega Man Battle Network 6 this afternoon and listening this music, there seems to be a randomly high pitched sound effect, which sounds almost identical to the sound effect in the game when you move the cursor.

by on (#73698)
Bregalad wrote:
Quote:
In fact, the game might even reuse the kick drum as a sound effect proper, such as when an object lands.

in my opinion it is a very bad idea to reuse a sound effect like that. Because the player will think a sound effect is playing when in fact it's just the music. This is very disturbing.

Occasionally, it's supposed to be disturbing. Hip Tanaka composed much of the music of Metroid to sound like sound effects, on purpose.

But in practice, does it end up disturbing when pieces land using a kick drum sound in this video? Your brain separates them out: kick drum in the sound effects happens a quarter second after you press up on the Control Pad, while kick drum in the music happens at predictable times compared to the bass line.

by on (#85387)
I recently got in touch with Michelle Simon, who composed Roundball 2-on-2 Challenge for the NES. She told me that the game's music was composed as MIDI files in Cakewalk for DOS. I'd like to say that this is probably the millionth NES game developer (Park Place Productions) to use converted MIDI files, so I don't think converting MIDI to NES/NSF should be THAT hard.
A long time ago, I also contacted Doug Brandon, who composed Great Waldo Search and Rollerblade Racer. He said the music was composed on CuBase for the Atari ST.
While I'm still on the same subject, I said that Paul Wilkinson used hex code and Cakewalk. He told me that at first he composed in hex code (Terminator was one of them), then he wrote a MIDI conversion tool and converted his MIDI files to NES and he did the rest of his NES music that way.
For David Whittaker, I think he just wrote in hex code.

by on (#85388)
It is not hard, you just going to get crap as output.

by on (#85389)
I would say that depends on how bad it's programmed, but I don't know, I'm not a 6502 programmer. Doesn't matter though, because if I did make a MIDI>NES conversion tool, it would still sound bad anyway since I would suck at 6502 programming.

by on (#85395)
Doommaster1994 wrote:
I would say that depends on how bad it's programmed, but I don't know, I'm not a 6502 programmer. Doesn't matter though, because if I did make a MIDI>NES conversion tool, it would still sound bad anyway since I would suck at 6502 programming.

It doesn't depend on the quality of the conversion tool, but on the input (MIDI) file. If the input file adheres to all the NES limitations, a process like that can work well. But you can't throw a random MIDI file off the internet to a tool like that and expect good results.

by on (#85418)
Ah, I see.
If I was making such a tool which I do plan to do when I learn 6502 (I'm learning C++ in a class right now), I want to use my own instruments. That sounds like it would be a tricky task, but again, I'm not a programmer on the NES so I wouldn't know. It's just an assumption. I would also have it be as fast as 32nd notes, no triplets or anything. Maybe down the road, but not at first if I made the thing.

by on (#85421)
Instruments is the worst part about the MIDI way - you just don't have them at edit stage, and only have them in your driver (if at all), and you have to edit them separately as hex code or with some special tool. So, when you make music, you have no idea how it will sound.

MIDI does not know anything about 32nd and triplets, MIDI files store time stamps for all the notes instead. So triplets etc are not a problem, the problem is that timings resolution in MIDI files is much higher than you can have on NES (and it is flexible in the files but fixed in NES).

by on (#85424)
If you put a "delay next note by n frames within the row" effect in your music engine's bitstream (compare S3M effect SDx), you can get timing resolution almost as good as MIDI at the cost of some extra space.

by on (#85425)
You can't get timing resolution that even remotely resembles what MIDI is capable if you run your music engine on NMI (50/60 hz). MIDI files can have resolutions like 1/800 second, while on NES with NMI you have 1/50 or 1/60, and even if you run your music engine with a timer IRQ, you realistically can have 1/150 or 1/200, not much more (and sure it is not really suitable for a game).

All this only means that you can't use arbitrary BPM and note placements, you need to use certain BPMs and quantize. Live play would require cleanup.

by on (#85432)
Shiru wrote:
All this only means that you can't use arbitrary BPM and note placements, you need to use certain BPMs and quantize. Live play would require cleanup.

My music engine supports arbitrary BPMs in rows per minute. (It works like a Bresenham counter: add the bpm value to a 16-bit counter and wrap at 3606, starting a new row with each wrap.) But yes, live play would need a bit of quantization to move keypresses within one frame of the start of a row to the start of a row.

by on (#85507)
Hola Alberto, yo tambien soy español (creo que tu tambien lo eres), soy aficionado a la musica chip tune, aunque no programo para componerla si no que uso un secuenciador, en mi caso es reason, me gustaria saber si te es posible de explicarme cual es la estructura de las canciones de nes, se que hay varias pero segun tengo entendido una bastante usada es la de cuatro compases para la introduccion y luego otros cuatro para el puente y ocho compases mas y a partir de ahi se crea un loop, perdona mi ignorancia pero aun no lo domino, tengo algunas pistas compuestas pero me pierdo en ese tema, estoy haciendo un juego y me gustaria dotarlo de musica emulada de NES.
Me he ilusionado cuando despues de leer los articulos que hay por aqui he visto que has posteado.
A mi tambien me gusta Jonathan Dunn, me encanta la musica de Darkman y tambien Tim y Geoff Follin, en especial la de Terminator 2.
He visto que tu compusiste la de los pitufos, esa no la habia escuchado por que nunca llegue a tener el juego pero la conseguire para escucharla.
Por cierto perdon por el offtopic.



Hello Alberto, I'm also Spanish (I think you are too), I am fond of chip tune music, although composing program if I use a sequencer, in my case is reason, I would like to know if you are able to explain what is the structure of the songs from the NES, is that there are several but I have understood according to a well used is the four measures for the introduction and then another four to eight-bar bridge and from there more and create a loop, forgive my ignorance but not yet mastered, but I have some tracks made ​​me lose on that topic, I'm making a game and I would like to give it emulated NES music.
Excited when I read the articles after they've seen around here that have posted.
I also like Jonathan Dunn, I love the music of the Darkman and Tim and Geoff Follin also, especially that of Terminator 2.
By the way sorry for the offtopic.

by on (#85594)
When I started making music I didn't know that a triplet, or a quarter note, or chord was called like that, I only knew that certain notes sounded good put together. I didn't even know about tempos or MIDI, I always named the time of the notes using frames-per-second. Of course now it's different but then it worked fine.

There are not many exact tempos to use if you update the sound driver only 16.6 or 20 times per second (NTSC, PAL), there's too much time between updates. I had that problem with the GBA. It was all MIDI, and the tunes sounded awful if the tempo was not exactly adjusted to coincide with frame times. Well, at least to me it sounded horrible! Keep that in mind if you compose for old consoles using MIDI.

To Shriru, Hola! sí que soy Español, de Barcelona para ser exactos.
Regarding your question, I never thought about how many measures had each part (what was a measure?), I just did what sounded right to my ears and I think you should do the same. You don't have to follow any rules, just do what you think sounds nice. Besides, breaking the rules is fun (if it works, that is), try doing something different.

You can also check a reference tune and do the same. You learn mimicking what others do, and then it gets out in your own way. Is there any other way to learn?

Just do it whatever the way, if it works it's OK.

Cheers

by on (#85600)
AlbertoG wrote:
You can also check a reference tune and do the same. You learn mimicking what others do, and then it gets out in your own way.

That or you get sued if you screw up and copy too much.

by on (#85698)
ok, gracias Alberto, a mi me gusta experimentar solo que a veces no se como continuar una melodia o meterle una variacion/modulacion y por eso pense que quiza los que componiais para nes teniais alguna especie de guia o recursos o estructura de canciones o lo que sea para componer esas melodias tan pegadizas, bueno seguire estudiando, un saludo!

ok, thanks Alberto, I like to experience that sometimes just do not know how to continue putting a melody or variation / modulation and so I thought maybe that NES componiais you had some sort of guidance or resources or the structure of songs or that is to compose such melodies as catchy, well continue to explore, a greeting!

by on (#85795)
Well, I think it's normal to start with a melody and reach a point where you don't know how to follow it. Happens to me all the time. Just need to persevere, or try another idea if you're stuck and out of time. Fortunately game BGMs tend to be short :)

I usually composed lots of ideas before selecting the ones which would go in the game. Sometimes you are not totally happy about the melody, or you have a good melody but doesn't suit the game at all. No problem, can be used later in another game. Some of my latests GB compositions were based on ideas I wrote in my ZX spectrum a decade before.

To me, the key to compose a catchy tune to focus on the melody and to forget about everything else. Once you have a good melody then you can start putting details all over it.

Hope it helps a bit!

Cheers

by on (#85866)
perseverancia! ya se me han ocurrido algunas soluciones a algunos problemas :)
si, eso que dices es lo que yo tambien hago, tengo varias improvisaciones que se me ocurren con el tiempo y voy grabandolas para mas tarde o cuando necesite de ellas editarlas y terminarlas.

perseverance! already happened to me some solutions to some problems:)
if what you say is what I also do, I have several improvisations that occur to me over time and I save it for later when you need them or edit them and finish them.

by on (#85870)
Una pregunta Alberto que no es sobre musica pero igual tambien la sabes, siempre he tenido curiosidad sobre todo esto, como se diseñaban los sprites fondos y demas graficos para los juegos de NES, Spectrum etc.. los dibujabais en papel y luego los pasabais a pixels o directamente en pixels?, los programas que usabais supongo que ya estan obsoletos pero cuales eran?
La persona que hacia todo esto requeria de estudios o simplemente era alguien que sabia dibujar bien?
Muchas veces he buscado material sobre todo esto en youtube pero nunca he encontrado nada a modo de making of desde el propio corazon de una de estas oficinas, me gustaria mucho ver como trabajaban pero como ya digo no hay practicamente nada al respecto.
Una cosa mas si no te es mucha molestia, podrias escribir en castellano tambien? es que uso el traductor de google y a veces no termino de entender bien lo que querias decir, si no te es mucha molestia :)


Alberto A question that is not about music but also know it as I've always been curious about all this, as funds were designed sprites and other graphics for NES games, Spectrum etc. .. drawings on paper and then pasabais directly to pixels or pixels?, programs usabais I guess they are obsolete, but what were they?
The person required to study this or it was just someone who could draw well?
Many times I have searched all this material on youtube but I have never found anything like a making of from the very heart of one of these offices, I would love to see how they worked but as I say there is practically nothing.
One more thing if you do not too much trouble, you could also write in Castilian? is to use the google translator and sometimes do not quite understand what he meant, if you do not too much trouble:)

by on (#85877)
Shao, those questions would be far off the topic and I don't want to hijack the thread.

Drop me a line to albertojgp @ gmail . com and I'll answer your questions in plain spanish ;)

by on (#85888)
shao wrote:
es que uso el traductor de google y a veces no termino de entender bien lo que querias decir

The same thing happens to us when we read the english parts of your posts, buddy. You should probably review the output, since some words are even left untranslated (pasabais, usabais).

by on (#85893)
I'm sorry, from now on will check to adapt the word if not translated

by on (#86450)
Wow, I didn't get notified there were so many comments!
Alberto, that's some really interesting stuff you said. And the way you compose...I know you were originally a graphics person and just had the talent of being able to compose music, like Mark Cooksey.
I took band for a few years but that didn't really teach me how to compose. The way I compose, I get an idea in my head, and if I think it sounds good, I will write it down, but if I think it sounds bad, then I forget about it, and most of the time, while I'm composing, I just compose as I go, something tells me what note to put in and how long it should be. I guess that could be called ad libbing. :P
Though if I ever wrote music for a game, I would try and compose something that would go as closely with the game as possible. Like if there was a space-adventure game, I'd probably make some techno-ish music. Or if there was a wrestling game, I would do some metal (which is kind of my specialty.) I don't necessarily have any inspirations to my NES music, but if I had to name some, they would be 90's bands mostly, mostly consisting of Alice in Chains, Nirvana, Pearl Jam, and Barenaked Ladies (and for those of you around the world, yes, that's their name.) The keyboardist of BNL, Kevin Hearn, inspired me to play keyboards. I also got what apparently is called perfect/absolute pitch, where I am able to hear a note and know what it is. I don't get how other people don't have it though, like I feel as though they too should also know the note.

by on (#86454)
If you have absolute pitch, that is a wonderful gift!

One of the things I liked more about making music for games is that it forces you to try and adapt yourself to different music styles and moods. Making "smurfy" music out of the game is not the same :D

I read what I posted some pages back I must clarify something.
Where I said:

Quote:
There are not many exact tempos to use if you update the sound driver only 16.6 or 20 times per second (NTSC, PAL), there's too much time between updates.


I really meant that there are not many good tempos if you update the driver every 16.6 or 20 milliseconds only (60hz, 50hz).

But as nobody said anything, I think nobody noticed or cared about it :lol:

by on (#86457)
Why, I noticed it back then, just thought it is not important to correct, as everyone who is into chip music would easily understand what you actually meant.

by on (#86458)
Most probably, but I'm a damn perfectionist! someone could get it for true. I'm glad you noticed it. :)

by on (#86459)
Quote:
Well, I think it's normal to start with a melody and reach a point where you don't know how to follow it. Happens to me all the time. Just need to persevere, or try another idea if you're stuck and out of time. Fortunately game BGMs tend to be short

I just wanted to say for me it's the exact same thing. I haven't composed music for a while but it always ended up like that. So either I made a bad end to the song, or made it too short :cry:

Quote:
I also got what apparently is called perfect/absolute pitch, where I am able to hear a note and know what it is

I'll probably never know if I have it too or not. Sometimes it works, I can tell which note it is immediately, and sometimes if I hear a song I know well in the wrong tonality I can immediately notice it. (for example when playing a NTSC game on my PAL NES :wink: )

However if you just wake me up and ask me to sing a A, I'll probably not be able to get it right.

Another "problem" is that I play an instrument that is called a Bb Cornet, this means when I play a C it in fact plays a Bb, and all brassbands partions are transposed to this. So it'll not be rare I'll have the cornet note in the head instead of the "correct" note. Not that this is a big problem but probably if I played a non-transposing instrument instead I would have this perfect/absolute pitch, that cornet prevent me to have.


About tempo I'm not sure what you're talking about. Low update speed such as 20ms or 16.7ms limits how fast the song can be, but it doesn't quantize tempos.
In my engine I use an incremental counter, and a tick will happen whenever an overflow happens.
A note does't always use the same # of frames but I don't think it does matter, does it ?

by on (#86463)
Frame rate do quantize tempos, actually. The counter overflow does not produce proper stable tempo, it produce a swinging tempo that is flows like 2-2-2-3-2-2-2-3 frames per row, and it could be noticeable, with staccato parts for example, or with arpeggio parts (arpeggio restarts on a new note).

Speaking of musical ear, I don't have perfect pitch, not even good relative pitch - these are handy, but are not necessary to make or play music, especially chip tune.

by on (#86477)
Quote:
Frame rate do quantize tempos, actually. The counter overflow does not produce proper stable tempo, it produce a swinging tempo that is flows like 2-2-2-3-2-2-2-3 frames per row, and it could be noticeable, with staccato parts for example, or with arpeggio parts (arpeggio restarts on a new note).


Exactly.

by on (#86488)
I'm not too sure what you're talking about.
Under normal circonstances, I use 24 "ticks" for a whole note, 12 "ticks" for a half note etc...
I think the shortest note allowed is 4 ticks. Also I make sure all notes goes in a "release phase" where the volume gets gradually lower 2 ticks before they end, so that notes are well separated.

Ticks happen on overlow of a counter so they typically apper in a sequence like 2,2,3,2,2,3,2,2,3 frames or something in the like.
This will make notes of equal lenght for example will do sometihng like 12, 13, 12, 13, 13, 12 frames, but I don't think human ear can perceive that.

For very short notes, if it ends up like 4,5,4,5 frames it *might* be noticeable but I'm not even that sure about it.

Well what do you suggest are the "correct" tempos that "work fine" on both NTSC and PAL ?

by on (#86489)
Sure, it is barely noticeable on long notes, although arpeggio restart still could be noticeable (jumps to restart from different notes). With short notes like 2-3 frames long it is noticeable. In fact, you can use it to your advantage with the triangle channel - it does not have volume control, but you still can add some pulsation in it by varying note lengths (like 3-2-2-2-3-2-2-2, looks familiar, isn't?). You can even add a very crude 'echo' this way. The counter based tempo could actually add unneeded and uncontrolled pulsation.

To get quality sounding music on a sound chip you actually have to use really fast speeds, like 2-3 frames per row, and that's where the problem with tempo counter starts to be noticeable.

I don't even think about tempos related to chip music, I only measure speed in frames - like 4,5,6,7,8 frames per row. You can calculate correct tempos from these numbers. If I need to make music a bit faster or slower, I use 'swing', altering the speeds manually - basically it is the same that the tempo counter would do, but with more control.

by on (#86490)
To me is clearly noticeable and not necessarily on fast tempos. Specially on the drums and hats which are very periodic by nature.

by on (#86491)
By "row" you mean a row in a tracker ? I never used trackers much and I don't like this format to compose music... I just use my own format which is more like MML.
But I guess a row in a tracker is like a tick in my engine exept you use less rows, usually 8 (??) for a whole note, when I use 24 ticks in my engine making it more precise.

by on (#86497)
Yes, I'm reffering to rows in a tracker. Usually it is 2-8 frames per row. 6 is default by tradition, it is 125 BPM for PAL. Usually it is 16-32 rows per measure, depending from the minimal note length you want to have.

by on (#86708)
Alberto, I got to ask,
How did you program the triangle drums? How hard was that?

by on (#86710)
The technique for programming drums using the triangle channel is very simple.

You use the triangle channel for very few frames (1 to 4, depending on the sound) with carefully chosen frequencies for each frame, along with the noise channel using also carefully chosen frequencies and volumes from a table.

The drum sounds take over the triangle channel temporally, cutting the sound of other parts (the bass line for example). That's why they use the channel only for very few frames. Also, if the drums sound loud enough the take over is a bit less noticeable.

I remember to have spent a lot, and I really mean A LOT of time tuning the tables of the drums until they sounded good enough (for my taste).

by on (#86712)
Ah. I ask because I've been recently listening to Fumito Tamayama's work on NES (and David Whittaker) and Fumito uses triangle drums. I can do covers of his work on Famitracker but I have to write at a really fast tempo (300, 256, 225, etc.)

by on (#86713)
Why would you want this, especially with these weird tempos? It is very easy to make triangle drums in Famitracker with the arpeggio sequence, the only problem is that you either have to make a drum instrument for every bass note, or just accept that drum pitch is changes along with notes.

jsr was asked long ago for a 'fixed note' feature in the arpeggio sequences, this would make things like these much easier to handle, and he even implemented it in a WIP back then, but it was never included into any release. What a pity.

by on (#86714)
Yeah I always throught it would be complicated to do this.
The way Alberto did it is probably fine but it's a problem the triangle drum(s) is/are "hard-wired" in the sound engine and can't be changed as the user wishes.

Arpegio would be fine, but it becomes a major problem if you need one arpeggio setting for every different note you use.

So yeah I think the "fixed note" in arpeggio mode is probably the best - but what about if you want a pitch that doesn't fall in a note but in between (to avoid the listener thinking the drums are actually melodic) ?

by on (#86715)
It is not that noticeable or bad if pitch of the drum vary a bit.

I don't think that fast pitch drop that is required for a drum could sound too melodic to create any problem for listener. Any real drums (rock drumkit, for example) has own tuning and need to be tuned just like any other musical instrument, but it does not create any problem, you'll never say that kick or snare (they are tuned as well) are 'melodic'.

by on (#86718)
AlbertoG wrote:
I remember to have spent a lot, and I really mean A LOT of time tuning the tables of the drums until they sounded good enough (for my taste).

And it shows. :) When I heard the songs from Asterix for the first time, I couldn't believe how good the drums sounded. I even reverse engineered the game to find out what envelope values you were using. ;)

Quote:
jsr was asked long ago for a 'fixed note' feature in the arpeggio sequences, this would make things like these much easier to handle, and he even implemented it in a WIP back then, but it was never included into any release. What a pity.

This is why I added (what I call) absolute note option to Pornotracker envelopes. The option can be set for each envelope value individually, so it's possible to make a sound which has the bass drum in the beginning using absolute notes, and then plays bass using whatever note the user entered.

by on (#86719)
Quote:
This is why I added (what I call) absolute note option to Pornotracker envelopes. The option can be set for each envelope value individually, so it's possible to make a sound which has the bass drum in the beginning using absolute notes, and then plays bass using whatever note the user entered.

That, along with the fact that you support true vibrato depts (that doesn't changes relatively to the note pitch) make your engine sounds way better than FamiTracker's !

by on (#86726)
In my music engine, all drums go through the sound effects engine. The kick drum in the opening to Zap Ruder, for example, is one sound effect played on the triangle channel and another sound effect on the noise channel. This way the drum sound naturally interrupts whatever's behind it.

by on (#89429)
Oh wow, Alberto Gonzalez posts here too!? Don't know how I missed this when I joined the forums. I just got finished listening to your SNES Asterix & Obelix Palace theme for a couple hours straight! :D

This is my favorite thread. It's nice to have a glimpse of what goes into programming chiptune sound drivers from my favorite artists on one of my favorite consoles.

Just wanted to tip my hat to Alberto. :wink:

by on (#89431)
Thank you very much KGN-004, I'm glad you liked the sountrack :O)

[off topic mode on]

Now that I've reached this thread again, please allow me to share some very old songs with you. Recently I have been uploading most of my ancient non commercial 8 bit tunes to a soundcloud page. There are tunes from ZX Spectrum, Game Boy, Amiga 500, and others, and they were composed as personal experiments or for unreleased games. Don't expect much quality, though!

If you like any of them, you can leave a comment on it and I'll be happy. Thanks! :)

http://soundcloud.com/joemcalby/tracks

[off topic mode off]

by on (#89462)
Thank you, Alberto, I'll be sure to check it out soon.
I can't access the internet at home (I recently moved into a new house, the cable guy's supposed to fix it today. If you're wondering how I can type this message without internet, well...I'm at school. :P)
Unfortunately, our school blocked SoundCloud. >:(