It is currently Wed Nov 22, 2017 7:10 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 62 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
PostPosted: Fri Jul 01, 2016 2:03 pm 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19249
Location: NE Indiana, USA (NTSC)
dougeff wrote:
I find volume control to be one of the most important effects. Every channel, preferred.

Would four levels (1/4, 1/2, 3/4, full) be enough for this? Or is there a musical use case for more?

Quote:
Also, down the road, ot would be nice if we had a library of instruments, so every musician doesn't have to reinvent the wheel (or piano-ish volume envelope, for example).

I agree. Compose with pentlyas and let's build one.


Top
 Profile  
 
PostPosted: Fri Jul 01, 2016 2:17 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1831
Location: DIGDUG
How would that correspond to Famitracker's volume column? Something like...

D-F = 100%
9-c = 75%
5-8 = 50%
1-4 = 25%
0 = off

??

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Fri Jul 01, 2016 2:29 pm 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19249
Location: NE Indiana, USA (NTSC)
That'd be about right: 4, 8, B, F.

The thing motivating the limit of 4 levels is that the NES CPU is slow at multiplying, and I don't want to introduce a bunch of 256-entry lookup tables to make it fast. So I plan to make an engineering tradeoff among control, ROM space, and CPU time.


Top
 Profile  
 
PostPosted: Fri Jul 01, 2016 2:36 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1831
Location: DIGDUG
Oh good. I feel good about the new, improved Pently. It seems to be filling in the short-comings of other music drivers. I may try to use it in the future, for game development.

I'm not sure how sound effects will work with it, but I really haven't tried yet. It sounds like you've gotten it to work with your own games, so I guess I'll probably figure that out too, when I get to that point.

Edit...

Quote:
NES CPU is slow at multiplying....compromise


Agreed.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Fri Jul 01, 2016 2:46 pm 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19249
Location: NE Indiana, USA (NTSC)
Sound effects work in almost exactly the same way as the drum track. Each drum is made of one or two sound effects. Or did you mean you haven't had a chance to understand how drums work either?


Top
 Profile  
 
PostPosted: Fri Jul 01, 2016 2:53 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1831
Location: DIGDUG
Sorry, I mean game-generated sound events. Collect a coin = ding.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Fri Jul 01, 2016 3:07 pm 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19249
Location: NE Indiana, USA (NTSC)
In musicseq.pently, make sfx ding on pulse. Then do this from the game code:
Code:
  lda #PE_ding
  jsr pently_start_sound

(The "PE_" part stands for "Pently effect".)

Thread safety caution: Some people like to run the music engine in the NMI handler to avoid audible consequence of slowdown. If you call pently_update_sound in the NMI handler, don't also call Pently API functions in the main thread; that'll cause undefined behavior if it interrupts itself. Instead, add commands to a list in RAM that the NMI handler processes.


Top
 Profile  
 
PostPosted: Sat Jul 02, 2016 4:09 am 
Offline
User avatar

Joined: Thu Jan 19, 2006 5:08 pm
Posts: 747
Location: Shelton, Washington.
Is there a any possibility of ''Go to Track #n'' and ''Go to Previously Buffered Track'' effects for pently?

Makes things easier for full-on jingle effects, such as the ''Time Running Out'' jingle in mario games!

_________________
AKA SmilyMZX/AtariHacker.


Top
 Profile  
 
PostPosted: Sat Jul 02, 2016 4:48 am 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19249
Location: NE Indiana, USA (NTSC)
From the manual's description of pentlyconfig.inc:
If PENTLY_USE_ROW_CALLBACK is enabled, the main program must .export two callback functions: pently_row_callback and pently_dalsegno_callback. These are called before each row is processed and when a dalSegno or fine command is processed, respectively. They can be useful for synchronizing animations to music. For pently_dalsegno_callback, carry is clear at the end of a track or set if looping.

So turn it on and use pently_dalsegno_callback to know when to restart the music.

Do you want more details?


Top
 Profile  
 
PostPosted: Sat Jul 02, 2016 6:26 am 
Offline
User avatar

