Offline
Austria

Hi - I just did it big_smile

https://youtu.be/0_ymOkk_iFE

Does anyone know anothe tracker that can be fully synced? Defmon (cool!) I read can be started via a signal. But no tempo changes or so.

cheers! M64

Offline

Good work there. I was about to say that SidWizard has some kind of MIDI IN, but I guess that's not for sync'ing but just for entering notes (if even that?), but obviously it was precisely SidWizard that you had modified so you should know I guess. I am not aware of other C64 trackers that are sync'ed from an external clock. Dunno about Messiah though.. maybe that one can do that?

Other than that I guess the closest thing would be things like MIDI Slave and M64 (same name as your tracker?) that act as synth modules for external sequencers, but that do not contain any sequencers themselves.

It would be relatively easy to modify defMON — or any other C64 music editor really — in the same way that you have modified SidWizard, but I am not aware of anyone actually doing it, like you said.

(Otherwise defMON is typically acting as master. If you use the interface that scannerboy created, you can use defMON to send DIN sync and MIDI sync signals to external gear.)

Last edited by frantic (Oct 19, 2020 7:36 am)

Offline
Austria

Thank you frantic! Oh mssiah can work with a MIDI clock, but it isn't a tracker, I am not so interested in it.

You are right, SID-Wizard you can also use as a MIDI note player that is the MIDI in function.
And all the rest too, I personally like to have a tracker - and not use the C64 as a synth. Yes M64 is quite a cool thing haha. I found it after I gave my name. Damn! smile

It would be relatively easy to modify defMON — or any other C64 music editor really — in the same way that you have modified SidWizard, but I am not aware of anyone actually doing it, like you said.

Yesss! I even think of injecting this little routine into games like .. Arcanoid II - and play that in sync smile !

Thank you a lot for your feedback, much appreciated!

Offline

Right. So.. regarding the implementation.. Do you basically count the number of incoming MIDI clock messages, and each 6th (or 3rd?) clock tick, advance the sidwizard player one tick? ...or were there any other complications involved?

Offline
Austria

Oh I do not use MIDI at all. I have for a better description made this video https://www.youtube.com/watch?v=Hu4VytU-6Kc.

And I also do not at all tell SID-Wizard to advance on any moment, I want to stay tempo-setting / funktempo etc - independent. I am calling the player routine (ie $1003) itself.

In the IRQ handler there comes the point where it calls the player. This call I removed from there (not really, I left it for jam playing mode).

In the main loop (outside IRQ) I react on play (F1 or F3) then I
- disable raster IRQ
- enable my mode
- as long as in my mode and play:
   wait for a pin on the user port to go HIGH
   call player routine
   display stuff
   handle keyboard (checks for run/stop, F4 (=stop playback), the mute keys, etc )
   loop
- if stopped: re-enable raster-IRQ, restore display and internal variables

the mainloop must ofc be faster than 1 VSYNC, in order to make a playback > 100% possible.

The sync device outputs the corresponding frequency the usual raster-beam has. And just varies that speed then.

Offline
Austria

And - yes there were a lot of complications, mainly related to clean timing. On both the arduino, and the C64 side. When main loop takes too long, polling user port can skip a tick. So you read correct, I am polling big_smile

A better version would use a hardware interrupt, but I found it works _so_ stable, that I continued working with a main loop. Polling this pin in a mini loop is just a few cycles. This must be fast. So it is < 10 microseconds.
After pin went high, I wait for pin goes low. Then comes the phase where is more time: call player (< $20 rasterlines time), and display stuff. I know that I can expect roughly 50% of vsync time to be free for me. That is a lot. Then after that I must be fast again, because the next HIGH signal will come soon.

Did I write understandable? I am happy to go into more details. Thank you for your interest!

PS: I have removed all MIDI stuff (via settings file) from SID-Wizard, to make space for my code)

Last edited by MARiO64 (Oct 20, 2020 1:41 pm)

Offline
Austria

If you want I can share the piece of code, it is very small. I can also send you the .ino file, etc.
Then we can make defmon playback also to slave mode.

In order to receive MIDI clocks, there is 2 things to do:

a) measure time on the arduino between 2 clocks, then set arduino highres timer accordingly - to generate the "fake IRQ signal" for SID-Wizard or defmon or ... , and derive all other sync modes from it.

b) as I use a little arduino (nano), and it has only 1 highres timer - which I allready use, and the serial comm on arduino would use, too: we need another arduino, or a bigger arm processor with 2 highres timers.

Then we can also define another input pin to be used as for example "analog sync". And choose between MIDI sync, analog sync.

My first goal was to get rid of the tempo limitation. Not necessarily to receive external clocking on the arduino side. The device as sync master is sufficient for me. When I need MIDI devices, I can add a MIDI out very easily. And I can control the tempo so ... all fine for me, no need to be synced by anything else like MIDI clock.

Offline
Bratislava, Slovakia

Cool thread, i am also interested long time in MIDI implementations, especially on C64. For example, since i got 1541 Ultimate II+ cartridge of course I don't use floppy disk, and this device has got some incredible things for chiptune musicians, like two sid emulations (only 6581), there is also some Ultimate Audio module (7 voices for samples), and i have asked author of this wonderful device about some midi implementation, because i wanted to connect my midi keyboard to Cynthcart synth and play some things live, but up to now is not implemented, so at least i can use it in emulator VICE, where it works.

By the way, on github page i found some threat about it, and there is also some SID-Wizard MIDI in handling code:
https://github.com/GideonZ/1541ultimate/issues/16

Last edited by martin_demsky (Oct 20, 2020 2:23 pm)

Offline
Austria

