Page 1 of 3

Is a good think make my own Sound Engine?

Posted: Thu Feb 28, 2019 10:11 am
by kikutano
Hello,
I'm reading the tutorial to creating my own Sound Engine ( http://nintendoage.com/forum/messagevie ... adid=23452 ), the problem is that link above to download the source code zip doesn't work anymore. Anyone have a working link o the source code to implement that part of the tutorial? I'm trying to figure out how to create the simplest sound engine to play a loop song and some audio fx.

Thanks!

Re: Nerdy Nights Tutorial Source Code

Posted: Thu Feb 28, 2019 11:00 am
by dougeff
My advice for making a sound engine from scratch...

Don't.

Use an existing one.

Re: Nerdy Nights Tutorial Source Code

Posted: Thu Feb 28, 2019 11:07 am
by kikutano
dougeff wrote:My advice for making a sound engine from scratch...

Don't.

Use an existing one.
Can you link me one? :D

Re: Nerdy Nights Tutorial Source Code

Posted: Thu Feb 28, 2019 11:08 am
by dougeff
I think this is it, by the way.

https://bitbucket.org/ddribin/nerdy-nig ... at=default

I suggest everyone make a copy of this, for posterity sake.

Re: Nerdy Nights Tutorial Source Code

Posted: Thu Feb 28, 2019 11:59 am
by FrankenGraphics
Elaborating a bit on dougeff:s answer, i think it can be good to at least make something that does a simple BEEP, just to get in touch with the area. But writing a music and sfx engine from scratch will take a lot of time. I think it's well worth exploring a couple of the already available drivers.

https://wiki.nesdev.com/w/index.php/Audio_drivers

Once you have tried a few of them out, you'll have a fairly good picture of what the rest of them can do just looking at the specs. Then, if you happen to find yourself in the position where none of these drivers provide some feature that you'd like to have, then that's a good time to either make a fork or roll your own.

Re: Nerdy Nights Tutorial Source Code

Posted: Thu Feb 28, 2019 12:07 pm
by kikutano
I can sound some beep on NES, but if there are some pre cooked code or sound engine i'm really intetionate to Use it! :D

Re: Nerdy Nights Tutorial Source Code

Posted: Thu Feb 28, 2019 12:35 pm
by dougeff
I made a poll, it looks like most people here use famitracker to famitone2.

viewtopic.php?f=6&t=17812

which you can get from Shiru's website

https://shiru.untergrund.net/code.shtml

http://famitracker.com/downloads.php

