Pently: a flexible, space-efficient NES music player

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

Moderator: Moderators

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

Re: Pently music player is coming

Post by zzo38 »

tepples wrote:I'm supporting both behaviors in Pently's music compiler tool, selected with the command durations temporary or durations stick. But I wonder which to make the default.
If you can change it easily then it isn't really important which is the default, although in my opinion the MML style should be default since some people (including myself) may have used ppMCK to write music (while LilyPond is mainly for sheet music instead).
(Free Hero Mesh - FOSS puzzle game engine)
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Pently music player is coming

Post by tepples »

Just as a reality check, would this be any easier to understand?

Code: Select all

# Twinkle test
# by Damian Yerrick

durations stick
notenames english

# Drum kit ########################

sfx noisekick on noise
  pitch 10 0
  volume 10 10 8 6 4 3 2 1

sfx trikick on triangle
  pitch e' c' a f# e
  volume 15 15 15 2 2

sfx closedhihat on noise
  pitch 12
  timbre | 0 1
  volume 5 3 2 1 1

sfx openhihat on noise
  pitch 12
  timbre | 0 1
  volume 6 5 4 4 3 3 3 2 2 2 1 1 1 1 1

drum kick noisekick
drum tkick noisekick trikick
drum clhat closedhihat

# Instruments ######################

instrument fiddle
  timbre 1
  volume 3 6 7 6 6 5
  detached

instrument bass

# twinkle ######################
song twinkle
  time 6/8
  scale 8

  pattern melody with fiddle on pulse2
    orelative
    c'4. c g g a a g2.
    f4. f e e d d c2.
    g4. g f f e e d2.
    g4. g f f e e d2.

  pattern bassline with bass on triangle
    orelative
    c' g e g f c e c
    d f c e g b, c' g
    e g d f c e g d
    e g d f c e g g,

  pattern bassfinal with bass on triangle
    c'2.

  pattern beat
    kick4. clhat kick clhat4 clhat8

  at 1
  tempo 90
  play melody
  play beat
  play bassline

  at 23
  tempo 75

  at 24
  tempo 60
  play bassfinal

  at 24:2
  stop drum

  at 25
  fine
And this is what it's supposed to represent:
twinkle.png
twinkle.png (4.57 KiB) Viewed 15240 times
Attachments
pently.nsf
(1.8 KiB) Downloaded 536 times
zzo38
Posts: 1096
Joined: Mon Feb 07, 2011 12:46 pm

Re: Pently music player is coming

Post by zzo38 »

That looks like OK. It doesn't seem to quite match other formats but I think it is OK anyways; it is good for this music engine.
(Free Hero Mesh - FOSS puzzle game engine)
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Pently music player is coming

Post by tepples »

So let's see if you can figure it out.

No significant changes to the player itself, just the tools around it:
  • Experimental music preprocessor with syntax inspired by MML and LilyPond
  • Ported all data conversion tools to Python 3
  • NES shell: Hold Select to speed up by factor of 4
Attachments
pently-0.05wip2.zip
(70.09 KiB) Downloaded 533 times
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: Pently music player is coming

Post by dougeff »

I've been meaning to give the new Pently version a try, but I have a lot on my mind this week. I do appreciate that you included Python 3 stuff.
nesdoug.com -- blog/tutorial on programming for the NES
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Pently music player is coming

Post by tepples »

After this, I guess my next step is to make a FamiTracker text export to Pently input converter. It won't aim for fidelity as much as just being able to get patterns out. Here are the compromises that I had planned to make:
  • Custom frame rates are used only for tempo processing, not for envelope processing.
  • The first VRC6, MMC5, or Sunsoft 5B channel is mapped to the attack track.
  • The noise and DPCM channels are ignored entirely.
  • The volume column is ignored.
  • Recognized effects include arpeggio (0xx -> ENxx), portamento to target pitch (3xx -> legato on/off), grace note wait before row (Gxx), grace note before rest (Sxx), pattern break (D00), note slide (Qxy or Rxy), song end (C00 -> fine), pattern jump (Bxx -> segno and dal segno), speed (Fxx), and tempo (Fxx). Others are ignored.
  • Portamento to target pitch is reinterpreted as legato when nonzero (301 through 3FF) and not-legato when zero (300).
  • Note slide (Qxy or Rxy) is treated as a slide to a legato note y semitones up or down one row later.
  • Pattern break (Dxx) is always assumed to jump to row 00.
  • It is not recommended to include a lot of tempo/speed changes in a single pattern, as each will expand to a setTempo in the conductor track.
