Log In  

Cart #picovisualizer-1 | 2020-05-09 | Code ▽ | Embed ▽ | No License

WARNING: Depending on what music you listen to with this, the bars could produce flickering effects on your screen, resulting in eye-strain. I noticed it with this music!

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).

To Do:

  • Allow playlists to be configured for native exports (Windows, Linux x64, MacOSX, 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 this cart into every folder PICO-8 can access.
  • Add a JavaScript interface for the virtual GPIO pins. Users can upload cartridge files and it will be uploaded to the PICO-8 browser-player instance running the visualizer.

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 music from this collection.

P#63059 2019-03-27 09:09 ( Edited 2020-05-09 08:14)

:: Gruber

Very cool and mesmerizing to watch, especially Autumn Wind 'cause it's a slow SPD!

P#63287 2019-04-06 13:03

@Gruber Thank you! I really like how you managed to squeeze some good music into just two channels!

Also, have you ever bothered to create music on TIC-80 yet? If you don't know what it is, here's the website:

P#63288 2019-04-06 13:59
:: Gruber

@StinkerB06 - Yeah, I've heard of it. The dream is to make music and tutorials for all these fantasy consoles and trackers. Hopefully, eventually, I'll get to it ;)

P#63291 2019-04-06 14:43

Uh, is anyone interested in my program? Seems pretty much dead.

P#70647 2019-12-07 00:51
:: dw817

Shouldn't there be 4-bars instead of 2 ?

P#70648 2019-12-07 01:35

There are 4 bars. Most of the songs here only use the first two channels, so the composer could have two other channels left for SFX in games.

P#70651 2019-12-07 05:37
:: dw817

Oh ... Hmm ... You know @StinkerB06 back when I was writing DOS games years ago, in my .MODs I used some of the instruments as available sound effects so they wouldn't overlap each other.

Could that be done here ?

P#70653 2019-12-07 07:12 ( Edited 2019-12-08 02:56)

I don't know what you mean.

This visualizer only just reads certain STAT() numbers and the music/SFX RAM, and processes a visual bar representation.

P#70662 2019-12-07 14:33
:: dw817

Maybe make it flashier ? Here are some examples.

A neat one would be where it's red at the bottom and works it way to blue at the top.

P#70666 2019-12-07 18:20

Sorry, I don't want to make it too complex.

P#70778 2019-12-09 18:28
:: dw817

Well now, let me think ... Don't know how good I am at this sort of thing.

Cart #kewewametu-0 | 2019-12-09 | Code ▽ | Embed ▽ | No License

you could use some sound bars like this ?

P#70780 2019-12-09 19:15 ( Edited 2019-12-09 19:43)

@StinkerB06 I like your cart. I love the songs. Also are these songs from other PICO-8 carts. cuz here is what I hear:

  • Need for speed from Sanki
  • Dimensional gate from corruption race
  • and more stuff
    And my favorite song on here is Flight of Icarus
P#76207 2020-05-08 23:02 ( Edited 2020-05-08 23:03)

@Blessmyday The source of the songs is mentioned in the description.

P#76209 2020-05-09 00:23

Which description

P#76766 2020-05-17 15:58

The description is right underneath the cartridge player on the BBS!

Here's the song compilation used:

P#76779 2020-05-17 18:34

Oh ok thx

P#76782 2020-05-17 18:55

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-09-26 18:48 | 0.094s | 4194k | Q:82