|
Post by rikky on Feb 7, 2019 7:18:11 GMT 1
I tried OpenGl before on the Raspi, It was for FreeCad. FreeCad works with OpenGL on the Raspi. Very very useful program FreeCad for your CNC project. Some other programs run into trouble though with OpenGL, like my OmxplayerGUI. sudo raspi-config 7. advanced options A7. GL driver G1. GL (Full KMS) Open GL driver with full KMS
Rik.
|
|
|
Post by Pjot on Aug 2, 2019 13:10:16 GMT 1
All, Since a few weeks I have changed to Mageia Linux, a project which tries to revive the spirit of the good old Mandrake Linux. I discovered that some of the BaCon stuff wasn't working, especially the XTERM canvas. But this is fixed, the updated version of canvas-xterm can be found here. In the process I made some improvements to the mouse events, and also added some other tweaks to the XTerm canvas. To test the mouse interaction, I rewrote the MIDI player from scratch, using the Immediate Mode GUI approach. Also, the program tests the new WALK$ function. So 3.9.2 beta is required to compile the program. The program is here and the screenshot below. Note that for XTerm, your system needs some CPU power. However, the MIDI player also compiles with the (updated) plain canvas context, which needs far less system resources. BR Peter EDIT: fixes and enhancements in version 1.1. New screenshot. Attachments:
|
|
|
Post by Pjot on Aug 4, 2019 19:57:32 GMT 1
A lot of fixes and improvements in the canvas MIDI player. -prevent crash in case of UTF8 directory names -continue to next MIDI file when current is finished -show current MIDI file being played -small layout improvements -added some error dialogs -keep selection in listbox selected when out of screen It is a lot of fun playing music from Bach BR Peter
|
|
|
Post by vovchik on Aug 4, 2019 22:06:55 GMT 1
Dear Peter,
It's working nicely for me. Thanks. I also have lots of soundfonts and have tested with very large ones - all working fine.
With kind regards, vovchik
|
|
|
Post by bigbass on Oct 20, 2019 6:03:32 GMT 1
Joe
'--- INCLUDE canvas INCLUDE canvas-xterm
OPTION VARTYPE double
'---“If you knew the magnificence of the three, six and nine, '---you would have a key to the universe.” – Nikola Tesla
winx = 440 winy = 440 CENTER = winx /2
WINDOW("Tesla's 369 a key to the universe solved ", winx, winy)
INK(0,0,0,255) CLS
RESETANGLE
PENXY(CENTER, CENTER)
PEN(1, TRUE)
CALL mywork(winx)
CALL mywork3(winx)
CALL mywork6(winx)
CALL mywork9(winx)
WAITKEY
SUB mywork(size)
CIRCUM = 22 'base INK(0,55,0,55) CIRCLE(CENTER, CENTER, CIRCUM, CIRCUM, 0) INK(0,55,0,55) SQUARE(CENTER, CENTER, CIRCUM, CIRCUM, 0) INK(0,55,0,55) TRIANGLE(CENTER, CENTER, 2*CIRCUM, 2*CIRCUM, 0) END SUB
SUB mywork3(size)
CIRCUM = 22 'third INK(0,55,0,55) CIRCLE(CENTER, CENTER, CIRCUM*3, CIRCUM*3, 0) INK(0,55,0,55) SQUARE(CENTER, CENTER, CIRCUM*3, CIRCUM*3, 0) INK(0,55,0,55) TRIANGLE(CENTER, CENTER, 2*CIRCUM*3, 2*CIRCUM*3, 0) END SUB
SUB mywork6(size)
CIRCUM = 22 'six INK(0,100,0,100) CIRCLE(CENTER, CENTER, CIRCUM*6, CIRCUM*6, 0) INK(0,100,0,100) SQUARE(CENTER, CENTER, CIRCUM*6, CIRCUM*6, 0) INK(0,100,0,100) TRIANGLE(CENTER, CENTER, 2*CIRCUM*6, 2*CIRCUM*6, 0)
END SUB
SUB mywork9(size)
CIRCUM = 22 'nine INK(0,55,0,55) CIRCLE(CENTER, CENTER, CIRCUM*9, CIRCUM*9, 0)
INK(0,55,0,55) SQUARE(CENTER, CENTER, CIRCUM*9, CIRCUM*9, 0) INK(0,55,0,55) TRIANGLE(CENTER, CENTER, 2*CIRCUM*9, 2*CIRCUM*9, 0) END SUB
|
|
|
Post by Pjot on Oct 20, 2019 9:22:21 GMT 1
Thanks Joe,
Very nice!!
Br Peter
|
|
|
Post by vovchik on Oct 20, 2019 13:17:44 GMT 1
Dear Joe and Peter,
Thanks. And it works nicely with the regular canvas, too.
INCLUDE "canvas.bac" OPTION VARTYPE double CONST winx = 440 CONST winy = 440 DECLARE CENTER = winx/2 DECLARE CIRCUM = 22 ' no pun intended :) DEF FN CIRCUMSIZE(x) = CIRCUM * x
' ------------------ SUB TESLA(double size, int shade, int thick) ' ------------------ INK(shade, 255, 0, 235) PEN(thick, TRUE) CIRCLE(CENTER, CENTER, CIRCUMSIZE(size), CIRCUMSIZE(size), 0) INK(shade,255, 0, 235) SQUARE(CENTER, CENTER, CIRCUMSIZE(size), CIRCUMSIZE(size), 0) INK(shade, 255, 0, 235) TRIANGLE(CENTER, CENTER, 2 * CIRCUMSIZE(size), 2 * CIRCUMSIZE(size), 0) END SUB
WINDOW("Tesla's 369 a key to the universe solved ", winx, winy) INK(0, 0, 0, 245) CLS RESETANGLE PENXY(CENTER, CENTER) TESLA(9, 175, 6) TESLA(6, 200, 5) TESLA(3, 225, 4) TESLA(1, 250, 3) WAITKEY
With kind regards, vovchik
|
|
|
Post by bigbass on Oct 20, 2019 16:52:37 GMT 1
Hello Guys
Thanks Peter and for your canvas!
Thanks vovchik for reducing it nicely and compact as a single function
canvas dependency sudo apt-get install freeglut3-dev
law of the universe give a key get a key
P.S I solved it with math only just numbers first on paper and wanted to show the steps like a math problem but as a program that that shows the image as a result using a canvas because sometimes its much easier to see the formula
here is the strange relational formula I derived using music the canvas image shows this relation
44/7 = 6.285714285
this is what I use as 2 PI circumference = 2 PI r
1.) 7/1 44/44 base fibonacci
2.) 14/2 88/44 2 * 44 = 88
3.) 21/3 132/44 3 * 44 = 132 in music is C3
4.) 28/4 176/44
5.) 35/5 220/44
6.) 42/6 264/44 6 * 44 = 264 in music is C4 octave
7.) 49/7 308/44
8.) 56/8 352/44
9.) 63/9 396/44 9 * 44 = 396 in music is G4
10.) 70/10 440/44
11.) 77/11 484/44
12.) 84/12 528/44
|
|
|
Post by vovchik on Oct 20, 2019 17:13:10 GMT 1
Dear Joe,
Thanks - that is really fascinating - because it also yields the overtone series - octave then the fifth etc. I am digesting...
With kind regards, vovchik
|
|
|
Post by bigbass on Oct 21, 2019 0:00:25 GMT 1
Hello vovchik
a small edit to your macro so we can GROW and SHRINK and it still works without changing the FUNCTION
that's whats happening anyway a fibonacci growth
just the changes
Joe
'---when using shrink we must start with the largest value as CIRCUM DECLARE CIRCUM = 440
DEF FN GROW(x) = CIRCUM * x DEF FN SHRINK(x) = CIRCUM / x ' ------------------ SUB TESLA(double size, int shade, int thick) ' ------------------ INK(shade, 255, 0, 235) PEN(thick, TRUE) CIRCLE(CENTER, CENTER, SHRINK(size), SHRINK(size), 0) INK(shade,255, 0, 235) SQUARE(CENTER, CENTER, SHRINK(size), SHRINK(size), 0) INK(shade, 255, 0, 235) TRIANGLE(CENTER, CENTER, 2 * SHRINK(size), 2 * SHRINK(size), 0) END SUB
|
|
|
Post by bigbass on Nov 2, 2019 18:44:51 GMT 1
I worked this frequency formula out many years ago And wanted to generate a nice chart that goes to what we can still hear 22000 hz
and much faster than doing it on a calculator!
'--- shows relational frequency formula by bigbass '--- '--- radius to frequency left column are multiples of 7
'--- the right column '--- frequency values are radius * 44/7 = frequency '--- frequency values are also fibonacci series with a starting point of 44 '--- 44 + 44 = 88 88 + 44 = 132 ..... '--- when you count down vertically
'---we do not use official PI because we use the "corrected 2PI (44/7)"
'---how can I prove it look at the numbers they have no remainders FOR z = 1 TO 500 STEP 1
PRINT ALIGN$(STR$(z),5,1) , TAB$(1), ALIGN$("radius =",10,2) , z * 7 , TAB$(1),ALIGN$("frequency =",13,2), (z*7) * 44/7 NEXT
|
|
|
Post by bigbass on Nov 2, 2019 18:49:16 GMT 1
just bacon no canvas used
inverted negative numbers because the left side of the terminal is x=0
'--- 80 is used because of the small terminal limit '--- adjusted pi MYPI = (44/7) /2
LOCAL x,y TYPE float
FOR x = x= -MYPI TO MYPI STEP .1 y = sin(x) * 80 IF y > 23 AND y <= 220 THEN GOTOXY y ,y COLOR FG TO GREEN PRINT "+" END IF y = -sin(x) * 80 IF y > 22 AND y <= 220 THEN GOTOXY y ,y COLOR FG TO BLUE PRINT "o" END IF NEXT
for fun and an extra here it is in FLTK
DECLARE win TYPE Fl_Window* DECLARE chart TYPE Fl_Chart* DECLARE val TYPE double DECLARE val_str TYPE char* DECLARE MYPI TYPE float DECLARE PEAK TYPE int DECLARE INNERBOX TYPE int
'--- 1/2 of the wave form PEAK = 110.0 '--- allows for correct spacing 22 + 44 INNERBOX = 66
'--- using 440 frequency so when split on x axis we need to display 880 win = new Fl_Window(880+INNERBOX , 2*PEAK + INNERBOX ,"FREQUENCY") chart = new Fl_Chart(22, 22, win->w()-44, win->h()-44, "CHART") chart->bounds(-PEAK, PEAK)
'--- adjusted pi MYPI = (44/7) /2
'--- if the step value goes too small the display goes black LOCAL x,y TYPE float FOR x= -MYPI TO MYPI STEP .1 y = sin(x) * PEAK '---the numbers get very small to read 'val_str = STR$(ROUND(y)) PRINT x ,y FORMAT "%.2f \t %.2f\n" chart->add(y, val_str, (y < 0) ? FL_WHITE : FL_GREEN) NEXT win->resizable(win) win->show() Fl::run()
|
|
|
Post by Pjot on Nov 2, 2019 20:26:28 GMT 1
Thanks Joe, nice and small! Regards Peter Attachments:
|
|
|
Post by bigbass on Nov 5, 2019 18:30:21 GMT 1
I was working out math on paper the old fashioned way as usual and then it occurred to me plotting this is a lot of time and work then I found the solution a nice web page that allows you to plot advanced math easily and animate it ! wow this is really a great tool and the reason I want to share it here is we can work out the math first then use a bacon canvas later knowing that the math will work as you planned and visioned here is what I wanted to do in bacon with the canvas I solved it here (I signed up and made the demo from a modified polar rose equation) www.desmos.com/calculator/lp65wmhs0tpress the b= play button and you can see the math animated ! you can lower the speed or slowly move the slider Joe you can switch from polar to rectangular graphs easily tools symbol I prefer polar when using curves there is no theta symbol option you have to type the word theta and the symbol then appears
|
|