I'm not sure how to handle the noise channel, as FamiTracker allows playing a noise instrument at any pitch, while Pently assumes that all drum instruments use what FT calls "fixed" envelopes. In addition, all drums in Pently have finite length, while FT allows volume envelopes that end on a volume other than 0 (constant sustain). Should I treat each pitch at which a drum instrument is played as a separate drum?

And how would I go about figuring out the time signature in order to set the scale (whether a row means an eighth, sixteenth, or thirty-second note) and calculate measure numbers for at commands?

And is there demand for a way to assemble an NSF or NES program without having to have ca65 and ld65 installed?
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: Pently music player is coming

Post by dougeff »

volume column is ignored
Is there no volume control in Pently??
Should I treat each pitch at which a drum instrument is played as a separate drum?
Yes.
And how would I go about figuring out the time signature
Ask the user to enter input, or command line argument
And is there demand for a way to assemble an NSF or NES program without having to have ca65 and ld65 installed?
I'm fine with ca65, but it might limit the # of users.
nesdoug.com -- blog/tutorial on programming for the NES
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Pently music player is coming

Post by tepples »

dougeff wrote:
volume column is ignored
Is there no volume control in Pently??
Volume envelopes work; just not the volume column.
Should I treat each pitch at which a drum instrument is played as a separate drum?
Yes.
Hopefully that doesn't run into the 25 drum limit for too many projects.

