Weekly Qbasic and Qb64 Lesson Topics
April 19, 2024, 02:15:31 pm
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

MyPiano_with-recorder

Pages: [1]
  Print  
Author Topic: MyPiano_with-recorder  (Read 876 times)
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« on: October 19, 2012, 07:16:05 am »

This was made to be used with qb64 for Linux, If you wanted to compile it with Windows you could but would need to set the SHELL command to use your appropriate windows program.
Code:
 ' kEYS ABCDEFGHIJK, EACH KEY GOES TO A HIGHER TONE,..
' So start with "A", and so on.
'
'
'
'
'   Esc exits.
'A=30
'B = 48
'C = 46
'D = 32
'E = 18
'F = 33
'G = 34

CLS
'--------------------
PRINT "This should start your recorder,and after you start it,hide the window"
PRINT "Start playing the notes, when you finish,stop the recording and save"
PRINT "if so desired,close the window, some changes in this code,would be needed"
PRINT "according to your OS,and path to a recording program."
SHELL _DONTWAIT "gnome-sound-recorder"
'SHELL "/home/garry/Desktop/qb64/./Mypiano2-fast"
'once it is compiled you can use this with the filename of your program.(For Linux)

CONST ESC = 27

'Define A
KEY 20, CHR$(0) + CHR$(30)
ON KEY(20) GOSUB A
KEY(20) ON
'Define B
KEY 21, CHR$(0) + CHR$(48)
ON KEY(21) GOSUB B
KEY(21) ON
'Define C
KEY 15, CHR$(0) + CHR$(46)
ON KEY(15) GOSUB C
KEY(15) ON
'Define D
KEY 16, CHR$(0) + CHR$(32)
ON KEY(16) GOSUB D
KEY(16) ON
'Define E
KEY 17, CHR$(0) + CHR$(18)
ON KEY(17) GOSUB E
KEY(17) ON
'Define F
KEY 18, CHR$(0) + CHR$(33)
ON KEY(18) GOSUB F
KEY(18) ON
'Define G
KEY 19, CHR$(0) + CHR$(34)
ON KEY(19) GOSUB G
KEY(19) ON
'Define H
KEY 22, CHR$(0) + CHR$(35)
ON KEY(22) GOSUB H
KEY(22) ON
'Define I
KEY 23, CHR$(0) + CHR$(23)
ON KEY(23) GOSUB I
KEY(23) ON
'Define J
KEY 24, CHR$(0) + CHR$(36)
ON KEY(24) GOSUB J
KEY(24) ON
'****End Key Definitions****
PRINT "Based on code written by Scuey, posted by Clippy"
PRINT " Start with typing A,B,C, and so on up to J"

PRINT "Press Esc to quit.note anykey dose not exit,only keys that have not "
PRINT "been used in the subs seem to work after pressing esp."
PRINT "thank you for trying this"
WHILE INKEY$ <> CHR$(ESC)
WEND
END

SOUND 0, 0
A:
SOUND 300, 4
PRINT "THIS IS A"
RETURN

B:
SOUND 400, 4
PRINT "B"
RETURN

C:
SOUND 500, 4
PRINT "C"
RETURN

D:
SOUND 600, 4
PRINT "D"
RETURN

E:
SOUND 700, 4
PRINT "E"
RETURN

F:
SOUND 800, 4
PRINT "F"
RETURN

G:
SOUND 900, 4
PRINT "G"
RETURN

H:
SOUND 1000, 4
PRINT "H"
RETURN
'Add I
I:
SOUND 1100, 4
PRINT "I"
RETURN
J:
SOUND 1200, 4
PRINT "J "
RETURN

PRINT " Esc to exit."




 
enjoy, from Garry
Report Spam   Logged

Share on Facebook Share on Twitter

GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #1 on: November 24, 2012, 08:49:50 am »

I added hand drawn letters to this, the code is some what different, also I started a sprite sheet, but I have not figured out how to use the sprite sheet, instead of individual pitchures,.
 
Code:
 ' kEYS ABCDEFGHIJK, EACH KEY GOES TO A HIGHER TONE,..
' So start with "A", and so on.
'
'
'
'
'   Esc exits.
'A=30
'B = 48
'C = 46
'D = 32
'E = 18
'F = 33
'G = 34

