Uxn - Virtual Computer

how does one change the waveform in the piano?

If you look in the @on-control routine, you’ll see that the arrows are used to modify the address of the waveform, it moves the address that the APU reads from to generate a waveform:

.Controller/button DEI #f0 AND
	DUP #04 SFT #01 AND #01 ! ,&no-up JCN
		( move ) .Audio0/addr DEI2 #0001 -- .Audio0/addr DEO2 &no-up
	DUP #05 SFT #01 AND #01 ! ,&no-down JCN
		( move ) .Audio0/addr DEI2 #0001 ++ .Audio0/addr DEO2 &no-down
	DUP #06 SFT #01 AND #01 ! ,&no-left JCN
		( move ) .Audio0/addr DEI2 #0010 -- .Audio0/addr DEO2 &no-left
	DUP #07 SFT #01 AND #01 ! ,&no-right JCN
		( move ) .Audio0/addr DEI2 #0010 ++ .Audio0/addr DEO2 &no-right
	POP

The actual waveforms data are stored at the end of the file, for example, this is a waveform:

@sin-pcm
	8083 8689 8c8f 9295 989b 9ea1 a4a7 aaad
	b0b3 b6b9 bbbe c1c3 c6c9 cbce d0d2 d5d7
	d9db dee0 e2e4 e6e7 e9eb ecee f0f1 f2f4
	f5f6 f7f8 f9fa fbfb fcfd fdfe fefe fefe
	fffe fefe fefe fdfd fcfb fbfa f9f8 f7f6
	f5f4 f2f1 f0ee eceb e9e7 e6e4 e2e0 dedb
	d9d7 d5d2 d0ce cbc9 c6c3 c1be bbb9 b6b3
	b0ad aaa7 a4a1 9e9b 9895 928f 8c89 8683
	807d 7a77 7471 6e6b 6865 625f 5c59 5653
	504d 4a47 4542 3f3d 3a37 3532 302e 2b29
	2725 2220 1e1c 1a19 1715 1412 100f 0e0c
	0b0a 0908 0706 0505 0403 0302 0202 0202
	0102 0202 0202 0303 0405 0506 0708 090a
	0b0c 0e0f 1012 1415 1719 1a1c 1e20 2225
	2729 2b2e 3032 3537 3a3d 3f42 4547 4a4d
	5053 5659 5c5f 6265 686b 6e71 7477 7a7d

It’s just bytes equivalent to audio data between 0-255, that is what is being drawn in the piano waveform interface.

1 Like

@neauoire I’ve been looking through the source code and was wondering if all arithmetic is unsigned? It seems that way from the code, but I might be missing something as it’s a long time since I looked at anything low-level!

This is a great project, btw. Very inspiring.

yup, all unsigned :slight_smile:

1 Like

Not sure if this fits with the spirit of the project, but I only recently realized that libretro, the core of RetroArch, is a library meant to make it easier for emulator builders to access hardware. It’s a requirement (I think?) to have your emulator included in RetroArch and its derivatives.

Might make a good target for a port? There’s a ton of relatively inexpensive retroarch-adjacent linux emulator handhelds out in the world, one of which is my absolute favorite gaming platform this year.

I know there’s a C64 core available in RetroArch, so I’m assuming they support keyboards, not sure about mice.

Have been enjoying this thread…keep on keeping on you anachronistic assembly weirdos. :mage:

EDITED to include,

I missed this part of the thread! This is exactly why I posted above…I think the target to get onto the retro handhelds is libretro.

6 Likes

I was considering a Uxn port launched using a shell script from within EmulationStation for this purpose (and also getting LittleGPTracker to run in a similar manner), but now that you mention it, getting Uxn set up as a libretro core is the perfect way to get it working on basically any ARM handheld (or TV box) without needing to handle controller mapping and whatnot on a by-device basis.

6 Likes

This tutorial is indeed very well done! Assembly is not easy for me, but the tutorial will help to understand better how it works.

I’ve compiled Uxn on the Haiku OS:

10 Likes

okay, it’s time I try Haiku Beta 3.

2 Likes

@neauoire pardon my ignorance as I am rather software/tech illiterate, but could you further characterize the ethos of Uxn a little more, maybe in relation to things like pure data or supercollider, which can run on a typical OS, or something like Norns and the associated hardware environments (self titled/shield/etc).

Is the goal for this to be an alternate option? Or something that would be used in conjunction with existing tools?