The nesmaker people are using ggSound (they don't visit this forum). That is another option.

https://github.com/gradualgames/ggsound

Re: Nerdy Nights Tutorial Source Code

Posted: Thu Feb 28, 2019 12:53 pm
by kikutano
Thanks!

Re: Nerdy Nights Tutorial Source Code

Posted: Thu Feb 28, 2019 12:57 pm
by FrankenGraphics
Famitone2 and GGsound are relatively easy to swap out for each other.

Differences are:
-Famitone2 restricts you to keep any DPCM samples in instrument 0. Not a big difference, really.
-Famitone2 restricts you to 17 songs per project file
-Famitone2 restricts you to a note range of C-1 to D-6, which is often within margins of what you need, though not always.
-Famitone2 can't have loop portions in envelopes - this makes vibratos and glissandos a bit trickier to do, but you can still have them.
-Famitone2 can't do quick duty changes, since the duty envelope is restricted to 1
-GGsound restricts you to select 2 channels for SFX. I think Famitone can use any channel for effects at any time, though i might be wrong.
-GGsound requires you to keep the Bxx effect happening in all channels simultaneously - meaning that the pattern from where you wish to loop needs to be a unique instance on every channel.
-Famitone2 has the pattern cut effect, meaning patterns can be of different lenght. GGsound requires patterns to be of equal lenght.
-GGsound can have up to 256 instruments per project file, but it's hard to harness this capability since famitracker can only let you use 64 per project.
There are probably some audible differences in how both engines cut music to make place for SFX; i haven't compared that carefully.

So you need to balance what features you absolutely want/need just a little bit. With a little planning, you can make your famitracker project fairly agnostic towards what sound driver you'll end up using.

Pently is quite different from a user perspective, so take a good look at what style you prefer the most: pently or ggsound/famiton2-style.
One thing that is nice with pently in is the linear vibrato, meaning vibratos don't get as extremely present just because you're in a high pitch.
In the others, you might want to create different instrument copies for the same type of sound every other octave to compensate for this where needed.

Penguin is for being able to do raster effects without a scanline counter, since it is cycle-consistent.

Muse is for using musetracker instead of famitracker, which i haven't tried and can't say anything useful about.

Re: Nerdy Nights Tutorial Source Code

Posted: Thu Feb 28, 2019 4:17 pm
by Pokun
dougeff wrote:My advice for making a sound engine from scratch...

Don't.

Use an existing one.
My advice is to follow that tutorial if you are interested. It's an excellent tutorial and I didn't only learn how to make my own sound engine, but I learned a lot other things and how to become a better programmer in general. Especially as I was totally clueless how these kinds of things even worked.

Re: Nerdy Nights Tutorial Source Code

Posted: Thu Feb 28, 2019 6:08 pm
by gravelstudios
I can see it from both sides. On one hand, getting an audio engine working correctly can be an incredibly difficult, time consuming, and frustrating chore. I wouldn't blame anybody for deciding to use an existing tool to deal with this task.

On the other hand, there were assembly programming skills that I developed from doing it myself that I don't think I would have gotten anywhere else. The nerdy nights audio tutorials are just great programming tutorials generally. and as an professional musician as well as a programmer, I really wanted understand it well enough to make my own.

I do my own because I get a lot of satisfaction out of making it work. That's pretty much why I program anything. I love putting the pieces together and watching it go. but if you're more into the game design aspect and less the software engineering aspect, then by all means use an existing driver.

Re: Nerdy Nights Tutorial Source Code

Posted: Thu Feb 28, 2019 9:39 pm
by toggle switch
the first thing i did for the NES was build a sound engine that could play back sounds from an array of data. next i took the time to code a VST that i could use to compose music using Ableton Live.

however it was overly cumbersome to use and when it came time to actually make a game, i ended up using the combination of famitracker and famitone. i strongly strongly suggest you do the same.

it's fantastic practice to write an engine, and it's what i used to teach myself 6502 assembly and get more familiar with the hardware and basics of programming. but there are already mature solutions to this problem, and making an NES game is a fairly complex task already. it might be better practice to work on a scrolling engine or something.

Re: Nerdy Nights Tutorial Source Code

Posted: Fri Mar 01, 2019 12:59 am
by kikutano
The programming part to me is the easiest, I already coded all game engine and game code. I've covered almost all part of Nes Dev ( except for Bank Switching ), so I think I can write my own Sound Engine. BUT, I can't play music, I have no idea how music works, so I decided, for now, to use an engine to speed up a little bit my work. Nerdy Nights tutorial are amazing, I learned a lot from there, but the Music part is really really hard to make working. So I will try some pre cooked code for now! :)

Re: Is a good think make my own Sound Engine?

Posted: Fri Mar 01, 2019 1:52 am
by Banshaku
As for making your own engine, I would say no and it a wise choice to use an existing one. To make a proper sound engine, you need to understand how to make music and how it works so it will waste more time than anything else ^^;;; You can do for educational purpose but there is good chance that you won't use it.

The only reason to want to make a custom sound engine now would be because you game have some needs that other sound engine doesn't support, which I think would be very uncommon put possible.

Re: Is a good think make my own Sound Engine?

Posted: Fri Mar 01, 2019 1:56 am
by kikutano
Banshaku wrote:To make a proper sound engine, you need to understand how to make music and how it works so it will waste more time than anything else ^^;;;
This.

Btw I just downloaded GGSound, I will try it as soon as I can. :)