Concerto Dev Log

All aspects of programming on the Commander X16.
Elektron72
Posts: 137
Joined: Tue Jun 30, 2020 3:47 pm

Concerto Dev Log

Post by Elektron72 »



28 minutes ago, kliepatsch said:




Hmm... That'll be a challenge to make efficient code for ?



I know this isn't implemented in the emulator yet, but would it be possible to use one of the VIA timers to trigger an interrupt when the YM2151 would be ready to receive more data?

User avatar
kliepatsch
Posts: 247
Joined: Thu Oct 08, 2020 9:54 pm

Concerto Dev Log

Post by kliepatsch »


Yes, I think it would be possible. But is it worth it? I think typical interrupt handlers burn quite a few cycles before they get to handle the actual interrupts. If interweaving the writes with other code turns out unfeasible, this might be a fallback solution

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

Concerto Dev Log

Post by ZeroByte »



12 minutes ago, Elektron72 said:




I know this isn't implemented in the emulator yet, but would it be possible to use one of the VIA timers to trigger an interrupt when the YM2151 would be ready to receive more data?



Not exactly. There's no way for the VIA to know what the state of the YM is - the only way to know that is to poll the YM status flag. The only way to do that automatically would be to have some circuit which did this. If I were going to build some kind of HW-based acceleration like this, I'd just make a circuit that had its own little RAM buffer. Obviously there's no WAY such a circuit would be in the X16 as they're trying to keep costs as low as possible. Heck, the YM2151 itself doesn't have a "notify when ready" feature. It does have an IRQ line, but that's only triggered by the 2 timers available in the YM.

What you _can_ do with the VIA is set a timer to a value just right for this task - say 145 cycles so that by the time the IRQ handler has figured out that the VIA is the IRQ source, the YM will have just finished the previous write. I'd suggest using one-shot timer mode. That way, you write the YM and then start the clock again - it will keep the same latched value (using the correct timer and timer mode CTL settings). However, this is expensive too because the overhead of setting up and returning from an IRQ burns cycles.



I used a VIA timer to regulate the VGM playback speed for Kevin's YM2151 testing on Proto#1. It worked well. The challenge there was my prog had to run on bare metal, as it WAS the ROM (no kernal, etc). Since VGM assumes 44.1KHz sample rate for chip msg playback, if you do the math, 1/44.1KHz > 68/3.5Mhz so it was guaranteed to not hit the chip when it was still busy from the last write. Not having VIA in the emu made debugging pretty tough since I'd never written any code for VIA before, so I had to poke around in the VIC20 on WinVice to make sure I was setting it up right.

Anyway, writing to the YM @ 44.1KHz intervals via IRQ was pretty expensive on the CPU - I forget how I derived the number, but I estimated it was taking around 25% CPU to do that, which is pretty heavy for just streaming bytes into a register.

The good news is that you don't really have to spam the YM @ 44KHz to play music on it. Most X16 VGM players I've seen on Github seem to clump the writes up into batches and time them with VSYNC instead and they come out fine.

User avatar
kliepatsch
Posts: 247
Joined: Thu Oct 08, 2020 9:54 pm

Concerto Dev Log

Post by kliepatsch »



1 hour ago, ZeroByte said:




I enjoy your demo vid for Concerto - and for whatever reason tho, I just suck at noodling with synths to make cool sounds tho. LOL.



Thanks for the compliment. I guess synth programming takes a fair amount of exercise (and also education). It has been a long-term hobby of mine.

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

Concerto Dev Log

Post by ZeroByte »



Just now, kliepatsch said:




I guess synth programming takes a fair amount of exercise (and also education).



I think a less-thinky-more-feely approach probably works best for most musicians, as music is truly a subjective experience. That's why I think FM has such a reputation of being hard to grasp. I'm considering buying one of those general-purpose MIDI boxes with a bunch of faders and knobs on it, hooking it up to my RPi and using GPIO to drive a real YM from the Pi - that'd give me the ability to just move sliders and feel my way to a patch design. Sliding a virtual slider on the screen works, but is a little less tactile than having a real knob that moving it instantly gives feedback. You know what I mean?

Like if you gave a synth to a 6yo kid, they wouldn't try to understand what an ADSR does when you use it to govern how the LFO modulates the PWM... no, they start turning knobs and go "hahaha that sounds cool!"

User avatar
kliepatsch
Posts: 247
Joined: Thu Oct 08, 2020 9:54 pm

