GGSound: a lightweight sound engine for games

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

User avatar
GradualGames
Posts: 1107
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGSound: a lightweight sound engine for games

Post by GradualGames » Wed Apr 20, 2016 6:14 pm

Hi-pitch sequences are not supported at the moment. Please confirm if this problem goes away if you remove usage of hi-pitch.

8bitMicroGuy
Posts: 314
Joined: Sun Mar 08, 2015 12:23 pm
Location: Croatia

Re: GGSound: a lightweight sound engine for games

Post by 8bitMicroGuy » Thu Apr 21, 2016 1:51 pm

Can you please fix this song for me? I've been using VRC6 in my compositions and there's so many hidden features of it buried in the file. Please send it back to me in ftm format.

https://www.dropbox.com/s/33p062atowtu4 ... e.ftm?dl=0

User avatar
GradualGames
Posts: 1107
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGSound: a lightweight sound engine for games

Post by GradualGames » Sat Apr 23, 2016 7:06 am

Thanks so much for sharing your song, this is EXTREMELY helpful to me for making ggsound the best it can be for others to use.

First, I was able to successfully convert your song without error from ft_txt_to_asm.py by going into Edit -> Clean up -> Remove Unused Instruments. I will add a note to the README.txt advising users to do this before converting.

The only error you made 8bitmicroguy, with regards to how I have documented GGSound's features was:
-You need to duplicate your usage of B00, B01 etc. in all channels, in unique patterns at the very end of your song or you'll get incorrect looping. I may improve this in the future but that's how it works right now.

The issues I found in GGSound to play your song were:
-Parentheses in names in FamiTracker became symbols the assembler has trouble with. I will add a feature to the converter to sanitize all labels so you don't have to worry about renaming anything in your FamiTracker compositions.

-One of the channels incorrectly set itself up for looping.

Once I fix up the converter to sanitize names for you and fix the looping bug, I'll update the distro again. I'll also re-upload your song with the minor changes that were necessary to make it work.

User avatar
GradualGames
Posts: 1107
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGSound: a lightweight sound engine for games

Post by GradualGames » Sat Apr 23, 2016 8:02 am

Updated OP with distro with the above described fixes.

8bitmicroguy, here is your battle song with the fixes required to work with the latest version of the ggsound distro. Let me know once you've got it and I'll delete it from dropbox. The only new thing you'll need from that distro is ft_txt_to_asm.py for the assembler you were using, it's the only thing that changed.

The only changes I made to your song were:
-Edit -> Clean Up -> Remove Unused Instruments
-Duplicated B01 in all channels at the end of your song, in unique patterns.

Let me know if it works out for you! Thanks again.

8bitMicroGuy
Posts: 314
Joined: Sun Mar 08, 2015 12:23 pm
Location: Croatia

Re: GGSound: a lightweight sound engine for games

Post by 8bitMicroGuy » Sat Apr 23, 2016 2:16 pm

I've got it now and the script works. There are now battle3.asm and battle3_dpcm.asm files. I'm going to try and make a ROM.

8bitMicroGuy
Posts: 314
Joined: Sun Mar 08, 2015 12:23 pm
Location: Croatia

Re: GGSound: a lightweight sound engine for games

Post by 8bitMicroGuy » Mon Apr 25, 2016 1:13 pm

Urgh great. -.-

Relearned basic NES stuff again, wrote the program, tried to compile, bank overflow.
Then, I deleted one sample and looks like I broke my FTM file again

Code: Select all

H:\BLAHBLAH\Workspace\NES\Project03>H:\BLAHBLAH\Workspace\NES\Project03\ft_t
xt_to_asm.py H:\BLAHBLAH\Workspace\NES\Project03\battle3.txt
Traceback (most recent call last):
  File "H:\BLAHBLAH\Workspace\NES\Project03\ft_txt_to_asm.py", line 717, in <m
odule>
    main()
  File "H:\BLAHBLAH\Workspace\NES\Project03\ft_txt_to_asm.py", line 608, in ma
