Log In  
Follow
carlc27843
Follow

In 0.2.2c

poke4(dst,peek4(src,len))

takes 0% CPU. e.g.

poke4(0x6000,peek4(0x0000,2048))

to copy spritesheet to screen for free.

Can we rely on this behavior? (please)

P#90592 2021-04-15 07:18

Cart #amstradchips1-1 | 2021-04-11 | Code ▽ | Embed ▽ | No License
25

Hooked on Amstrad Chiptunes - Volume 1 - Dave Rogers

Experience the glory of some of the most revered 80's CPC/ZX chiptunes from the comfort of your PICO-8 console!

  • Netherworld
  • Zynaps
  • Uridium
  • Cybernoid
  • Cybernoid 2: The Revenge
  • Nebulus
  • Marauder
  • Stormlord
  • Stormlord 2: Deliverance
  • Anarchy
  • Battle Valley
  • Herobotix
  • Turbo Boat Simulator
  • Bear-A-Grudge

Controls

right arrow - next song
left arrow - previous song

Tech

This cart emulates the Amstrad CPC/ZX Spectrum AY-3-8910 audio chip to output chiptunes to PICO-8's 5512Hz 8-bit mono PCM serial buffer. To feed the emulation it contains a sound driver capable of generating AY register inputs across three channels of tone/volume/noise-enable as well as a single shared noise tone.

The sound driver was derived from 13 different CPC games and one ZX game. All these games had their music composed or converted/arranged by (the legendary, in my opinion) J Dave Rogers, who also wrote the sound driver code for the games as was customary for chiptune musicians in the 80's. This common lineage made it reasonable to reverse engineer the Z80 code and generalize the driver to handle all the games' music.

I think it sounds a little better in native PICO-8 rather than on the web player. Understand however that in the CPC the AY chip was clocked at 1,000,000Hz (and 1,773,447Hz on the ZX), and emulators typically default to sample at 44,100Hz. Whereas PICO-8 ticks at 60Hz and the serial buffer samples at 5512Hz. Only so much can be done - the percussion/noise is especially vulnerable to low sampling rates.

The AY emulation code is augmented to support the waveform visualization by tracking zero-crossings - this extra work can be removed if the goal is pure audio.

Without the graphics, the sound driver + AY emulator runs at a consistent 24-25% of frametime on a 60hz cart. This demonstrates that, for the appropriate PICO-8 game, it's reasonable to completely emulate the music and sfx via the serial buffer. Alternatively the sound driver portion could be used to drive PICO-8's sfx/music buffers in real time which would allow a lot more music in the cart with full audio sample rate quality. Or do both and synchronize native sfx/music with generated serial buffer output.

The game logos were compressed with PX9

Edit 4/10/2021

Fixed credits for Herobotix and Battle Valley, and fixed percussion on initial part of Zynaps - thanks to feedback from Dave Rogers!

P#90136 2021-04-07 18:11 ( Edited 2021-04-11 07:30)

Cart #impossible-1 | 2021-03-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
39

Impossible Mission R.T.

Discovered #pico8's secret 5512Hz 8-bit digital audio out API.

Created a homage to this legendary 80's masterpiece to celebrate.

Thanks zep!

P#88937 2021-03-13 22:14

The pico8 manual states this about SFX instruments:

"SFX instruments are only retriggered when the pitch changes, or the previous note
has zero volume. This is useful for instruments that change more slowly over time.
For example: a bell that gradually fades out. To invert this behaviour, effect 3
(normally 'drop') can be used when triggering the note. All other effect values have
their usual meaning when triggering SFX instruments."

However it seems that adjacent notes (with the same SFX instrument and with the same pitch and non-zero volume) do cause the instrument to be retriggered when the second note is at index zero in a looping sequence. Also, setting the second note's effect to 3 inverts the behavior and the instrument is continued rather than retriggered, but only when the second note is at index zero.

The attached .p8 cart demonstrates this. It has these SFXs:
0: the SFX instrument
1: pattern looping from 0 to 8, with no effect on the note at index 0. The SFX instrument is retriggered at index 0.
2: pattern looping from 0 to 8, with effect 3 on the note at index 0. The SFX instrument is not retriggered at index 0.
3: pattern looping from 1 to 9, with no effect on the note at index 1. The SFX instrument is not retriggered at index 1.
4: pattern looping from 1 to 9, with effect 3 on the note at index 1. The SFX instrument is retriggered at index 1.
5: pattern looping from 24 to 32, with no effect on the note at index 24. The SFX instrument is not retriggered at index 24.

You have to download the cart and play SFX 1..5 in the SFX editor. It does nothing on the web:

Cart #huyiwodimu-0 | 2020-04-28 | Code ▽ | Embed ▽ | No License
1

This behavior reproduced in version 8_0.2.0d and 8_0.1.12c. I only tried those versions.

P#75534 2020-04-28 04:31 ( Edited 2020-04-28 04:39)

Follow Lexaloffle:        
Generated 2021-04-16 11:29 | 0.092s | 4194k | Q:57