USB MIDI?
Rick Murray (539) 13851 posts |
Strange it detects a bunch and then throws an error. Stranger that it detects the same one several times. I don’t actually know the endpoint flags; I just noticed that all of the ones that send stuff on my system have 128 added to the endpoint address, so I “guessed” that bit 7 was a direction.
? It shouldn’t say “NOTE OFF” when velocity is non-zero! I notice a “[Active Sense]” in your reply, but no indication of a clock. Does your keyboard not output the quarterbeat ticker?
I had StrongEd on the Pi and really didn’t get on with it. Now I have Zap. The program was written in Zap. MIDITEST – New version! http://www.heyrick.co.uk/random/miditest.zip I’ll yack about it on my blog; but for now here’s what is new:
The note will not silence if MIDI is disconnected or Esc pressed while a note is playing (I forgot, that’s for v0.03!). To silence, drop to BASIC and enter Apart from expanding the program with larger tables of recognised data, that’s pretty much it for the MIDI receive test. I didn’t bother with the tables as many of the options on my keyboard output System Exclusive messages in preference to standard MIDI codes. Like, say, changing the voice to “violin”. Hmm… |
Steffen Huber (91) 1953 posts |
@DavidS, where does the HALcome into play here? |
Rick Murray (539) 13851 posts |
Bugs in MIDItest (to be fixed in the next version :-) ):
|
john evans (1898) 63 posts |
Your tweaked program is better, thank you. I no longer have to fudge the endpoint. Looking forward to your next version. The velocity / note off was probably my incorrect transposition of an adjacent line. It’d be handy if alternate lines could have a different background colour to guide the eye. I haven’t yet worked out how to pipe screen output to a file so I just typed a few lines from the screen. Middle C indication works fine. Playing sound is very handy too :-) “I notice a “[Active Sense]” in your reply, but no indication of a clock. Does your keyboard not output the quarterbeat ticker?” The output snippet was from the “Uno” converting plain midi from the “dumb” MK-149. If you’d like me to send output from the posh keyboard (all self contained) just ask. That keyboard is much more recent. All tests until now have been on the recent 512m RPi. Every second invocation of your Miditest hard crashes the RPi. So, today I’ve tried Miditest on the now vintage 256m RPi, & no crashes even after several Miditest invocations. I REM’d out the MODE 28, hoping to see what was happening in the “Task” window (select on the raspberry in icon bar). Well, miditest doesn’t show up there. Is that the case for all BASIC programs? I see the BASIC window is immovable when MODE 28 isn’t used? Presumably that’s by design? |
nemo (145) 2556 posts |
The cake is a lie. I mean window. It isn’t a window. When you run a program on RISC OS it starts as a single tasking program. It has no windowing, and has full command of the screen. It stays like that until it calls Wimp_Initialise (which tells the Wimp that it is going to multitask) and then Wimp_Poll (when it actually does multitask). Before that, the screen stays exactly as it was when you launched the program, in the expectation that it is going to call Wimp_Initialise. However, if the program tries to output some text, the Wimp realises it probably isn’t going to be a multitasking program, so it draws a little GUI window on the screen, then opens a ‘text window’ inside it. A ‘text window’ isn’t a GUI-style window, it’s just a delimited set of rows and columns where text is allowed to be output, until something more sophisticated happens. MODE 28 is actually equivalent to VDU22,28, so also causes the little window to be drawn… but then the mode change happens and clears it. Another approach is VDU26,12 – that cancels the text window (so text can use the full screen) and then clears it (CLS = 12). I allocated two very useful filetypes – TskBasic and TaskApp – that are excatly like Basic and Absolute except they open in a proper multitasking TaskWindow, which is much nicer in the desktop. I’ll publish the appropriate boot resource some time today. I find TskBasic much more useful than Basic in that regard. |
nemo (145) 2556 posts |
Some time ago, Rick wrote:
That’ll be the ‘free bytes in buffer’, and represents the number of bytes in the buffer that are free. :-p It jumps about because while you’re taking bytes out, your MIDI device is putting more bytes in. This should probably be obvious by now, but I never overlook an opportunity to be pedantic. |
Rick Murray (539) 13851 posts |
Yay. Nice to know it works.
I’ll make the text coloured. Different backgrounds is more work (this isn’t ANSI.SYS after all!).
How bizarre. What happens? Freeze? Message?
Well, that (PiB256Mb) is the system I developed it on. ;-) Run it loads of times from Zap.
It isn’t a multitasking program – so it won’t appear in the task manager. As explained above, the “window” you see is what the Desktop does when it doesn’t know what else to do (a single-tasking full-screen program should set up the display at the start, so you won’t tend to see the fake window as it’ll get cleared away). |
Rick Murray (539) 13851 posts |
Duh. ;-)
Here’s a quote – larger listing on the first page.
Free bytes jumps from 311 to 248. Reading bytes reads the padding bytes so there is no valid MIDI data in the buffer. Likewise 253→190 then 191→128 then 133→70. Through all this buffer report weirdness, only two valid MIDI bytes were received. There are two options:
|
Rick Murray (539) 13851 posts |
I have written a short program. It should “open” my device, reset it, send a clock pulse, and then play a middle C. Any ideas? YES! A Middle C from Pi to keyboard. ;-)
|
john evans (1898) 63 posts |
“… Different backgrounds is more work (this isn’t ANSI.SYS after all!).” Good point :) Every second invocation of your Miditest hard crashes the RPi. Freeze, yes. No amount of ALT – Break, incantations, etc. escapes from it, so I have to pull the plug. I’ll try it on another 512 Pi to see if it’s repeatable. I REM’d out the MODE 28, hoping to see what was happening in the “Task” window (select on the raspberry in icon bar). Well, miditest doesn’t show up there. Yes, thanks to you & nemo for concise & very helpful information, which I’ve now put into my “essential info’” file :) |
john evans (1898) 63 posts |
“YES! A Middle C from Pi to keyboard. ;-)” Good progress! The few devices I have here are input only, so I’ll have to see if I can rig anything up to test that :) |
Tim Rowledge (1742) 170 posts |
It’s looking to me like this might be a problem looking for the solution of using the StreamManager module that was so helpful in getting sound working on Squeak. Add a layer on top of it as SharedStreamBuffer does for sound and you might be able to produce a really easy to hookup midi stream system. |
Rick Murray (539) 13851 posts |
Latest version of miditest (note – not tested due to LW radio, changes are minor, however so fingers crossed):
Colours: System Exclusive and System General (Time Code, Position Ptr) messages are in Magenta. miditest.zip (5K) |
Rick Murray (539) 13851 posts |
John:
Here is another for you. To quote stuff, write “
Included in the latest version of the archive is “playtest”. The same as the program above, except it contains a line saying Tim:
I was thinking about coding a bare-minimum version of the “MIDI” module. Not looked at the SWIs to see about feasibility, though I can say for sure that I have no plans to implement MIDImod’s “play what it receives” mode. Not unless the sources to the original are kicking around ROOL’s attic… Does anybody have, or know of, a free program that can accept and play or notate from MIDI input using the standard interface? This is for testing, not me scavenging (I use MuseScore on my PC…). For playback, well a poke around !Maestro’s code is…interesting! |
Rick Murray (539) 13851 posts |
If this is repeatable on the other 512Mb Pi; insert: |
john evans (1898) 63 posts |
Repeatable, yes, although sometimes runs 3 times before crashing now!
That has indeed crossed my mind ;-) |
john evans (1898) 63 posts |
Rick: I’ve just tried compiling Miditest with !ABC. No idea if it’s significant, but many warnings of “incorrect number of arguments” for lines containing COLOUR, e.g.., COLOUR255,255,0 Anyway, eventually it did compile, & naturally crashed :) It seems the crash is usually at some endpoint identified. I’ll take another look tomorrow (well, later today ;-) ) |
Rick Murray (539) 13851 posts |
950?! That’s a REM following the BGET#in%. Try something = comment out the BGET and replace it with b% = 0 and run the program. Does it still crash, or is something going wrong with DeviceFS via the BGET call?
Oh, all these not-really-BASIC things that are so out of step with the real BASIC interpreter that it isn’t funny. Go to BASIC on any version RISC OS 3.50 or later. Type COLOUR r,g,b: set colour to r, g, b. <sigh>
There is no output from then until something is decoded. You might want to insert some commands like Problem is:
What gets me is that it works on your 256Mb Pi, not to mention my 256Mb Pi, but it fails with the 512Mb model. Is it related to the Pi memory size? Is it related to memory size period? I think I will need to fire up my Beagle over the weekend and see how it behaves on that. You said you were going to test it on another 512Mb Pi (ummm, how many of them d’you have!?) – same thing? |
Tim Rowledge (1742) 170 posts |
Just by way of a reference to how MIDI is hooked up for Squeak – for several platforms – take a peek at:- |
john evans (1898) 63 posts |
Rick:
Yes, I was surprised at that. Part of my motivation behind compiling MidiTest was to attempt to debug it. DDT is, reasonably enough, ineffective again interpreted BASIC bugs :) So, I thought, compile it, then fire up DDT & see if that helps. Eventually I realised that DDT telling me there’s no ABC lib’s meant I also need to have !ABC sitting in the icon bar. That stopped that complaint. However, MidiTest still crashed after displaying: Identified device: USB3 I’ll REM the MODE 28, recompile & run that so at least I can maybe see if any dramatic changes in the task window displayed memory allocation when it crashes, & incorporate your suggested changes. Obviously my lack of knowledge yet regarding RISC OS isn’t helping, sorry about that. At least with RISC OS, I don’t have to wait a fortnight for the thing to reboot :) I’ve set up a static IP now so it’s even quicker to get to the desktop. |
john evans (1898) 63 posts |
IME, that strategy is essential. Some years ago, we were trying to find a new trainer, an almost impossible task. I realised straightaway this wasn’t going to last….. Thank you for those references. |
john evans (1898) 63 posts |
Whatever it’s displaying scrolls up the screen too fast to see. I can press escape to get out of it though. Just removed TRACE ON, so I can see that in fact the on screen display is exactly as my previous post, ending at the _ cursor. So yes, BGET area is looking promising? |
john evans (1898) 63 posts |
I bought another 512 to build a poor man’s Apple TV, or rather poor man’s Airplay. Its destination was at my Mum’s (no wifi, no internet, so adhoc essential) where it would be permanently plugged into Mum’s telly so that when my Sister visited she could show her any family photo’s she’d taken on her iPad sans Mum tripping up over thick video cables. The genuine article would have been best, but 90% of it would never be used, so at 1/3 the cost, the Pi was the best bet. As of 2 weeks ago, sadly it’s no longer necessary, & typical, just as the latest software release fixes the stuttering bugs that existed for hi-def films (Anime looks particularly good :-) ) |
Rick Murray (539) 13851 posts |
Writing on phone while on break at work… DDT is for debugging compiled programs. If you can read ARM, you’ll get some mileage there too. It is about as useful at dealings with BASIC as carrying runes to debug… Go to BASIC and type |
Andrew Daniel (376) 76 posts |
You could always try sticking a *spool miditestlog after a known good point to enable you to examine the trace output at your leisure. |