I am super attracted to the simplicity and minimalism of what this project appears to be about, but wonder whether the level of complexity this project would support could handle some meaningful DSP, etc.

Thanks for your help in understanding and interest is piqued to watch this project develop further

I don’t think it’s really for dsp or music or anything in particular. it’s just a tiny virtual computer for whatever you want to use it for

1 Like

Hi! This was really fun to get working and inspired me—I had also been tracking Uxn changes from @neauoire while using a mac, and had thought of getting it running on iOS. But since you already started, I tried yours instead! I noticed some unbounded memory usage, so I fixed that:

UxniOS-less-mem

Kyle, let me know if you’re still working on this—maybe you’ve already moved well past this point in your own version, but I’d be happy to collaborate either way!

2 Likes

I haven’t tried yet to run my midi-usb device on haiku (I doubt it’ll work but I’ll try it nevertheless), but I’ve noticed the piano instrument in uxn is monophonic, while the drum-rack.rom can play several different samples at the same time (but maybe not the same sample in polyphony).

Is there a way to achieve polyphony for the piano, so it would be give more composition possibilities?

(Edit: my midi-usb is working, but it’s not possible to compile shim at the moment, because of portmidi which requires alsa, it hasn’t been ported to haiku yet)

There’s this:

https://retropietest.readthedocs.io/en/latest/Spinners,-Trackballs,-Lightguns,-and-other-Mouse-Devices/

And supposedly selecting mouse input for something like Mario Paint is pretty trivial.

1 Like

Ah right, there it is. Thanks for pointing me to the right spot in code. I don’t think my input setup has arrows keys, so I’ll move those to curses keys and move the musical keyboard maybe above the home row or wherever. Straightforward enough :slight_smile: :keyboard:=:musical_keyboard:

speaking of keys, the new section of the tutorial is now online!
uxn tutorial day 3, conditional jumps and the keyboard/controller

screenshot of a maze-like path drawn using squares that are either filled or outlined.

i’m always open to hear your comments, suggestions, corrections, and to see what you create by using its guidance :grin:

also, the previous sections had some updates, in case you want to revisit them!

13 Likes

@neauoire Great explanation! I had mostly understood the execution model at this point, but had to pour over the code to get there. I had confused vectors with interrupt vectors found in microcontrollers which interrupt current running code. Unless I’m mistaken, a Uxn “thread” will not return control to the host until it hits a BRK condition. Therefore there is no interrupting or preempting things that are in progress.

@karlin this was a quick proof of concept to ensure I could get C to work with Obj-C/Swift. I’m sure there are plenty of issues with the code, but I’m running into bigger problems figuring out good ways to map the Uxn devices for iOS. 100% would love collaborators on this, or you can take the repo over and I’ll pitch in. How much energy do you have for the iOS port? I’m not able to carve out a lot of time and energy myself.

1 Like

Spent the last 2 days redesigning Uxn’s PPU. It now has a much more straightforward UX, and now allows alpha for 2bpp sprites(0x5, 0xa and 0xf).

The screen device’s /color port was replaced with:

  • Screen/pixel
  • Screen/sprite

It will obviously take some time for all the emulators to catch up with the change, we’ll make sure to help with the migration, to what we hope, will be the last iteration of the Screen device(72 lines long). Let me know if you have any questions :slight_smile:

Sejo’s tutorial series has been updated to reflect these changes already!

10 Likes

Has anybody attempted a port to m5stack faces which is based on esp32? It might yield a nicely portable device similar to a teenage engineering operator.

Best,
– Olav

2 Likes

Looks like it would be a good portable Orca machine! Might be worth trying to put the ESP32 Uxn Emulator on it.

11 Likes

Heh, this makes me wonder about a Uxn port to color graphing calculators.

2 Likes

@neauoire This is all incredible work! Thank you for this. I’m VERY excited about the idea of UNX + ORCA + NDS for sequencing Eurorack, external synths etc. What are the midi out possibilities for the DS? If that setup is possible it’s an absolute game-changer. A row of NDSs running ORCA sequencing a bunch of different things is literally a dream come true for me.

A few questions:

  • How is midi out on ORCA NDS looking?

  • Any thoughts on how UXN ORCA NDS could be synced together? (so 4 NDSs in a row could sequence different synths).

This is the type of set up I use LSDJ tracker on GB DMG for. I’d MUCH prefer to switch to a stack of NDSs running ORCA. Seems so close to being a reality.

2 Likes