Martin that sounds cool. You know SID-Wizard 1.8 has MIDI IN support, and MIDI SYNC OUT support.
And it supports standard C64 MIDI devices of course. I for example have used the Kerberos interface cart. SW 1.8 can run there now too. It has MIDI and flash in one. With it you would be able to do all SID-Wizard+MIDI related stuff. Also you can use cynthcart ofc.
May I point you to this: https://csdb.dk/release/?id=142049 it's IMHO the "best"  MIDI synthesizer for the C64. Maybe you can get any MIDI interface, unfortunately skip then the UII one , and do some great sound?
The problem I understand is very specific as your expansion port is blocked by C1541UII+ cartridge. What you told about the C1541UII+ cartridge sounds pretty amazing! I do not own one, so I can not really help there.
I focussed here on the synchronization of playback. And exactly to not need any specific hardware cartridge, I tried to avoid MIDI at all smile

cheers, M64

Offline
Bratislava, Slovakia

>The problem I understand is very specific as your expansion port is blocked by C1541UII+ cartridge.

Yes. I know there is some cartridge Xpanders (you can use 2 or 3 cartridges at same time), but i don't know if it works with UII+, Cynthcart or some MIDI interface at same time. And that goodies alltogether are pretty pricy, i like to keep things easy, so i will see how i will manage that sync adapter for defMON with TD-3, that should be enough in this year. smile

Last edited by martin_demsky (Oct 20, 2020 4:05 pm)

Offline
Austria

Ooh TB-3 hehe, that sounds like some evil sound hehe. I also used a TB-3, TB-03, and a TD-3 big_smile
For now I am happy to do "chiptune only", it is how I want to work in this phase of my life smile
Welllll .... yeah that sounds like a good plan, please feel free to PM me with any sound you make!
I really like defmon, I tried it some years ago, and can't remember why I went for SID-Wizard later.
I think it was the documentation probably. I was a novice on C64 tracking that time. Mayybe
I should have a 2nd look with my updated knowledge I collected over time smile
And I like you use it and will mix it with some acid sound yeah!
Please feel free to PM me any sound you are making. SID+acid is what I both really dig! smile

Offline

Hi, sure if the code is very small I could probably put it in defMON too, yes. Send me a PM? The interface required is not available to buy anywhere I suppose? (Sorry I haven't checked that new youtube video yet although I should.)

It may also be relevant to say at this point that a new MIDI interface is in production. It uses the user port, and therefore does not collide with the cartridge port (for users of cartridges = most C64 users) or with the serial port (if using the HerMIDI interface). It has full support for both MIDI IN and MIDI OUT, and can be configured to generate NMI interrupts on incoming MIDI data. Furthermore, it can  be configured to filter out incoming MIDI data on certain channels, and it it also possible to configure it to only receive certain types of MIDI messages, to save some headache for the midi parser in the C64 in case a lot of MIDI data is sent that should not be handled by the C64 anyway. While the original defMON probably never will have a very developed type of MIDI support, it will still support MIDI sync IN and MIDI sync out using this new interface. At least that's the plan. (As I said before, MIDI/DIN sync out is already supported using Scannerboy's interface). I am also working on defMON 2 though, and that one will be more explicitly built around the idea of having full (whatever that means) MIDI support — using this particular interface — and it will also support for at least 3 SID chips (e.g. at least 9 channels). I have a prototype of the MIDI interface here, and it works very well. An initial batch of units will probably be produced in the next few months. My role has been to dream up the kind of MIDI interface that I would like to have, and a guy in New Zeeland and another guy in the Netherlands are making those dreams come true for me.

Last edited by frantic (Oct 21, 2020 11:47 am)

Offline
Austria

Hi! Oh that is indeed very interesting news. I am happy for you, that sounds like a little dream come true hehe, cool. Abt my code - it is so small, that it would fit everywhere. But with this news it's probably useless. For one, I think noone except me would use that wink , and I like to use the user port for myself, it is easy coding with it. That conflicts with the new interface. What you are up to is more than an adequate replacement also.
Definately I will add a 2nd C64 to my setup, where I for now will run 2 wizards wink.
One I want to try defmon how I can work with it. For MIDI (and sync) support, I would then need to buy a new interface, whilst I am so glad to have no MIDI in my setup. I am pretty sure I will find a way to add "my" sync to defmon. That is the easy part. I can paste the code here, just for fun, you will see it's nothing wink But with this it's not done, ... without any controls over the sound (channel muting as a minimum), I would need to reverse engineer defmon a bit more, the playback position, current pattern, things like that, to display them. But that's just my personal way or imagination how I want to work. When I can have that way easier with a MIDI device, the option is still there to add MIDI sync to my device, and have both SID-Wizard, and the new defmon running in sync. Using the upcoming MIDI dream device hehe, that sounds cool to me.

Minimum sync routine:
// somewhere, ie on "pressing play", init tune
        lda #0
        jsr music.init

// ...

// sync routine:
!:  // now wait for: low->high               
        lda $dd01
        and #1
        beq !-
        // wait for high -> low
!:      lda $dd01
        and #1
        bne !-   
        inc $d020     
        jsr music.play
        jmp !--

// in this loop: add: check keyboard, and make a stop condition, and go back to editor

Last edited by MARiO64 (Oct 21, 2020 11:04 am)

Offline

Alright. That makes sense. If you want to experiment with defMON some day, and want to "inject" some particular code somewhere. Just send me a PM and I can insert the code for you. Not in the "official" version, but in a temporarily hacked version.

As for the official version, I'll stick with support for the Scannerboy interface and (upcoming) support for that new MIDI interface (called "The Vessel").

Offline
Austria

Thank you frantic. I will come back to you, after having played with my new toy, and having familiarized with defmon first