JOric

Comments, problems, suggestions about Oric emulators (Euphoric, Mess, Amoric, etc...) it's the right place to ask. And don't hesitate to give your tips and tricks that help using these emulations in the best possible way on your favorite operating system.
User avatar
ibisum
Wing Commander
Posts: 1869
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: JOric

Post by ibisum »

I'm not sure that having to go through menus or lists to select keywords would make the game more enjoyable and less distracting.
An easy way to select commands with the d-pad or joystick would make this so much simpler, Dbug. If it were possible to just press a trigger-key, and then scroll through the possible commands with the d-pad, it would mean the popup keyboard is just not necessary .. since, after all, "not much typing is done during the game" ..

Just link with libreadline, lol. /ducks.

Edit: anyway, this thread is about J'Oric, not Encounter, so .. either way, Oric emulators do need to tackle this issue.
User avatar
dreamseal
Pilot Officer
Posts: 85
Joined: Sat Mar 17, 2018 6:14 pm

Re: JOric

Post by dreamseal »

The past few posts have been an interesting debate. I can see both sides.

I'm not familiar with the Steam Deck, or in fact even knew it existed until today (that shows how much in touch with modern gaming I am; I haven't really used Steam itself much either, other than for a few 80s & 90s retro games). Perhaps if I can determine within the browser the physical size of the device, JOric could decide to do different things. For example, on my Microsoft Surface Pro, without the physical keyboard plugged in (not sure I can determine if the keyboard is plugged in with JS to be honest, or even the physical size, but I'll have a look), it could make the Oric screen smaller and fit above the keyboard. On my Android phone though, that would get quite small. I guess over time I could support all of these keyboard layout options and let the user decide which one to use.

I might review what other emulators are doing on mobile devices for landscape mode. It isn't great to obscure the Oric screen. I could make the keyboard more transparent, but then the keys become more difficult to see, and if I go the other way to make the keyboard less transparent, then the Oric screen is difficult to see. Not great either way.
User avatar
dreamseal
Pilot Officer
Posts: 85
Joined: Sat Mar 17, 2018 6:14 pm

Re: JOric

Post by dreamseal »

I'm getting close to having the sound code ready to be pushed for deployment. It took a while to figure out the best way to keep the emulation and audio output in sync, but I now have something that I'm quite happy with. It turns out that one of the most accurate clocks in the browser is the audio thread clock, from a behaviour perspective, but they deliberately prevent you from reading the accurate value. The same is true of the standard JS timestamp. So rather than emulating enough cycles for the time elapsed since the last animation frame callback, I'm now emulating enough cycles to keep the audio buffer at a roughly fixed latency. This means that the audio output rate, i.e. how quickly the audio thread within the browser is pulling samples from the audio buffer, is driving the emulation speed. Everything is then in sync and it seems to work quite well. When audio is turned off, it falls back on the normal JS timestamp instead.

The only outstanding question I have is with regards to cut off frequencies. I can add in a low pass and high pass filter as part of the audio output. I was wondering if someone can tell me what those frequencies are, i.e. the frequency above which and below which it is cut off?
User avatar
dreamseal
Pilot Officer
Posts: 85
Joined: Sat Mar 17, 2018 6:14 pm

Re: JOric

Post by dreamseal »

The sound code is now deployed, so you can try out a few examples to see how it sounds:

e.g.

https://oric.games/#/pushing-the-envelope

https://oric.games/#/rambo

https://oric.games/#/stormlord

https://oric.games/#/zip-n-zap

https://oric.games/#/quintessential

https://oric.games/#/barbitoric

If it is the first time going directly to a game link then the browser won't be able to turn audio on, due to browser API restrictions, and so the sound will start muted.

It can be turned on with the speaker icon (top left when in landscape mode). The reason it sometimes starts muted like that is because turning on sound with the browser API requires the code to be run within a user interaction, which is why it works when you go to the "home" screen (https://oric.games) and select a game, and also why it works when you use the speaker unmute icon. The direct links like the above do work automatically if you've already been to the website within your current browser session, e.g. you have it open in another tab, (as the audio context is already initialised in that scenario), but not when it is the first access. You can try it in a new private browser session to see what I mean.
User avatar
ibisum
Wing Commander
Posts: 1869
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: JOric

Post by ibisum »

Safari, iPadOS 18.1.1 - the emulator loads and runs (works great!) but there’s no sound at all, no matter if I try to enable it with the icon in the top left, or otherwise.

Very exciting to see your progress though!
User avatar
Dbug
Site Admin
Posts: 4910
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: JOric

Post by Dbug »

Very nice :)

How how hard would it be to add a PAUSE button to stop the emulation?
User avatar
dreamseal
Pilot Officer
Posts: 85
Joined: Sat Mar 17, 2018 6:14 pm

Re: JOric

Post by dreamseal »

ibisum wrote: Mon Jan 20, 2025 1:19 pm Safari, iPadOS 18.1.1 - the emulator loads and runs (works great!) but there’s no sound at all, no matter if I try to enable it with the icon in the top left, or otherwise.

Very exciting to see your progress though!
Thanks for the feedback ibisum. Unfortunately I don't have easy access to an iPad, or Macbook with Safari. A few questions:

* Is it possible to see console errors on an iPad?
* Does the issue occur on Safari on a Macbook as well (assuming you have one), or specific to Safari on the iPad? - I'm wondering if it is Safari specific or iPad specific. If it also happens on desktop Safari, then seeing the console error would be easier. - I could search online a bit for potential gotchas when using the Web Audio API's AudioWorklet APIs on Safari and the iPad.
* Does the sound work fine on Chrome on the iPad?
* You mentioned the iPadOS version. What version of Safari is it?

I'll check over the browser compatibility notes in relation to the audio APIs I'm using to see if I can spot anything I'm doing that isn't supported. Great to know that everything other than sound is working on the iPad though.
User avatar
dreamseal
Pilot Officer
Posts: 85
Joined: Sat Mar 17, 2018 6:14 pm

Re: JOric

Post by dreamseal »

Dbug wrote: Mon Jan 20, 2025 2:48 pm Very nice :)

