Improved-PPMCK

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

Moderator: Moderators

Do you like it?

Yes
2
29%
No
0
No votes
Maybe
3
43%
To make another suggestion
0
No votes
If this message cannot be understood
2
29%
 
Total votes: 7

zzo38
Posts: 1080
Joined: Mon Feb 07, 2011 12:46 pm

Improved-PPMCK

Post by zzo38 »

This is improved version of PPMCK. http://zzo38computer.org/nes_program/ppmck.zip (version 2)

New features includes:
  • #MACRO to make assembly macro
  • #CUSTOM-TUNING adjusts tuning tables, including the letters in the scale (which can be "a" to "j" now, not only "a" to "g"), and how many notes in one octave
  • #CUSTOM-NOISE to adjust noise table, to tell which noise is made from each note
  • #RAISE-VRC7 makes the VRC7 pitch higher but less relatively detuned from equal temperament
  • ? at the start of a line adds an assembly code to the output
  • * at the start of a line makes a preprocessor macro, which can be named by one letter, and called in a track or @ definition by * and the same letter
  • Xb set data begin of music
  • Xc call assembly code subroutine during playback
  • Xg branch the music to another point (even before Xb)
  • Xr to return from Xg
  • Xl make a label for use by Xg and by macros and assembly codes
  • Xm call a macro defined by #MACRO
  • ? in a track is a track questioning command
  • ' after a note letter (after - and + if there is any) to make one octave higher note
  • Some of the playback engine codes have been made tail recursion
  • K (transpose) can be used with all tracks
  • It will put "<?>" if #TITLE #COMPOSER #MAKER is not filled in (agrees with .NSF specification)
  • #PROGRAMMER is same as #PROGRAMER (both works same thing)
  • #EX-VRC-VII alias for #EX-VRC7
  • #EX-VRC-VI alias for #EX-VRC6
  • #EX-SUNSOFT5B alias for #EX-FME7
  • #EX-SUN5B alias for #EX-FME7
  • #EX-NAMCO163 alias for #EX-NAMCO106
  • Z is direct write to $4011 same as y$4011
Example of track questioning:

Code: Select all

#EX-VRC7

GHI @@8 o3 t120 l2 v13
G K0
H K4
I K7

*x ?HK4?IK8?.
*+ ?HK4?IK7?.
*- ?HK3?IK7?.
*o ?HK3?IK6?.

; Play eight chords using white piano keys
GHI *+c*-de*+fg*-a*ob*+c'
Last edited by zzo38 on Tue Sep 18, 2012 12:37 am, edited 5 times in total.
User avatar
Hamtaro126
Posts: 783
Joined: Thu Jan 19, 2006 5:08 pm

Re: Improved-PPMCK

Post by Hamtaro126 »

Maybe, It shall be a yes under the following terms:

All ASM Routines shall be at least in 4k or less ROM Space at $8000-$BFFF for use as the main program. in case one is to use it in games,

Add a GUI if needed, It makes the features down there easier to control, like _mic's XPMCK.

Let the user select any features needed, So they could shave off some unnessicary routines that are not needed for games!