Joined: Thu Jan 19, 2006 5:08 pm
Posts: 747
Location: Shelton, Washington.
tepples wrote:
Do you want more details?


Yes... That would help a lot if more details are added

_________________
AKA SmilyMZX/AtariHacker.


Top
 Profile  
 
PostPosted: Sat Jul 02, 2016 6:30 am 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19249
Location: NE Indiana, USA (NTSC)
  1. When you start the song for a level, save the song number of the song for the level in a variable.
  2. When you play a temporary song that ends, such as a fanfare that time is about to expire, do not save its song number.
  3. In pentlyconfig.inc, change PENTLY_USE_ROW_CALLBACK = 0 to PENTLY_USE_ROW_CALLBACK = 1.
  4. Create a subroutine in your main program called pently_row_callback that does nothing (that is, immediately executes the rts instruction). This is required because the same configuration option enables both pently_dalsegno_callback and pently_row_callback
  5. Create a subroutine in your main program called pently_dalsegno_callback, and .export this subroutine. If called while carry is clear, this means that the temporary song that ends, such as a fanfare that time is about to expire, has ended. In this case, it should load the song number from variable in step 1, and if it's a valid song number, call pently_play_music.

If this is not enough, then as I wrote in this post:
Please give us more details on your requests for "more details". What parts of the post did you understand, and what parts of the post did you not understand? If you are unable to express what parts of the posts you did and did not understand, I will have to break up the explanation into smaller posts, as if this were a chat room instead of a forum, and ask you whether you understood each part.


Or did you want me to actually write the code for you?


Top
 Profile  
 
PostPosted: Sat Jul 02, 2016 4:20 pm 
Offline
User avatar

Joined: Thu Jan 19, 2006 5:08 pm
Posts: 747
Location: Shelton, Washington.
So from what i gathered... Follow how the NES Mario engines originally does things:

-Make and use a subroutine for Main to handle the two music buffers, One for main songs, and one for event (effect) songs
-Then store the songs in one of two buffers, Restore back to the main song when the event (effect) song finishes

I think it is good enough from here if so...

_________________
AKA SmilyMZX/AtariHacker.


Top
 Profile  
 
PostPosted: Mon Nov 21, 2016 10:52 am 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19249
Location: NE Indiana, USA (NTSC)
Many free software licenses require the license to be reproduced in full in all copies, such as the MIT License (Expat variant) currently used for Pently. This is why the NES Classic Edition's front end includes several pages of "Legal Notices". But then it can afford to do so because it has half a gigabyte of NAND flash for the Linux kernel, emulator, and game ROMs. NES games distributed on Game Paks, on the other hand, are in the tens to hundreds of kilobytes and may not have enough space to store a viewer for the entire software license in the binary. So the MIT License (Expat variant) alone might not be the best choice, as it requires the notice to be reproduced in all copies. This has already caused problems for use of Pently in ROM hacks.

There are a few other non-copyleft licenses. Before Pently moved to Git, I had been using a variant of the GNU All-Permissive License changed to limit the credit requirement to source code:

Quote:
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved in all source code copies. This file is offered as-is, without any warranty.


My project templates and the game RHDE: Furniture Fight still use this license.

If we find it useful to go with a better-known license, I was considering switching to the license of zlib, which similarly requires the full notice only in source code and encourages but does not require credit in object code. This license is also used by the Allegro 5 library, and it carries forth the spirit of the "giftware" license used by Allegro 4.

As the only contributor so far, I have the right to make this license change unilaterally, but I'm opening this to others' input because I'm nice. So comment here or in bug 10.


Top
 Profile  
 
PostPosted: Wed Jan 11, 2017 3:54 pm 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19249
Location: NE Indiana, USA (NTSC)
Channel volume control is checked into GitHub.


Top
 Profile  
 
PostPosted: Thu Jun 01, 2017 7:05 am 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19249
Location: NE Indiana, USA (NTSC)
I've proposed five enhancements to how arpeggios can be entered into a score.


Thoughts?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 62 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group