However, I think this is quite misleading, considering Draw State RAM offers some non-related functionality like controlling Devkit Mode, muting audio, and suppressing the pause menu. Furthermore, there are some graphics-related addresses in Hardware State RAM, notably for: the default print() attributes, the bitplane read/write masks, the undocumented high-color stuff, and the "Palette 2" shared between the recent fill pattern functionality and high-color modes.
I'd suggest both 64-byte areas be merged into a single 128-byte "Hardware Variables" area.
As the title says, the "code snippet within a line" markdown in the BBS doesn't properly respond to the end marker, and instead runs down to the end of the whole line.
Expected (but in bold):
This is a code snippet within a line!
This is a code snippet within a line!
Ftw, Discord with identical markdown handles the end marker correctly, so there's no excuse for this BBS to not do the same.
Can you please add a feature to PICO-8's WAV export function, so that each of the four channels have one WAV file each? I've been wanting to do oscilloscope views of PICO-8 chiptune music, but the "oscilloscope view" format requires one WAV file for each channel (so that each channel is seen as a separate waveform).
I've already mentioned you on Twitter about this, but you never replied:
This thread is intended for the sake of researching particular (and most likely undocumented) parts of PICO-8's STAT(), that @zep didn't reference in the PICO-8 manual. The cartridge above also shows a new way for PICO-8 game devs to read the root-folder cartridge list with LS() (you must be on the desktop PICO-8 and your root directory must have at least 1 cartridge).
If you, Zep, know anything about the STAT() numbers not seen in the manual, can you tell me what they are for? People have figured out these for the BBS 101~104:
- STAT(101) -> BBS ID (nil for local carts)
- STAT(102) -> Site name (blank string in exported HTML's, nil in desktop PICO-8 builds and exported binaries)
People have NOT figured out:
- STAT(103) -> Hash string of unknown encryption method (was 0 in 0.1.11g)
- STAT(104) -> False (when will this evaluate to true or some other value?)
This cartridge is intended for PICO-8 newcomers to learn how SSPR() works.
Up and down arrows: Selects the parameter to change.
Left and right arrows: Modifies number-parameter values (the two sets of X, Y, W, and H values).
Z/C/N (or the right face-button on mobile touchscreens): Changes number-parameter values by 8 instead of 1. This also modifies the flip settings.
Src. X: The X-coordinate of the spritesheet to draw from, relative to the left. Pixels outside of the 0..127 range will be treated as black.
Src. Y: The Y-coordinate of the spritesheet to draw from, relative to the top. Pixels outside of the 0..127 range will be treated as black.
Src. W: The width of the sprite's image, in pixels. Negative values are treated as 0, of which results in no sprite drawn. The image is stretched to the 'Draw W' width.
Src. H: The height of the sprite's image, in pixels. Negative values are treated as 0, of which results in no sprite drawn. The image is stretched to the 'Draw H' height.
Draw X: The X-coordinate of the screen to draw to, relative to the left. Pixels outside of the 0..127 range are invisible, so that the sprite can be pushed into the left or right edge of the screen.
Draw Y: The Y-coordinate of the screen to draw to, relative to the top. Pixels outside of the 0..127 range are invisible, so that the sprite can be pushed into the top or bottom edge of the screen.
Draw W: The width of the sprite itself, in pixels. Negative values allow a horizontally-flipped image, with the 'Draw X' coordinate representing the right side of the sprite instead of the left.
Draw H: The height of the sprite itself, in pixels. Negative values allow a vertically-flipped image, with the 'Draw Y' coordinate representing the bottom of the sprite instead of the top.
H-Flip: If TRUE, the sprite's image is flipped horizontally. Combining this with a negative 'Draw W' value results in a cancel-out, drawing the image without flipping it.
V-Flip: If TRUE, the sprite's image is flipped vertically. Combining this with a negative 'Draw H' value results in a cancel-out, drawing the image without flipping it.
The spritesheet used here is the one from Zep's Jelpi Test!
This cartridge is intended for PICO-8 newcomers to learn how each mode works.
Use the arrows to change the video mode. Valid modes are 0~7.
It writes to the address 0x5F2C in Draw State RAM to set the video mode (display resolution or reflection).
The sprites used here are Jelpi sprites!
How do I communicate between 2 or more PICO-8 instances on the desktop? Maybe you could make virtual GPIO pins that communicate with other PICO-8 instances on the host OS? What do you think, @zep?
WARNING: Depending on what music you listen to with this, the bars could produce flickering effects on your screen, which may be a problem for those diagnosed with epilepsy.
This cartridge's source code is a modded variant of "Music Visualizer Bars" by iaoth:
Thanks to him for his visualizer code base!
What I've changed (first version):
- Corrected the octave numbers to match the PICO-8 SFX editor.
- Fixed the waveform colors of the bars being wrong. The PICO-8 palette index it was referring to was 1 less than what the SFX editor references to.
- Changed the beige text color to white. Prevents blending with bars with the PHASER waveform (SFX editor value 7).
- Implemented displays for custom instruments (SFX 0~7) and effects (slide/vibrato/drop/fade/arp).
- The colors of the bars and displays now change accordingly if the instrument is either a fixed waveform or a custom instrument.
- Implemented the DROP and FADE IN effects (SFX editor values 3 and 4, respectively) to the volume bars' handling code. The code I added may not be 100% accurate, but if you have any changes to make to it, please let me know in the comments!
- Added a function to disable all loop/stop control flags in the music RAM, found at 0x3100~0x31FF in the PICO-8 memory map. This can be disabled by commenting out lines 9~11 in code tab 0.
Update March 27th, 2019:
- Changed the DROP and FADEOUT effects' speed in their respective handler code. It should be more accurate now.
- The position of the effect displays' texts are now pseudo-centered.
- The dark-gray color of the displays for custom instruments is now changed to brown, if it blends with the black background of the visualization.
Update April 3rd, 2019:
- Fixed custom instrument displays from showing "SFX -1".
- When the note volume is zero, the wave is set to -8 to make the bar black.
- Custom instrument bars are now changed to a darker gray. The note/effect displays are changed to white, to be like the fixed waveforms.
- Effect names now make use of PICO-8's own text string emojis.
- If PICO-8 plays note indexes beyond 31, they're now treated as being a zero-volume note. Fixes the bars playing inaudible pattern data, especially noted with Marballs 2 while I was making this update.
- Added displays at the top for showing which patterns and notes the channels are playing.
- Added another display for identifying what frames repeat or stop the track, by reading the music control flags of each of those 64 frames on the cartridge.
- Added a simple main menu to select a track the user wishes to play, rather than playing all tracks in one go.
Update April 5th, 2019:
- Made the loop and stop shapes brighter, as a result of preventing bars for displaying on the top 16 pixel rows.
- Frames with all three flags disabled will now be displayed with a dark-gray dot/pixel.
- Arp displays now show the exact note-cycle frequency division for the ~120Hz SFX clock.
- Tracks in the TRACK.DATA table now have support for loading from an external cartridge. If this is unspecified, track data from the visualizer cartridge itself will be used instead.
- Minor changes to the menu, including fixing a mistake where I didn't mention the left and right arrows would also select the track, which was already a thing in the previous update.
- Added the ability to stop a track during playback. When stopping, a 333ms fade-out is applied. However, you can still pause the track by pausing the cartridge.
- Removed the 3-line time code in the DRAW_VISUALIZER() routine that existed there and did nothing at all.
Update 2 (April 5th, 2019):
- Fixed bars 2~4 from drawing in front of the top displays.
- Fixed note nn indexes beyond 31 from showing on the "Rnn" displays.
- SFX speed is now more accurate to the PICO-8 SFX engine.
- Bars will no longer display beyond the limit (MUSIC_EVENTS.VOLUME[I]>7), improving max-volume FADE IN effects.
- More minor changes to the interfaces.
Update April 14th, 2019:
- Added support for the undocumented "half-clock" audio flags in the RAM. Even when they're disabled (which they always were in all previous versions), the drop/fade speed is now fixed in regards to that TIME() change in PICO-8 0.1.12.
- The 333ms fade-out is now more like an actual third-of-a-second fade.
- Added a screen-saver! I don't know if it's any good, but please tell me your thoughts about it in the comments!
- Removed more unnecessary parts of the code, including a blank MUSIC_EVENTS.LIST table that wasn't used.
Update April 15th, 2019:
- Fixed the FADE-IN movement from heaping over the top of the bar height position that represents the current note volume.
- The screen-saver color-changer now refers to the lowest-indexed active channel, instead of only the first channel.
- Changed the PEEK4() into the recently-added PEEK2(). Notes are 16 bits long, so NOTEDAT doesn't need to be 32-bit.
- When a track stops, it now automatically goes back to the main menu.
- Changed a few text label strings.
- Removed one more unnecessary code line that I forgot to remove.
Update April 16th, 2019:
- Text labels and code editor comments now feature lowercase letters. Since PICO-8 0.1.12 doesn't convert to lowercase letters when 0.1.11g did, this change was made.
- Fix to prevent the first frame of track playback from being drawn. This first frame had info from the previously-played track that shouldn't be drawn.
- Minor change to the code that gets rid of one FOR loop.
Update June 3rd, 2019:
- Added the ability to load up any file (but only on the desktop versions of PICO-8). Just pause the cartridge and select "TOGGLE FILE MODE". Pick a file and the starting music frame (00~63), and play!
- Changed PRINT() calls into the undocumented '?' syntax. Reduces token count if applied to the previous update of this visualizer.
- More minor tweaks. Again.
- Added an easter egg somewhere. Can you find it?
Update June 17th, 2019:
- Moved the flags display routine into a separate function, so that I could re-use it in the menu screen.
- Made each of the 64 frame bars and each of the pattern/row displays change their gray shade. If dark gray, it's disabled (doesn't play any SFX/pattern during the current frame). Otherwise, if light gray, it's enabled.
- Changed how the loops and red stop-flags look. This actually makes it better/possible to see some odd looping configurations. For example, "Morning Shower" starts on frame 00 and doesn't contain a loop-start marker. Thus, PICO-8 doesn't know what frame to jump to after playing the last frame, so it goes back to 00.
Update June 30th, 2019:
- Renamed this visualizer! This is the official thread, so why do I have to have the album's name?
- Changed the screensaver color-changing code to use STAT(25) instead of STAT(24). Fixes the color not changing on 1-frame loops.
- Added a new "Sound Attributes" menu that allows you to change undocumented audio features, such as the clock halvers, reverb filters, the distortion feature, and the lowpass filters while music is playing. Credit to @Synth_dfr for the icons!
NOTE: Due to some constraints with the PICO-8 audio engine, the half-clock feature causes oddness with STAT(24) if not all four channels have it enabled. Channels with the same SPD value and different half-clock settings eventually get out of sync, not good ;-(
Update July 5th, 2019:
- Set the pink (0x40) flag of sprites 252~255. Fixes a display's error when song playback ended and the "Sound Attributes" window was open.
- Rearranged sprites in the sprite editor.
Update May 9th, 2020:
- Code cleanup and optimizations for 0.2.0! Wow, PICO has indeed been in alpha for so many years, glad it's finally in beta then!
- Changed the screensaver.
- Changed the transparency in the "Sound Attributes" window. Basically, I have almost none of the spritesheet used up, so I copy the window's area to the spritesheet and change the draw palette.
- Changed the music-frames display, so that any start/end/stop flag combination is visible, along with which frames are used and where the playhead is.
- Moved the sprites into the code (written to spritesheet at runtime), so now only the code section needs to be transferred over to essentially copy the entire visualizer program (except the music/SFX).
NOTE: iaoth's original visualizer started off with having more than one code tab (the main init/update/draw tab, the music events tab, and a debugging tab which I removed). As such, the code needs to be copied tab-by-tab (or not, since each tab is literally separated with a special marker visible in .p8 text carts).
Update January 4th, 2021:
- Changed up the visualizer look a little bit! The bars now use a fill pattern to reduce eye-strain. (It has that
"pinball" aesthetic, doesn't it?) Let me know if you want me to revert some things back if you don't like them!
- Fixed a bug where the specified external cartridge file for the 1st track in the playlist isn't immediately loaded when PicoVisualizer is runned.
- I can't figure out why I wanted to have the sprites stored in the code... so I just put them back on the spritesheet for now.
- Yet more minor code changes.
Update February 13th, 2021:
- Added a new display for effects added in 0.2.2. (not used by PICO-8 Tunes Vol. 2)
- Updated the "Sound Attributes" window to support the effect toggles added in the upper nibbles of 0x5F40 to 0x5F43. I also gave a go at using some of the new P8SCII codes here.
- Fixed a crash in the BBS player when "TOGGLE FILE MODE" is selected, as a result of LS() returning nil.
- Yet yet more minor code changes.
- Allow playlists to be configured for native exports (Windows, Linux, OSX, Raspberry Pi) from PICO-8. This could probably allow custom playlists of other cartridges to be created without having to buy the fantasy console. When there's a way to get this fully working, there's a will to release binaries to the public. For now until then, if you want to see other songs with my visualizer, post some suggestions in the comments, and I'll reply with a cartridge!
- Fix 'CD [DIRNAME]' commands in the PICO-8 console from not working properly. When the cartridge is run, it gets all cartridge filenames from the directory, but trying to play them will attempt to RELOAD() from the root directory instead. A workaround (as of the time of writing) is to put this cartridge in the folder directory of where you want to load your music from. Open the PICO-8 config.txt, and change root_path to the directory of where your music is. After that, run PICO-8, then load up this cartridge and run it.
EDIT: It works if you don't change the root directory. Just copy and paste PicoVisualizer into every folder PICO-8 can access.
EDIT: You can now drag and drop files into the PICO-8 app and read bytes from it using a certain SERIAL() call, but I have no idea how I'm gonna handle interpreting files of either format (.p8 or .p8.png) for now.
To test all of my new changes to iaoth's visualizer, I thought I'd use something that really got my attention around the time I first started making them. That is "PICO-8 Tunes Vol. 2", released by @Gruber, which is a cartridge featuring 10 amazing tunes! You can find it here:
Also, if you keep seeing "Autumn Wind" screenshots through updates and changes, it's my favorite chilly PICO-8 song from this collection.
The sound and music editor data that's generated is 100% randomized! Music starts at a random position from 0 to 63.
Update May 10th, 2019:
Update August 20th, 2018: Slight change to show 15 color rectangles instead of only 7. This is not a song-related change.
Credit to Zep for the code base.