Add a Sound Effects engine, (see SMWCentral.net's Addmusic v4.05 program, This is what I need)

Less RAM is good for games too, at least keep several ram variables around $0300-$07FF, and about 10-16 (decimal) more zero page variables at $00-$FF

the choice of the RAM range is truly ours to choose that way.
AKA SmilyMZX/AtariHacker.
zzo38
Posts: 1080
Joined: Mon Feb 07, 2011 12:46 pm

Re: Improved-PPMCK

Post by zzo38 »

Hamtaro126 wrote:Maybe, It shall be a yes under the following terms:

All ASM Routines shall be at least in 4k or less ROM Space at $8000-$BFFF for use as the main program. in case one is to use it in games,
I did not write the engine, although I have modified it. I could be able to make it smaller somewhat, and possibly with some features turned off makes more smaller. (I have not intended it to be used in games, although I don't know if the original author has intended this. Regardless, it is possible to use the data with different engines if you can understand it; you could write the engine to fit with the game, I suppose. The standard engine I have is intended for .NSF but may be usable with games too; I may be able to improve it to that point.)
Hamtaro126 wrote:Add a GUI if needed, It makes the features down there easier to control, like _mic's XPMCK.
I won't add a GUI (others can add it if they want).
Hamtaro126 wrote:Let the user select any features needed, So they could shave off some unnessicary routines that are not needed for games!
OK, perhaps they can either be automatically turned off or be activated/deactivated by a #FEATURE command.
Hamtaro126 wrote:Add a Sound Effects engine, (see SMWCentral.net's Addmusic v4.05 program, This is what I need)
Can you explain it better? I don't know about this Addmusic program. But I can think that for sound effects, you could use channels which is not used by music. It is also possible to poke the memory variables the address for those channels by the address of sound effect for playing if it is not DPCM (if it is DPCM, just access them directly). (If it is .NSF player embedded in different software, rather than NES/Famicom game, then hopefully the player library has a command to poke values into the emulated memory. If it is NES/Famicom game, then the addresses can be set easily of course, you also have .)
Hamtaro126 wrote:Less RAM is good for games too, at least keep several ram variables around $0300-$07FF, and about 10-16 (decimal) more zero page variables at $00-$FF
OK, I will try this.
Hamtaro126 wrote:the choice of the RAM range is truly ours to choose that way.
OK

Thanks for the suggestions. If I make changes to the program I will post the information here. I will also post the codes here when ready.
[url=gopher://zzo38computer.org/].[/url]
User avatar
Hamtaro126
Posts: 783
Joined: Thu Jan 19, 2006 5:08 pm

Post by Hamtaro126 »

Sound Effects are usually masked from music, creating effects of sound

on the NES, because people do not usually use expansion because of limits of the Euro and American NESes, only the original Famicom had such expansion hardware for sound!
AKA SmilyMZX/AtariHacker.
zzo38
Posts: 1080
Joined: Mon Feb 07, 2011 12:46 pm

Post by zzo38 »

I have posted the file now. http://zzo38computer.org/nes_program/ppmck.zip Including some additional features I have listed in the top message.

I have not yet added the feature you have suggested, but may do so later, but I may also accept patches.
Last edited by zzo38 on Tue Sep 18, 2012 12:37 am, edited 1 time in total.
[url=gopher://zzo38computer.org/].[/url]
jrlepage
Posts: 24
Joined: Wed Apr 04, 2012 2:15 am

Post by jrlepage »

I believe Jarhmander was in the process of adding some of his own improvements on ppMCK as well. Might be worth a shot communicating with him, see if you guys can team up or something so we don't end up with competing builds of ppMCK!
User avatar
Hamtaro126
Posts: 783
Joined: Thu Jan 19, 2006 5:08 pm

Post by Hamtaro126 »

jrlepage wrote:I believe Jarhmander was in the process of adding some of his own improvements on ppMCK as well. Might be worth a shot communicating with him, see if you guys can team up or something so we don't end up with competing builds of ppMCK!
Where is Jarhmander, for contact?
AKA SmilyMZX/AtariHacker.
User avatar
rainwarrior
Posts: 8062
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Improved-PPMCK

Post by rainwarrior »

Hamtaro126 wrote:All ASM Routines shall be at least in 4k or less ROM Space at $8000-$BFFF for use as the main program. in case one is to use it in games,

...

Let the user select any features needed, So they could shave off some unnessicary routines that are not needed for games!
The assembly source has always been included with PPMCK; removing features is very easy to do, and you can place the code at whatever address you need.
jrlepage
Posts: 24
Joined: Wed Apr 04, 2012 2:15 am

Post by jrlepage »

Hamtaro126 wrote:
jrlepage wrote:I believe Jarhmander was in the process of adding some of his own improvements on ppMCK as well. Might be worth a shot communicating with him, see if you guys can team up or something so we don't end up with competing builds of ppMCK!
Where is Jarhmander, for contact?
Ah, I thought he went by Jarhmander on these forums, my mistake. His profile is here, he is known as ~J-@D!~ on nesdev. :)
zzo38
Posts: 1080
Joined: Mon Feb 07, 2011 12:46 pm

Post by zzo38 »

jrlepage wrote:I believe Jarhmander was in the process of adding some of his own improvements on ppMCK as well. Might be worth a shot communicating with him, see if you guys can team up or something so we don't end up with competing builds of ppMCK!
Thanks for telling me about this. Let's them come on this thread too; perhaps we can combine these ideas with his ideas too.
[url=gopher://zzo38computer.org/].[/url]
User avatar
Hamtaro126
Posts: 783
Joined: Thu Jan 19, 2006 5:08 pm

Post by Hamtaro126 »

jrlepage wrote:Ah, I thought he went by Jarhmander on these forums, my mistake. he is known as ~J-@D!~ on nesdev. :)
Thanks.
AKA SmilyMZX/AtariHacker.
User avatar
Jarhmander
Formerly ~J-@D!~
Posts: 521
Joined: Sun Mar 12, 2006 12:36 am
Location: Rive nord de Montréal

Post by Jarhmander »

Thank jrlepage for the clarification: "~J-@D!~" and "Jarhmander" refer to the same guy (me). On #nesdev I'm "Jarhmnder" due to restrictions on the lenght of the account name

I already answered to zzo38's private message, but now that I have a bit of time I post a better answer here: yes I did some minor improvements on ppMCK. Here's what I did:

-Fixed some engrish in error messages
-Added "#EX-VRC-VII" : alias for "#EX-VRC7"
-Added "#EX-VRC-VI" : alias for "#EX-VRC6"
-Added "#EX-SUNSOFT5B" and "#EX-SUN5B" : alias for "#EX-FME7"
-Added "#EX-NAMCO163" : alias for "#EX-NAMCO106"
-Added MN<num> for XYZ tracks : it's like M<num> (Sunsoft 5B hardware speed) but produce tuned notes at NTSC speed.
-Added Z<num> : direct write to $4011 (like in FamiTracker)
-Added Y<num> : sample offset (like in FamiTracker, though because I never used the Y command in FamiTracker, I don't know if it does the exact same thing)
-Added @@<num> support for XYZ tracks, but results are not yet satisfying because of how the ppMCK driver handles the noise mode with notes.
-Added a weird hack (special looped mode) in DPCM code.

As you can see, they are rather simple improvements, if not simply "mods". The "weird hack" is only a change of the meaning of "IRQ DPCM mode" : it plays the sample in looped mode, but then immediately rewrite $4012 and $4013 with the last two bytes of the sample (added to that purpose) to change the loop points in the sound. Works on real hardware, but is likely not useful to anybody else. I can explain it more and post a demo of it in action when I have the time.

I'll come back with this when I finish my final exams and my project for the project course.
zzo38
Posts: 1080
Joined: Mon Feb 07, 2011 12:46 pm

Post by zzo38 »

~J-@D!~ wrote:I already answered to zzo38's private message, but now that I have a bit of time I post a better answer here: yes I did some minor improvements on ppMCK. Here's what I did:....
OK, I have added these aliases and the Z command to my version too. The others I do not entirely understand.

Thank you for information.
[url=gopher://zzo38computer.org/].[/url]
User avatar
rainwarrior
Posts: 8062
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Post by rainwarrior »

~J-@D!~, on the subject of a loop point for DPCM samples, do you need to use an IRQ? Can you just rewrite $4012/4013 with the loop points immediately after starting playback?

I haven't tested this on hardware, but I would kind of expect that the hardware doesn't read the $4012/4013 register values except when starting playback or restarting the loop.

Or... were you saying that this does work, and you had replaced PPMCK's DPCM IRQ feature with it as a hack?
User avatar
Dwedit
Posts: 4470
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

rainwarrior wrote:~J-@D!~, on the subject of a loop point for DPCM samples, do you need to use an IRQ? Can you just rewrite $4012/4013 with the loop points immediately after starting playback?

I haven't tested this on hardware, but I would kind of expect that the hardware doesn't read the $4012/4013 register values except when starting playback or restarting the loop.

Or... were you saying that this does work, and you had replaced PPMCK's DPCM IRQ feature with it as a hack?
If you try to change the loop point immediately, it may fail if there is a byte sitting in the DMC buffer. But it's safe to write the loop points one frame later. Need to wait for the remaining sample byte to drain, which can take up to 3500 CPU cycles.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Post Reply