How how hard would it be to add a PAUSE button to stop the emulation?
Thanks Dbug.

Yes, it shouldn't be too difficult to add a pause/unpause button. I'll add that to my todo list. Now that I have the sound almost working (need to sort out that Safari/iPad issue), I will start to work through the various suggestions mentioned over the past few weeks, including this one.
User avatar
ibisum
Wing Commander
Posts: 1869
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: JOric

Post by ibisum »

iPad/Safari testing: I will get the details a bit later in the day, when I have time to crack open a console for you.

On regular MacOS/Safari (Ventura, Safari 18.2), sound works - but there is a high-pitch whining which persists after, for example, CTR-L (clear screen on BASIC) which appears to be the 'last buffer' of the sound emulation stage, stuck in a loop .. if PING/ZAP/SHOOT/EXPLODE are used, there is an 'after-sound' which sounds to my ears like the last buffer of the emulation, i.e. the sound logic in your emulator doesn't properly go to zero, or finishes processing audio a buffer too soon, and thus never triggers an empty sample .. something like that.

I'm just testing in BASIC, btw, none of the demo's.
User avatar
dreamseal
Pilot Officer
Posts: 85
Joined: Sat Mar 17, 2018 6:14 pm

Re: JOric

Post by dreamseal »

ibisum wrote: Mon Jan 20, 2025 4:00 pm ...but there is a high-pitch whining which persists after, for example, CTR-L (clear screen on BASIC) which appears to be the 'last buffer' of the sound emulation stage, stuck in a loop .. if PING/ZAP/SHOOT/EXPLODE are used, there is an 'after-sound' which sounds to my ears like the last buffer of the emulation, i.e. the sound logic in your emulator doesn't properly go to zero
I believe I have fixed that particular issue, and it was indeed that it wasn't properly going to zero. I don't remember now where I copied the volume table from, which I would have done back in 2018, but for whatever reason the entry for index 0 wasn't a value of 0. I had a look over a few different people's implementations of the AY-3-891X chips for emulators of various machines and found a mixture of some that have 0 in the first slot of the table and others that don't. The spec seems fairly clear though, that setting the volume to 0 will turn off that channel, so a non-zero value in the first position of the volume table doesn't seem to make much sense (I'm really tempted to take a closer look at those reverse engineered schematics).

There still seems to be a very soft tone in the background whenever the sound is meant to be off. I'm certain though that the sample is now 0 in these cases, so it must be something to do with how I'm converting the sample to be written out by the Web Audio APIs.
Post Reply