CLS
'--------------------
PRINT "This should start your recorder,and after you start it,hide the window"
PRINT "Start playing the notes, when you finish,stop the recording and save"
PRINT "if so desired,close the window, some changes in this code,would be needed"
PRINT "according to your OS,and path to a recording program."
SHELL _DONTWAIT "gnome-sound-recorder"
'SHELL "/home/garry/Desktop/qb64/./Mypiano2-fast"
'once it is compiled you can use this with the filename of your program.(For Linux)

CONST ESC = 27

'Define A
KEY 20, CHR$(0) + CHR$(30)
ON KEY(20) GOSUB A
KEY(20) ON
'Define B
KEY 21, CHR$(0) + CHR$(48)
ON KEY(21) GOSUB B
KEY(21) ON
'Define C
KEY 15, CHR$(0) + CHR$(46)
ON KEY(15) GOSUB C
KEY(15) ON
'Define D
KEY 16, CHR$(0) + CHR$(32)
ON KEY(16) GOSUB D
KEY(16) ON
'Define E
KEY 17, CHR$(0) + CHR$(18)
ON KEY(17) GOSUB E
KEY(17) ON
'Define F
KEY 18, CHR$(0) + CHR$(33)
ON KEY(18) GOSUB F
KEY(18) ON
'Define G
KEY 19, CHR$(0) + CHR$(34)
ON KEY(19) GOSUB G
KEY(19) ON
'Define H
KEY 22, CHR$(0) + CHR$(35)
ON KEY(22) GOSUB H
KEY(22) ON
'Define I
KEY 23, CHR$(0) + CHR$(23)
ON KEY(23) GOSUB I
KEY(23) ON
'Define J
KEY 24, CHR$(0) + CHR$(36)
ON KEY(24) GOSUB J
KEY(24) ON
'****End Key Definitions****
PRINT "Based on code written by Scuey, posted by Clippy"
PRINT " Start with typing A,B,C, and so on up to J"

PRINT "Press Esc to quit.note anykey dose not exit,only keys that have not "
PRINT "been used in the subs seem to work after pressing esp."
PRINT "thank you for trying this"
WHILE INKEY$ <> CHR$(ESC)
WEND
END
CLS

SOUND 0, 0
A:
SOUND 300, 4
PRINT "THIS IS A"


SCREEN 12
i& = _LOADIMAGE("1.png")
_PUTIMAGE , i&
_DELAY 1
CLS
RETURN

B:
SOUND 400, 4
SCREEN 12
i& = _LOADIMAGE("2.png")
_PUTIMAGE , i&
_DELAY 1
CLS

RETURN

C:
SOUND 500, 4
SCREEN 12
i& = _LOADIMAGE("3.png")
_PUTIMAGE , i&
_DELAY 1
CLS

RETURN

D:
SOUND 600, 4
SCREEN 12
i& = _LOADIMAGE("4.png")
_PUTIMAGE , i&
_DELAY 1
CLS

RETURN

E:
SOUND 700, 4
SCREEN 12
i& = _LOADIMAGE("5.png")
_PUTIMAGE , i&
_DELAY 1
CLS

RETURN

F:
SOUND 800, 4
SCREEN 12
i& = _LOADIMAGE("6.png")
_PUTIMAGE , i&
_DELAY 1
CLS

RETURN

G:
SOUND 900, 4
SCREEN 12
i& = _LOADIMAGE("7.png")
_PUTIMAGE , i&
_DELAY 1
CLS

RETURN

H:
SOUND 1000, 4
SCREEN 12
i& = _LOADIMAGE("8.png")
_PUTIMAGE , i&
_DELAY 1
CLS

RETURN
'Add I
I:
SOUND 1100, 4
SCREEN 12
i& = _LOADIMAGE("9.png")
_PUTIMAGE , i&
_DELAY 1
CLS

RETURN
J:
SOUND 1200, 4
SCREEN 12
i& = _LOADIMAGE("10.png")
_PUTIMAGE , i&
_DELAY 1
CLS

RETURN

PRINT " Esc to exit."




  
If they fit, I will include the drawings for the letters. Here are 5, the other 4 will be in a added reply
« Last Edit: November 24, 2012, 12:32:47 pm by GarrisonRicketson » Report Spam   Logged

GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #2 on: November 24, 2012, 08:54:12 am »

Here is the remaining 3.
« Last Edit: November 24, 2012, 12:34:46 pm by GarrisonRicketson » Report Spam   Logged

GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« Reply #3 on: November 24, 2012, 09:03:29 am »

Here is the sprite sheet, converted to a .png image.
« Last Edit: November 24, 2012, 12:48:08 pm by GarrisonRicketson » Report Spam   Logged


Pages: [1]
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy