click a area of Tpanel control ( Creating a Piano)

Re: click a area of Tpanel control

Postby Silvio.Falconi » Wed Dec 31, 2014 4:10 pm

Rao,

Image

We Initiated from 3 octave because a C with 130,8 is a good listen --- I'll like Know How make instrument path ( piano, guitar, drum)

Static aTone := { 130.8, 138.6, 146.8, 155.6, 164.8, 174.6, 185.0, 196.0, 207.7, 220.0, 233.1, 246.9,; // 3 octave
261.7, 277.2, 293.7, 311.1, 329.6, 349.2, 370.0, 392.0, 415.3, 440.0, 466.2, 493.9,; // 4 octave
523.3, 554.4, 587.3, 622.3, 659.3, 698.5, 740.0, 784.0, 830.6, 880.0, 932.3, 987.8,; // 5 octave
1047 , 1109, 1175, 1245, 1319, 1397, 1480, 1568, 1661, 1760, 1865, 1976 ,; // 6 octave
2093 , 2217, 2349, 2489, 2637, 2794, 2960, 3136, 3322, 3520, 3729, 3951 } // 7 octave

I arrive on 4 octave ( 48 keys) .. I insert your modifies and the post the new sources
I add also the possibility to save the music on a file and load music from this file
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: click a area of Tpanel control

Postby nageswaragunupudi » Wed Dec 31, 2014 4:37 pm

After finalizing the frequencies for all octaves, please share the final values with me.

How can we make the duration controlled by the user? That is the tone should start playing when the user presses the key and stop when he releases the key.( ofcourse that is not piano). I like to have this variation also.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10642
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: click a area of Tpanel control ( Creating a Piano)

Postby Silvio.Falconi » Wed Dec 31, 2014 11:49 pm

Mr. Rao,

on tone function of Andy try to wrote

#define SAMPLING_RATE 126100

instead of

#define SAMPLING_RATE 44100

it change the duration of note
Perhaps we can found a function to control it !!!



See it please I add :

now the Piano have 60 keys !!!!! ( use with METHOD1 active)
Border and Background
Save music on ini file
Load music from inifile ( it play the music but the keys not are light)

From menu you can create a new song file or load one saved!!!!!
Last edited by Silvio.Falconi on Wed Jul 01, 2020 5:07 pm, edited 2 times in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: click a area of Tpanel control ( Creating a Piano)

Postby Silvio.Falconi » Thu Jan 01, 2015 12:05 am

a Demo song to try with new sources

Save with : Birthday.ini

Code: Select all  Expand view

[Music]
Note=42
1=G2T1/4
2=G2T1/8
3=A2T1/4
4=PT1/8
5=G2T1/4
6=PT1/8
7=C3T1/4
8=PT1/8
9=H2T1/4
10=PT1/2
11=G2T1/4
12=G2T1/8
13=A2T1/4
14=PT1/8
15=G2T1/4
16=PT1/8
17=D3T1/4
18=PT1/8
19=C3T1/4
20=PT1/2
21=G2T1/4
22=G2T1/8
23=G3T1/4  
24=PT1/8
25=E3T1/4  
26=PT1/8
27=C3T1/4  
28=C3T1/8    
29=H2T1/4
30=PT1/8
31=A2T1/4
32=PT1/8
33=F3T1/4  
34=F3T1/8  
35=E3T1/4  
36=PT1/8
37=C3T1/4  
38=PT1/8
39=D3T1/4  
40=PT1/8
41=C3T1/4  
42=PT1/2
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 62 guests