Author |
Topic: Irregular timing on RPi ? (Read 1019 times) |
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 51
|
 |
Re: Irregular timing on RPi ?
« Reply #10 on: Aug 17th, 2017, 6:11pm » |
|
> more work and less likely to succeed!
It's more than just the SDL. Using other Basic's and Ruby I can write to .txt files and (evedently(no errors back)) to /dev/midi1 or /dev/snd/C1D0 but no sound ..... If I have no success, the next 'Stretch' version of Sonic-Pi supposedly will have a midi function. And your routines are usable but we'll see about the IDE. If I wanted the easy way I'd go back to Windows, but am enchanted by the RPi
|
|
Logged
|
https://www.youtube.com/watch?v=ePhUBBGyVmI
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: Irregular timing on RPi ?
« Reply #11 on: Aug 17th, 2017, 6:40pm » |
|
on Aug 17th, 2017, 6:11pm, hitsware wrote:| Using other Basic's and Ruby I can write to .txt files.. |
|
I have explained on many occasions that it's only because of SDL that I was able to create a cross-platform version of BBC BASIC at all. Over the years I have often been asked to port BB4W to Linux or to Mac OS (etc.); I have consistently - and honestly - explained that it's not practical because, as an individual and with advancing years, I would never have been able to acquire the necessary level of understanding of those operating systems.
SDL - the Simple DirectMedia Layer - changed all that. Now, almost magically, I needed only to learn the (relatively simple) SDL API in order to create a working version of BBC BASIC for Linux, Mac OS, Android etc. But - and this is the crucial point - it is BBC BASIC for SDL 2.0 and not BBC BASIC for Linux or BBC BASIC for Mac OS or whatever.
It is therefore unfair to compare BBCSDL with Ruby or any other application which has almost certainly been developed specifically to run on Linux (and probably by a team of professional programmers). I expect that when you open an output file in Ruby etc. it is directly calling the Linux 'open' API - as the SYS call in my program does. So it's hardly surprising that you find you can successfully open a MIDI output 'file' in the same way. But, of course, BBCSDL doesn't call the native 'open' function it calls a function in SDL over which I have no control.
It's entirely your choice what application you end up using, but please don't criticise BBCSDL for being BBCSDL!
Quote:| If I have no success, the next 'Stretch' version of Sonic-Pi supposedly will have a midi function. |
|
I can confirm that Raspbian Stretch has, sadly, not fixed the problem of the GL Driver breaking MIDI output. Not only that, but Stretch is even slower than Jessie if the GL Driver is not enabled - so slow in fact that BBCSDL is completely unusable. 
Richard.
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 51
|
 |
Re: Irregular timing on RPi ?
« Reply #12 on: Aug 17th, 2017, 8:07pm » |
|
> Stretch is even slower than Jessie if the GL Driver is not enabled > so slow in fact that BBCSDL is completely unusable.
Bummer  Even with the GL enabled the IDE is not comfortable for me. The snappiest Basic on RPi I've found is BWBasic which runs in the terminal ........ Which reminds me ........... Is there any way to enlarge the font with Brandy ? ? I'd like to try that, but the print is so small, as to be (for me) almost unreadable.
|
|
Logged
|
https://www.youtube.com/watch?v=ePhUBBGyVmI
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: Irregular timing on RPi ?
« Reply #13 on: Aug 17th, 2017, 8:22pm » |
|
on Aug 17th, 2017, 8:07pm, hitsware wrote:| Even with the GL enabled the IDE is not comfortable for me. |
|
Is this on a Raspberry Pi 3 (I asked once before but you didn't answer)? On my RPi3 with the GL Driver enabled I haven't noticed any significant delays; the most important thing is that it can keep up with typing speed and that's certainly true here (but I'm not a touch typist).
Is there a specific action that you feel is slower than would be desirable? There may be little I can do, but I'm happy to have a look at the BASIC code (so could you, of course).
Richard.
Edit: For my own satisfaction I've just repeated the test. Here is the setup:
Raspberry Pi 3 Raspbian Stretch VC4 GL Driver fully enabled Everything I tried, bar one, responded subjectively 'instantaneously' (I haven't tried to quantify it, but perhaps in less than 0.1 seconds). The exception was the 'File... Compare...' selection, which is slow at the best of times (on all platforms) because comparing two programs and displaying the differences is hard.
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 51
|
 |
Re: Irregular timing on RPi ?
« Reply #14 on: Aug 18th, 2017, 02:48am » |
|
> Raspberry Pi 3 Mine 3-B (FWIW?) > Raspbian Stretch Just got that this afternoon > VC4 GL Driver fully enabled I'll do that (for the experiment)
Download url ? I'll try to clone your install. (I can't believe it would be so bad (or would our perceptions be that different))
|
|
Logged
|
https://www.youtube.com/watch?v=ePhUBBGyVmI
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: Irregular timing on RPi ?
« Reply #15 on: Aug 18th, 2017, 08:49am » |
|
OK, progress. The claim that enabling the 'GL Driver' stops MIDI output working is false! What is actually happening is that enabling the GL driver creates a new sound 'card' called vc4hdmi which you can see by executing the following command in a terminal:
Code: Obviously, the creation of this new card means that the Virtual MIDI card you attempt to create using modprobe cannot use slot 1 - because that is now occupied - but needs to go at slot 2. In general, you need to know what sound card slots are already occupied before you can issue this command. Once this is appreciated MIDI output works perfectly with the GL Driver enabled (and thus BBC BASIC responding quickly).
Annoyingly I even reported the supposed GL Driver 'fault' at the Raspberry Pi forum. I should have been more sceptical from the beginning, since it was never plausible that it could have this effect. I suspect it was a case of copying code found on the web 'by rote' without actually understanding how it works - one of my pet hates! If and when I get around to writing a MIDI library I will attempt to make it adapt to what has gone before, for example whether the GL Driver is enabled or not.
Richard.
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 51
|
 |
Re: Irregular timing on RPi ?
« Reply #16 on: Aug 18th, 2017, 2:55pm » |
|
> I suspect it was a case of copying code > found on the web 'by rote' without actually > understanding how it works - > one of my pet hates!
I hate it too but must do it often to achieve my objective. For instance: Back with BBC4W everytime I wanted to do Midi I had to copy and paste your midi setup routine without an iota of understanding. I hated it but with my limited knowledge (and aptitude) for computers had no choice. And I continue to find myself in those situations.
|
|
Logged
|
https://www.youtube.com/watch?v=ePhUBBGyVmI
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: Irregular timing on RPi ?
« Reply #17 on: Aug 18th, 2017, 4:15pm » |
|
on Aug 18th, 2017, 2:55pm, hitsware wrote:| I had to copy and paste your midi setup routine without an iota of understanding. |
|
You could have looked up the Windows API functions it uses at MSDN, where everything would have been explained in great detail. It's sometimes a little harder to do the same for Linux API functions, because there isn't one central reference in the same way, but nevertheless Google will usually find it.
There is no reason at all not to understand code you are using, given the wealth of resources on the internet and the search engines that are so good at finding things. Two days ago I knew literally nothing at all about MIDI on Linux, but Google found everything I needed to know, and at no point did I find myself having to copy code that I didn't understand.
The most useful reference I found was here. It explains about the card index - which is how I discovered your mistake - device numbers and routing. It has allowed me to write BBC BASIC code (which will hopefully eventually go into MIDILIB) which is entirely self-contained - no need to issue commands in a terminal for example - and runs correctly whatever the pre-existing system configuration, whether timidity has already been run or not etc.
Richard.
|
|
Logged
|
|
|
|
|