Author |
Topic: I must be missing something simple .......... (Read 2024 times) |
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 51
|
 |
Re: I must be missing something simple ..........
« Reply #22 on: Aug 11th, 2017, 2:59pm » |
|
> If by "clunky" you mean slow, > the reason is almost certainly that > you haven't enabled the GL Driver.
Slow is an understatement. Which model RPi do you have ? I tried the GL Driver. It definitely speeds up your visual examples. Also somewhat speeds up the IDE but not enough. For some reason it makes my midi not connect. (maybe needs some pauses to allow execution) Also seems to cause some irregular blips in the display ? Anyways ...... SLOW and UNRESPONSIVE  ( Compare it to ( say ) LeafPad ) It acts like (perhaps) it is last in the priority list. I think this is adjustable, but beyond my paygrade  I may have messed up the installation ? First time I installed beyond ' apt-get ' Also I'm an obsessive tinkerer, and may have ?? The proof in the pudding will be when I do a ditty and see if it keeps a beat. I can always edit in LeafPad then copy/paste, but shouldn't have to. HyperRegards .......... Mike Miller
|
|
Logged
|
https://www.youtube.com/watch?v=ePhUBBGyVmI
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: I must be missing something simple ..........
« Reply #23 on: Aug 11th, 2017, 4:00pm » |
|
on Aug 11th, 2017, 2:59pm, hitsware wrote:| Slow is an understatement. Which model RPi do you have ? |
|
It's an RPi 3 (the current model). Anything earlier would of course be slow, but then I don't claim BBC BASIC will work on earlier models anyway. 
Quote:| I tried the GL Driver. It definitely speeds up your visual examples. Also somewhat speeds up the IDE but not enough. |
|
It speeds up all aspects of screen output (graphics and text) and the IDE particularly benefits. On the RPi 3 with GL Driver enabled the IDE is plenty fast enough.
Quote:| For some reason it makes my midi not connect. |
|
As you know, the GL Driver is described as 'experimental' and with good reason. Interference with HDMI sound output is a known bug (it used to be OK, but they seem to have introduced the problem in a recent update). I queried this at the Raspberry Pi forum and apparently there are no plans to fix it in Raspbian Jessie, we will have to wait for Raspbian Stretch for a 'stable' GL Driver.
If the sound problems force you to leave the GL Driver disabled, BBC BASIC will unavoidably be very slow, sorry.
I am absolutely delighted with the Raspberry Pi edition of BBC BASIC: it exceeds my expectations by a large margin (remember, the RPi costs only about £30 so you shouldn't make comparisons with a desktop PC or Android device costing hundreds of pounds). 
Richard.
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 51
|
 |
Re: I must be missing something simple ..........
« Reply #24 on: Aug 11th, 2017, 4:44pm » |
|
Quote:I am absolutely delighted with the Raspberry Pi edition of BBC BASIC: |
|
Me too overall. I'm delighted by the whole RPi scene. Jolly Old England has done the world proud !
|
| « Last Edit: Aug 11th, 2017, 4:45pm by hitsware » |
Logged
|
https://www.youtube.com/watch?v=ePhUBBGyVmI
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 51
|
 |
Re: I must be missing something simple ..........
« Reply #25 on: Aug 12th, 2017, 1:55pm » |
|
Richard, (or anyone interested) Would you please try this: Run the below (slightly modified) routine Hold down the right arrow key a short time How fast do the notes change ?
Code: REM:#### RPi Midi Explorer ################# REM: Assumes Timidity installed REM: In terminal enter ' timidity -iA ' ( leave terminal open ) REM: midi setup SYS "system", " sudo modprobe snd-virmidi snd_index=0 " SYS "system", " aconnect 20:0 128:0 " REM: firstnote midipatch = 0: midinote = 55 REM: start PROC_playnote(midipatch, midinote) REM: set patches and notes REPEAT: REPEAT: x=INKEY(0): UNTIL x <> -1 IF x = 139 THEN midipatch = midipatch + 1 IF x = 138 THEN midipatch = midipatch - 1 IF x = 137 THEN midinote = midinote + 1 IF x = 136 THEN midinote = midinote - 1 IF midipatch < 0 THEN midipatch = 0 IF midipatch >127 THEN midipatch = 127 IF midinote < 0 THEN midinote = 0 IF midinote > 127 THEN midinote = 127 PROC_playnote(midipatch, midinote) UNTIL FALSE: END REM: play and display DEF PROC_playnote(midipatch,midinote) SYS "system", " amidi -p hw:1,0 -S'C0 "+STR$~(midipatch)+"'" SYS "system", " amidi -p hw:1,0 -S'90 "+STR$~(midinote)+" 7F'" SYS "system", " amidi -p hw:1,0 -S'B0 7B 0'" CLS PRINT "midipatch = "; midipatch ;" midinote = "; midinote PRINT " up / down arrows for patch change" PRINT "left / right arrows for note change" ENDPROC
|
|
Logged
|
https://www.youtube.com/watch?v=ePhUBBGyVmI
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: I must be missing something simple ..........
« Reply #26 on: Aug 12th, 2017, 5:54pm » |
|
on Aug 12th, 2017, 1:55pm, hitsware wrote:| How fast do the notes change ? |
|
I don't get any sound from your program on my RPi 3. 
The rate at which the notes are produced will in any case depend on the keyboard repeat speed, and since that won't necessarily be consistent between systems I'm not sure what your test is trying to determine.
Also, there's a CLS in your playnote routine and that will slow things down quite a bit.
Richard.
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 51
|
 |
Re: I must be missing something simple ..........
« Reply #27 on: Aug 12th, 2017, 6:21pm » |
|
If you've done the below then it may be the GL driver......... Anyways it should (has on any other platform) sweep like running your hand accross a (piano)keyboard ..... ~ 20 notes/sec. This runs more like at least 1/2 second for each note REM: Assumes Timidity installed REM: In terminal enter ' timidity -iA ' ( leave terminal open )
|
|
Logged
|
https://www.youtube.com/watch?v=ePhUBBGyVmI
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: I must be missing something simple ..........
« Reply #28 on: Aug 12th, 2017, 7:03pm » |
|
on Aug 12th, 2017, 6:21pm, hitsware wrote:| This runs more like at least 1/2 second for each note |
|
Well, the slowness has nothing to do with BBC BASIC, it's just how long those SYS statements happen to take (delete the CLS and PRINT to make sure they are not contributing). I'm sure you didn't seriously think that BBC BASIC would take 0.5 seconds to execute half a dozen statements! A few microseconds more like. 
Perhaps you should be running the commands in the background, rather than waiting for them to complete?
Edit: Why are you splitting the MIDI commands into three 'amidi' statements rather than using just one? Surely that just adds unnecessary overhead?
Richard.
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: I must be missing something simple ..........
« Reply #29 on: Aug 12th, 2017, 8:29pm » |
|
on Aug 12th, 2017, 7:03pm, Richard Russell wrote:| Perhaps you should be running the commands in the background, rather than waiting for them to complete? |
|
That makes a big difference (try the code below).
Richard.
Code: SYS "system", "sudo modprobe snd-virmidi snd_index=0" SYS "system", "aconnect 20:0 128:0" midipatch=0 midinote=55 PROCplaynote(midipatch, midinote) REPEAT CASE GET OF WHEN 139: IF midipatch < 127 midipatch += 1 WHEN 138: IF midipatch > 1 midipatch -= 1 WHEN 137: IF midinote < 127 midinote += 1 WHEN 136: IF midinote > 1 midinote -= 1 ENDCASE PROCplaynote(midipatch, midinote) UNTIL FALSE END DEF PROCplaynote(midipatch,midinote) OSCLI "amidi -p hw:1,0 -S'C0 "+STR$~(midipatch)+" 90 "+STR$~(midinote)+" 7F' ;" OSCLI "amidi -p hw:1,0 -S'B0 7B 0' ;" PRINT midipatch, midinote ENDPROC
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 51
|
 |
Re: I must be missing something simple ..........
« Reply #30 on: Aug 12th, 2017, 8:45pm » |
|
Yep ! I just tried the same routine in Ruby as well as Sonic-Pi the ' system ' commands themselves (away from BBCB) take mucho tiempo. ( ~ 1/4 sec. ) I'll have to find another way to write to Timidity ......
edit: My guess was pretty good ...... 0.33 sec. Code: TIME=0 SYS "system","amidi -p hw:1,0 -S'90 #{hmn} 7F'" SYS "system","amidi -p hw:1,0 -S'B0 7B 0'" x=TIME PRINT x
|
|
Logged
|
https://www.youtube.com/watch?v=ePhUBBGyVmI
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: I must be missing something simple ..........
« Reply #31 on: Aug 12th, 2017, 9:09pm » |
|
on Aug 12th, 2017, 8:45pm, hitsware wrote:| I'll have to find another way to write to Timidity ...... |
|
Did you not read my latest message (posted 15 minutes before yours)? Running the amidi commands in the background speeds them up hugely here (although obviously there's a danger of them 'overlapping', depending on how reliably timidity manages to serialise them).
But since the GL Driver appears to be incompatible with MIDI sound, and without it BBC BASIC is unusably slow (I tried, but it's impossible), you will have no choice but to find an alternative approach.
Perhaps you might consider returning to BBC BASIC when Raspbian Stretch is released and (hopefully) the GL Driver is stable and doesn't break other things.
Richard.
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 51
|
 |
Re: I must be missing something simple ..........
« Reply #32 on: Aug 12th, 2017, 9:51pm » |
|
on Aug 12th, 2017, 9:09pm, Richard Russell wrote:Did you not read my latest message (posted 15 minutes before yours)? Running the amidi commands in the background speeds them up hugely here (although obviously there's a danger of them 'overlapping', depending on how reliably timidity manages to serialise them).
But since the GL Driver appears to be incompatible with MIDI sound, and without it BBC BASIC is unusably slow (I tried, but it's impossible), you will have no choice but to find an alternative approach.
Perhaps you might consider returning to BBC BASIC when Raspbian Stretch is released and (hopefully) the GL Driver is stable and doesn't break other things.
Richard. |
|
How does one "run commands in the backround" ? It's not the BBC BASIC as much as the 'system' commands They bog down even Sonic-Pi which is quite good time-wise By another approach, I mean an address (file) to write to rather than making the 'system' commands. probably something like " /dev/snd/midiC1D0 " see: https://wiki.archlinux.org/index.php/Timidity
|
|
Logged
|
https://www.youtube.com/watch?v=ePhUBBGyVmI
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: I must be missing something simple ..........
« Reply #33 on: Aug 12th, 2017, 10:25pm » |
|
on Aug 12th, 2017, 9:51pm, hitsware wrote:| How does one "run commands in the backround" ? |
|
It's documented in the BB4W manual under *RUN. Apparently you can't see, or haven't bothered to read, my post (it's reply #29 in the thread) which contains a complete program demonstrating it. It plays the notes very quickly.
Quote:| It's not the BBC BASIC as much as the 'system' commands |
|
'system' commands aren't slow, certainly not in the sort of timescale relevant to music. The issue appears to be that the amidi command takes quite a time before it returns. Running it in the background means that you don't need to wait until it returns, but with the risks outlined in my previous post.
I'm locking this thread now before it drives me completely mad. 
Richard.
|
|
Logged
|
|
|
|
hitsware
Junior Member
member is offline


Gender: 
Posts: 51
|
 |
Re: I must be missing something simple ..........
« Reply #34 on: Aug 12th, 2017, 10:45pm » |
|
Sorry ....... My seeing eye reading dog must have been distracted
|
|
Logged
|
https://www.youtube.com/watch?v=ePhUBBGyVmI
|
|
|
|