Log In  


So I did this a few days after I got Picotron for the first time. I was inspired by Endfield's .mod player to make my own one. (I even checked how Endfield's sample mixer worked to make my sample mixer more optimized).

This uses luchak's PCM sample code as a base for outputting 8-bit PCM samples at 44.1kHz (I have noticed that there are resampling issues at least on the macOS and linux versions of Picotron when I use this script).

I was also inspired by my scener friend Nightshade's (currently unreleased) Picotron .mod player, which is less optimized than mine but has a nicer GUI and might have more accurate player logic? (afaik). I might also improve the GUI of this player a bit, but I'd have to learn how to detect when the program's window isn't rendered (or isn't shown), since I set both background_updates and background_draws to true when setting up the program's window (in order to make the program run in the background while in the code editor, etc.)
EDIT: (as of sept. 16) I've added support for rendering only when the window is visible with @Astralsparv's advice!

The player currently supports these effects: 0,1,2,3,4,5,6,9,A,B,C,D,E1,E2,E9,EA,EB,EC,ED,F

Anyway, feel free to use this anywhere, even in demos (just give me the appropriate credit where necessary :)).

Cart #aart_pt_modplay-2 | 2026-09-16 | Embed ▽ | License: CC4-BY-NC-SA
4

4


Woouldn't expect background_draws to be needed, but you can use the gained_visibility and lost_visibility events to know when the cart is visible.

on_event("gained_visibility",function(msg)
  doRendering=true
end)

on_event("lost_visibility",function(msg)
  doRendering=false
end)

(not sure if they have any unique msg but I thought I'd add that incase)


Nice!

> I even checked how Endfield's sample mixer worked <
You are welcome! :)
Unfortunately I never found the time to clean all that mess up to be usable by anyone else...
A little spoiler: it can be done quite a bit faster now than we did in the demo.



[Please log in to post a comment]