Concerto Dev Log

Post by kliepatsch »


Quick note here that I am making good progress towards integrating the YM2151 into Concerto. In fact, it is already working and it is just a bunch of these pesky little details that need sorting out. Expect an update in the next couple of weeks.

Squall_FF8
Posts: 21
Joined: Sat May 30, 2020 8:14 am

Concerto Dev Log

Post by Squall_FF8 »


Woah so much work is done. That seems like the most comprehensive music project that target musicians. Excellent work!

It is good to hear that you are still working on this! That makes me eager to see the changes ?

BTW in the demo video there is Demo1/Demo2 buttons with nice tunes, which suggest some sort of file format. Skimming trough your source I didn't see the specification for that format, or any routine that plays a continues data.  Is such format and API function exists?

User avatar
kliepatsch
Posts: 247
Joined: Thu Oct 08, 2020 9:54 pm

Concerto Dev Log

Post by kliepatsch »


That player only existed in the first version of Concerto and was intended to be a cheap way to show it off. The song length was limited to 256 bytes and the snippets were hard coded into the program. But I am thinking about reintroducing something similar, extended so that longer songs could be played, as well. We'll see...

Squall_FF8
Posts: 21
Joined: Sat May 30, 2020 8:14 am

Concerto Dev Log

Post by Squall_FF8 »



Quote




The CONCERTO synthesizer is what I intend to be the sound generating side of a music making software for the Commander X16



You want to make the meat - an API that will do the heavy lifting to produce different effects, so an UI could use that to make/play music. In that regard what is music -  a sequence of this API calls in timely manner. Obviously you can do that by hard coding it, which maybe ok for short sequences like sound effects, but bad for longer ones. That is why you need a standard - specification of what commands in what format will be used by the player to transform them in API calls. And that is where the file format comes into the play - it describes how the commands will be placed in linear memory (RAM, files).

That is why it is important to create such standard/format, so an artist can deliver/spread his work in a transportable way. Imagine Photoshop without exports/saves - what good to have all that effects, layers, tools (and the API behind),  if you can't deliver the result? 


1 hour ago, kliepatsch said:




That player only existed in the first version of Concerto and was intended to be a cheap way to show it off. The song length was limited to 256 bytes and the snippets were hard coded into the program. But I am thinking about reintroducing something similar, extended so that longer songs could be played, as well. We'll see...



Hehe it might be cheap way for you, but was excellent way to grab my attention ?

BTW in your experience what is the potential of CONCERTO  for creating synthesized sound effects, like gunshot, collision,...?

User avatar
kliepatsch
Posts: 247
Joined: Thu Oct 08, 2020 9:54 pm

Concerto Dev Log

Post by kliepatsch »



1 hour ago, Squall_FF8 said:




You want to make the meat - an API that will do the heavy lifting to produce different effects, so an UI could use that to make/play music. In that regard what is music -  a sequence of this API calls in timely manner. Obviously you can do that by hard coding it, which maybe ok for short sequences like sound effects, but bad for longer ones. That is why you need a standard - specification of what commands in what format will be used by the player to transform them in API calls. And that is where the file format comes into the play - it describes how the commands will be placed in linear memory (RAM, files).



You understood correctly, that on its own, Concerto is kind of incomplete, since you cannot make music with it alone. Once I get to version 1.0, I might consider creating some sort of simple player format as you imagine. In the meantime, Concerto does have an API to play notes and to control the pitch of the notes (e.g. do pitch slides). Since I do not expect this API to change significantly (I only plan to add to it), people can already use Concerto as it is. (Of course, questions on how to use it are always welcome)

 


1 hour ago, Squall_FF8 said:




BTW in your experience what is the potential of CONCERTO  for creating synthesized sound effects, like gunshot, collision,...?



Even though I haven't tried making sound effects for games yet, I certainly think that Concerto offers plenty of options to create nice sound effects. The combination of VERA and YM2151 is able to produce some very juicy stuff (including drum sounds), and I think that it also benefits the creation of sound effects. If you plan to use Concerto for music in a game anyway, then it might be nice also for sound effects. However, if you *just* want sound effects, then I would consider Concerto an overkill, as the binary is not exactly lightweight. If memory constraints play a role, then dedicated sound routines would be much more efficient. Flexibility always comes at a cost. Concerto offers a lot of flexibility ?

Post Reply