MidiMon 1.00, a USB MIDI app
Rick Murray (539) 13850 posts |
That address looks suspiciously like it’ll be in BASIC with registers in application workspace. You might need to recompile the module with debugging options to see what’s going on. That said, getting Rhapsody to crash messily isn’t hard. The best way I knew my MIDI export was good was when Rhapsody didn’t keel over stone dead. Can Rhapsody cope with the number of available MIDI devices changing on the fly? It wasn’t part of the original spec due to being a hardware upgrade, but with USB things can come and go…
I’ve cold started and loaded the module with my keyboard powered up so many times now… |
Rick Murray (539) 13850 posts |
Interesting the franglaise in the comments. ;) Step time works – it seems to behave in a manner not unlike my sequencer. Semi real time… it captures notes but it makes numerous mistakes. If I hold down a note, it seems to frequently insert a shorter note followed by a break. I notice, by the way, that it doesn’t capture expressions (key velocity or the sustain pedal). Real time misses a lot, but there’s work to do as it can only capture about fifty notes before bombing out with a No room for function/procedure call. I think there’s some unholy nesting going on there that’s slaughtering BASIC’s stack. The missing notes is an odd one, but the good news is that if you ignore the notation errors, the timing now more or less matches what was entered (I mean, it takes the same perceptual duration, I didn’t check it with a stopwatch!).
Oh, I didn’t know about that. Later: So much for 26/32 neutral, needs Aemulor. ;) Still, it allowed me to fix a couple of minor bugs in the MIDI export. |
Jean-Michel BRUCK (3009) 362 posts |
I found the culprit… I don’t know who fills the buffers but it’s not the MIDI module because it’s not running.I don’t think I have a module or application that requires the handler service? I don’t know if there is a way around this problem with the MIDI module, I will already see if I can stop the flow of Active sensitive from the Roland Rhapsody: Have you tested the !Runimage test version of 09/11/2023? I think I fixed the problem, but I don’t know if I included it in the latest test version… ESP: I bought a 32 bit version in 2007 which works without Aemulator. From what I understand, ESP software is now freeware,ROOL takes care of it but unfortunately they don’t have the sources… |
Rick Murray (539) 13850 posts |
I don’t think that’s the problem unless it’s causing the expander to do something weird. My keyboard sends Active Sense every 200ms (I don’t think this can be turned off) and clock ticks every ~28ms (can be turned off by selecting external timing mode). If it is causing problems for Rhapsody, you are nuking all the buffers before accepting input, right? ;) Ahem, I know it actually doesn’t – start Rhapsody, press a bunch of keys (on the piano) and then click the icon to turn on the recording mode and watch as lots of notes suddenly appear. |
Rick Murray (539) 13850 posts |
What is the actual order of DeviceFS activities at system shutdown? My MIDI module throws a spurious “Device not found” error on shutdown, so it seems to me that by the time I’m getting the ability to close handles, the device has gone. Should I, perhaps, be keeping an eye on devices other than MIDI – for example USB – and if that goes away first then just flag the handles as invalid and ignore the shutdown requests? |
Colin (478) 2433 posts |
“Device not found” happens on 2 occasions 1 a DeviceCall when the device doesn’t exist and the other an attempt to deregister a device which doesn’t exist. I had a similar problem but I deregister devices you don’t. You have to ask why some code is taking any notice of errors returned when deregistering – there’s nothing you can do about it. I suppose in your case the error is related to the the usb device which is deregistered when it disappears. The only difference I can see between your code and mine regarding usb is I close the files as early as possible – in the service call handler and you close files as late as possible in a callback. Maybe you haven’t closed the file before usb deregisters and that causes a problem at the fileswitch level who knows. Does a rmreinit devicefs make the error happen? |
Jean-Michel BRUCK (3009) 362 posts |
Hi,
Module’s Midi_init does it? Unfortunately I have problems with my keyboard…difficult to initiate reception. I run a simple test to check, but it works after resetting the keyboard multiple times. The buffer doesn’t want to wake up on its own? I thought it wakes up as soon as it reaches a certain filling level?I noticed in source code, that the Peter module wakes up the buffer every ms, and it works better. I use version 0.11 of Rick’s module. I’m making progress entering notes in rhythm using the keyboard in Rhapsody:-) |
Peter Everett (9846) 59 posts |
@Jean-Michel
This might be why we have to unplug/plug the keyboard a few times before it works. |
Jean-Michel BRUCK (3009) 362 posts |
@Peter Do you have a specific Windows driver for Keystation32?
Is this a problem with the USB (on RISC OS) or the module? What’s strange is that the problem with Rick’s module has become recurring. I will perhaps work on the buffers again (Colin had already helped me). About MidiSupport, I tested !SysExy, !MidiMole they appear in the routing, but the results are not the same as with the ESP version. For example MidiMole only displays reset systems. The other ESP tool is MidiSpy which is very practical for viewing all the MIDI channels of a device |
Rick Murray (539) 13850 posts |
The module issues a wakeup when it connects to the input endpoint, and also after dealing with the buffer in the upcall. Perhaps you could iterate the available devices and issue wakeups for them in irq_handler() to happen every time Timer1 fires. See if that makes any difference…? |
Jean-Michel BRUCK (3009) 362 posts |
@Rick Rhapsody investigations:
However it seems to work well with the modules. FastClock is not related to Tempo, Beat and Beats, I’m testing a solution to keep them in phases. |
Rick Murray (539) 13850 posts |
Yes, the Fast Clock is updated by hooking into the equivalent of Timer1 on the modern machines.
Sort of. RISC OS supports some of this itself in the sound system (hence TEMPO, BEAT, BEATS, etc being keywords in BASIC), and it’s also a way of synchronising MIDI devices. Typically one device would be the clock (internal timing) and the others respond to it (external timing). The reason that I say “sort of” is because the beat timing comes from somewhere. That where? The PRM says: Event dispatcher: Every centisecond the beat counter is advanced according to the tempo value, and any events that fall within the period are activated in strict queuing order.And the centisecond clock is derived from a high speed clock, just like (or maybe the same as) the Fast Clock. ;) There’s a relationship, though with Fast Clock you can get better accuracy than is possible with centiseconds. Hey, did you notice https://gitlab.riscosopen.org/RiscOS/Sources/Audio/MIDI/MIDIPlay ? |
Peter Everett (9846) 59 posts |
@Jean-Michel
No it’s Midi Class Compliant so uses the built in Windows driver. Both Ricks and my module can only connect to class compliant devices so anything that works with them won’t need a special driver on Windows.
I don’t think it’s a problem with Risc OS USB, and the Keystation works reliably on Windows so I doubt there’s a problem with that either. More likely just a situation that we have to deal with. My problem is that the Keystation is the only commercial midi device I have that is USB and Class Compliant. The other devices I have are either not class compliant or have DIN connections. I have a couple of USB to DIN adapters but they are home made and are class compliant but composite devices with streaming audio and midi interfaces. They work fine on Windows streaming 44.1k audio in both directions at the same time as playing Midi files through them I would have a go at trying the extra wakup’s myself in Rick’s code as I have the same Keystation, but As for the ESP tools,
What do you mean by “reset systems” ?. @Rick
This is ESP’s player module. It refuses to play about 10% of my midi files (about 100 ish). Sometimes the failure locks the machine. I looked at the source a while ago but decided it would be easier to give my player a MIDIPlay swi interface than to port all the assembler to GCC, and then try to fix it! Incidentally Rick, all I was going to try in your code a while ago (when I failed miserably) was to remember the interface number when searching for devices and then specify it in the call to OS_Find, so it would connect to composite devices. i.e. my dodgy home made beasties. But no matter, not important. |
Jean-Michel BRUCK (3009) 362 posts |
@Rick
From Acorn MIDI user guide:
Tempo is not just for the basic, it is the system tempo of the sound module. By default it is in centiseconds. It was adjusted to play the tempo score with Rhapsody. In addition, it is necessary to make the distinction when it comes to Real Time messages. (Not used by Rhapsody). In this case the TxCommands would be transmitted with a Fastclock Timing in ms and we would use MidiStart/Stop
Yes, may be ms will become standard with RISC OS, even for null events? The centisecond was when the processor was at 8MHz…
Rhapsody uses microbeat (see Acorn note above), I don’t think FastClock was available at that time. This is not a problem, but the timestamp with the modules is in ms and continuous, but the microbeat is reset to 0 for each capture. so this must be taken into account. The FastClock swi allows you to restart the Fastclock counting. The result is correct. So if I’m not mistaken it’s FastClock which is in the RxCommand? @Rick/Peter
Rool recovered the ESP software, unfortunately with few sources. Recently they made two ESP programs available in /downloads/common/Hardisc4: !Player et !RealTime (sound effect) These two programs in Basic have been revised and work very well. To test. @Peter The version of the ESP MIDI Module is 5.0 and should have reached a certain level. I had no trouble testing the ESP version of MidiSupport, I just added your MIDIUSb driver and MTimer module. I started wanting to build a driver for MidiSupport, but yours works, mine remained in embryonic form… If I have time I will test the Serial driver with my ARMX6. I found an adapter with a DB15 containing the hardware, it must have been for Windows. I have another expander to run at the same time.
I use a Steinberg UR22MKII USB to DIN conversion no problem and for audio streaming I can record (waw format) the output of the expander while Rhapsody is performing with my ARMX6. With Colin Granville’s software !Isocplayer, I can listen to it again. I also use !DigitalCd or !ProSound for editing. |
Lauren Etc. (8147) 52 posts |
Been prepping my next release on this to be done shortly, but in the meantime, anyone know how to get a hold of Peter? You there? I think I’ve found a little bug in MidiSupport while tweaking MidiMon for it. |
Lauren Etc. (8147) 52 posts |
Specifically, MIDI_InqBufferSize seems to have an off-by-one where it reports 2044 when clear, despite the Rx buffer size being 2048 as standard. Specifically, there is a line:
Where I believe the “-1” is unnecessary and results in it reporting 1 less byte free than actually exists. Correct me if I’m wrong. |
Rick Murray (539) 13850 posts |
One less word. ;) Thanks for rummaging, things like this help improve the software for everybody else. 👍 |
Dave Higton (1515) 3534 posts |
Are you sure that it really is an error? In a circular buffer, either you have a flag to denote the difference between completely full and empty, or you leave one item unfilled. I haven’t looked at the code, so this is a suggestion to check, not a statement that it is wrong. |
Lauren Etc. (8147) 52 posts |
Hm, good point Dave. I’ll have to check later. I haven’t ever been right about a single thing in my life, so I’d be surprised if I’d started now. |
Clive Semmens (2335) 3276 posts |
Well, either that’s right, in which case it’s wrong, or it’s just wrong. Sorry for flippancy, I’ll get me coat. |
Peter Everett (9846) 59 posts |
Right, I’m awake now, I think.
I get most confused with things like this and usually resort to testing with a buffer size less than ten so I can use my fingers. I thought it did need the -1 for the reason Dave said but I also could be wrong so I will check. Lauren, if you need to wake me up in the future my email should be in one of the readme files. |
Lauren Etc. (8147) 52 posts |
Oop, so it is, I thought I looked for that email but I must not have looked very hard. For what it’s worth, that calculation isn’t used anywhere except the return value of the SWI, so changing it shouldn’t impact anything, but the only reason I was interested was trying to determine if the buffer was full, but that turned out not to be important for my needs anyway. And now, I get to feel awkward about bumping this thread up, because I’m about to open a new one for the next version… |