The key signature (which controls choice of say D# vs. Eb), time signature, and scale may change from song to song or even during a song. The user may end up having to create a skeleton conductor track.
JRoatch
Formerly 43110
Posts: 422
Joined: Wed Feb 05, 2014 7:01 am
Contact:

Re: Pently music player is coming

Post by JRoatch »

Today I included pently into my main project, and this post is some of my initial thoughts and questions.

First of all I probably could of use any of the other freely usable solutions, but I like the conductor/pattern structure of the music as explained, and I also liked the general style of music so far composed so far.

For the functions that use fixed zero page locations (such as "snddatalo = 0" in pently_start_sound) I often assign them to a relocatable label called temp. Witch would be better to require? A 5 byte variable import or externally reserving specifically zero page 0 through 4?

pently_resume_music and pently_stop_music were not found with the linker.

I know this is not the case with every music engine (except maybe nerdtracker2), but i wonder if it's even possible to design the music data to be relocate without having to recompile the network of address pointers. I also wonder if it's easy to construct and play a pattern from RAM, so that there could be an option for the user to create and save some of her own music.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Pently music player is coming

Post by tepples »

43110 wrote:For the functions that use fixed zero page locations (such as "snddatalo = 0" in pently_start_sound) I often assign them to a relocatable label called temp. Witch would be better to require? A 5 byte variable import or externally reserving specifically zero page 0 through 4?
I have externally reserved $0000-$000F in all my own projects, starting the ZP segment at $0010. But the next release will allow temporary ZP to be relocated.
pently_resume_music and pently_stop_music were not found with the linker.
My bad. This will be corrected in the next release. Until I push it out, go down to line 156 or so and change .proc resume_music and .proc stop_music to have the prefixed names.
I know this is not the case with every music engine (except maybe nerdtracker2), but i wonder if it's even possible to design the music data to be relocate without having to recompile the network of address pointers.
In NT2, all offsets are ultimately relative to the start of a song, and songs cannot share instruments or patterns. I don't know how instrument or pattern sharing is possible with that sort of relocation.
I also wonder if it's easy to construct and play a pattern from RAM, so that there could be an option for the user to create and save some of her own music.
The Sound Effects Editor included in Double Action 53 uses a subset of Pently 0.04 configured to store sound effects' envelope data in RAM. If you want to make something larger in scope, you could set it up such the tables are at fixed positions in WRAM ($6000-$7FFF).
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Pently music player is coming

Post by tepples »

Got a new work in progress version:

0.05wip3 (2016-01)
  • Corrected namespacing of pently_stop_music and pently_resume_music (reported by 43110)
  • Allows relocating temporary zero page space (requested by 43110)
  • pentlyas.py: Refactored without "god object"
  • pentlyas.py: Changed syntax for arpeggio effect; the original was based on a misreading of MCK Beginner's Guide
  • pentlyas.py: Optimizes out data of combined envelopes (instrument attacks and sound effects) that are a subsequence of a longer one. This improves handling of the "latebanjo" and "bf98flute2" instruments in the example songs.
Attachments
pently-0.05wip3.zip
(75.65 KiB) Downloaded 493 times
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Pently music player is coming

Post by tepples »

In [url=http://forums.nesdev.com/viewtopic.php?p=163455#p163455]this post[/url], Kasumi wrote:They might say, "I need you to type up every single note/rest in a file in this format." And then you have to do it if that's how their game works and you want to make music for it. Or write your own program to make that easier for yourself. Or make them write a program to make it easier for you.
Other than the obvious conversion from FamiTracker's text export, what other conversion source formats are expected?
Kasumi wrote:Different engines/converters might make the same song wildly different filesizes, so there's no answer to how big the song could/should be.
Here's a formula to estimate the ROM size of a Pently project:
  • Engine: about 1.5 KiB
  • Sound effect: 4 bytes plus 2 bytes for each frame in the envelope
  • Drum: 2 bytes each
  • Instrument: 3 bytes plus 2 bytes for each frame in the envelope
  • Song: 4 bytes, plus 2 bytes for each tempo change, plus 4 bytes for each play or stop command
  • Pattern: 3 bytes, plus 1 for each note or rest, plus additional bytes for notes with oddball tied durations, plus 2 for each range shift (if the range is wider than 24 semitones), plus 2 for each legato (HOPO) sequence, plus 2 for each instrument change, plus 2 for each arpeggio change
In other news, qix in #nesdev plans to help me learn how to use Git and has put Pently on GitHub.
User avatar
za909
Posts: 248
Joined: Fri Jan 24, 2014 9:05 am
Location: Mijn hart woont al in Nederland

Re: Pently music player is coming

Post by za909 »

Is it possible to create a comprehensive guide that tells what can and cannot be when someone is composing music for Pently in Famitracker? (Also, I assume this is based on the current official stable build, though the 0CC fork has effects that equate Pently effects a lot better, like grace notes with Txy which is a delayed "note transposition")
I might be composing a soundtrack for a game using Pently, and as a someone who's been a Famitracker user for 6 years, a plethora of different questions pop up even when trying to come up with ideas for music. Can I do X or Y, or Z? What is the Famitracker equivalent to drums in Pently? Even having read the manual and a number of different posts, it's still a bit of a mess in my head, and at this point it might be worth learning how to use the engine as intended with the text/MML-style sort of thing. From what I can tell it's not too much different from making music with an assembly source by using labels, constants and whatever, but even if I end up going that route I'd say it's worth making a guide for people who want to go strictly with Famitracker because if someone is hired to make music in Famitracker, they need to have the rules explained to them thoroughly.
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: Pently music player is coming

Post by dougeff »

I thought he didn't have famitracker to pently support yet.

Also, I thought he was going to develop a pently specific GUI tracker...which would make famitracker support unnecessary.
nesdoug.com -- blog/tutorial on programming for the NES
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Pently music player is coming

Post by tepples »

za909 wrote:Is it possible to create a comprehensive guide that tells what can and cannot be when someone is composing music for Pently in Famitracker?
Not until I actually make the converter. I haven't had much of a chance to do so for two reasons: my recent illness and my having been hired to work on another NES game. Until then, please follow the guidelines described above at "Here are the compromises that I had planned to make" to see which envelopes and effects are most likely to end up ignored. Vibrato is ignored, and portamento-type effects become legato notes.

I apologize for the inconvenience, but paid projects, housework, my finances, and personal physical fitness take precedence over free projects, and I have not yet been hired to work on Pently. I had planned to incorporate Pently into my previous paid project, but the boss instead ended up going with a different playback engine because the project's composer found the "vibrato is ignored" and "portamento-type effects become legato notes" limits unacceptable.
What is the Famitracker equivalent to drums in Pently?
I plan to associate each combination of a noise pitch and noise instrument with a separate drum. If there are more than 25 such combinations, I plan to make conversion fail with an error message whose wording I have not yet made final.
Post Reply