in
    dpcm_note_to_sample_length = dpcm_samples[dpcm_note_to_sample_index]["length
"] >> 4
IndexError: list index out of range

User avatar
GradualGames
Posts: 1107
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGSound: a lightweight sound engine for games

Post by GradualGames » Tue Apr 26, 2016 9:00 am

If you're willing to continue sharing each file which has trouble converting, I'd be happy to take a look! I've only ever tested with my own compositions, so there are bound to be some more bugs to weed out.

If I had to guess though, ggsound really only supports a single instrument having DPCM samples associated with it. If you have more than one, the behavior is undefined, as stated in the readme.

Secondly, I hope edit ...clean up...remove unused instruments will fix that up (I don't know if this affects deleted DPCM sample slots...). If not, I'd like to take a look at your ftm. Thanks!

Upon further thought, I bet the only problem is that your song is still trying to play a note which had been associated with the sample that you deleted. This is an assumption I made, so it just dies in this case. Perhaps I can try to add some easier to understand errors to guide the user. I'll update Wednesday.

8bitMicroGuy
Posts: 314
Joined: Sun Mar 08, 2015 12:23 pm
Location: Croatia

Re: GGSound: a lightweight sound engine for games

Post by 8bitMicroGuy » Tue Apr 26, 2016 3:14 pm

The sample that I've deleted wasn't used at all either by mapped notes or an instrument. Only the "DPCM" instrument plays the DPCM samples.

User avatar
GradualGames
Posts: 1107
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGSound: a lightweight sound engine for games

Post by GradualGames » Wed Apr 27, 2016 6:11 pm

8bitmicroguy, dpcm sample indexing was done incorrectly in ft_txt_to_asm.py. You can now remove an unused sample from anywhere in the list and it'll work. If you remove a sample that is indeed mapped somewhere, you'll get a nice error describing the octave, semitone and sample index (in FT) that was missing. OP updated with latest version. Let me know if it works out for you! Thanks once again for exercising this tool, you're helping me make this better for anybody who comes along and uses it. :D

8bitMicroGuy
Posts: 314
Joined: Sun Mar 08, 2015 12:23 pm
Location: Croatia

Re: GGSound: a lightweight sound engine for games

Post by 8bitMicroGuy » Sat Apr 30, 2016 7:47 am

Code: Select all

Traceback (most recent call last):
  File "H:\BLAHBLAH\Workspace\NES\Project03\ft_txt_to_asm.py", line 731, in <m
odule>
    main()
  File "H:\BLAHBLAH\Workspace\NES\Project03\ft_txt_to_asm.py", line 720, in ma
in
    master_stream.insert(loop_index + jump_frame, "%s:\n" % master_stream_loop)
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

User avatar
GradualGames
Posts: 1107
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGSound: a lightweight sound engine for games

Post by GradualGames » Sun May 01, 2016 9:24 am

Would you mind sharing the song that caused this error? Thanks!

*edit* Nevermind, it appears to be a regression from the fix for Bxx. Fix coming.

User avatar
GradualGames
Posts: 1107
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGSound: a lightweight sound engine for games

Post by GradualGames » Sun May 01, 2016 11:39 am

Alrighty, that should be fixed up now. The problem was when I fixed Bxx, I broke songs that don't use it :) See OP for updated GGSound distro.

8bitMicroGuy
Posts: 314
Joined: Sun Mar 08, 2015 12:23 pm
Location: Croatia

Re: GGSound: a lightweight sound engine for games

Post by 8bitMicroGuy » Sun May 01, 2016 1:50 pm

Wow. Now I get this error:

Code: Select all

H:\BLAHBLAH\Workspace\NES\Project03>H:\BLAHBLAH\Workspace\NES\Project03\NESA
SM3.exe H:\BLAHBLAH\Workspace\NES\Project03\Project03.asm
NES Assembler (v3.1)

pass 1
pass 2
#[1]   H:\BLAHBLAH\Workspace\NES\Project03\Project03.asm
   87  03:E051               lda #low(sfx_list)
       Undefined symbol in operand field!
   89  03:E056               lda #high(sfx_list)
       Undefined symbol in operand field!
  101  03:E072               lda #song_index_battle
       Undefined symbol in operand field!
  130  03:E0AC               lda #sfx_index_sfx_0
       Undefined symbol in operand field!
# 4 error(s)
And in the battle3.asm file,

Code: Select all

song_index_abattlea = 0
song_index_asfx_0a = 1

song_list:
  .dw abattlea
  .dw asfx_0a
Why does it say "a"? Why didn't it recognize sound effects? Is it some problem with strings? Also, I see that the samples that have brackets and dots in them have these weird names in the generated file:
"dpcm_sample_aD800udmca:" instead of "D800.dmc"
I think your string escapism code is doing nonsense. Can you make it that weird characters produce _?

Also, is there a quickfix for this where I can add sfx_list myself?

User avatar
GradualGames
Posts: 1107
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: GGSound: a lightweight sound engine for games

Post by GradualGames » Sun May 01, 2016 3:03 pm

Whoops! I see another problem I just introduced. This is making me want to add regression tests... I'll try to get it fixed up tonight. Cheers!

8bitMicroGuy
Posts: 314
Joined: Sun Mar 08, 2015 12:23 pm
Location: Croatia

Re: GGSound: a lightweight sound engine for games

Post by 8bitMicroGuy » Sun May 01, 2016 4:08 pm

Also, you should license your code with an open-source license like BSD because nobody is legally allowed to use it without it.
P.S. Please don't license it with GPL because the terms and conditions of that license would force my code to be open-source and unprofitable, but I'm planning to make a commercial NES game with a license allowing only those who buy the game to see the source code, modify, fork, etc..

Post Reply