Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QM Synth...
#1
Just a bit of boredom...but hey...anything is possible with QM!

Function QM_Synth
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 113 "QM Synth"
;11 Button 0x54032000 0x0 140 25 20 40 ""
;10 Button 0x54032000 0x0 115 25 20 40 ""
;9 Button 0x54032000 0x0 65 25 20 40 ""
;8 Button 0x54032000 0x0 40 25 20 40 ""
;3 Button 0x54032000 0x0 25 25 26 61 ""
;4 Button 0x54032000 0x0 50 25 25 61 ""
;5 Button 0x54032000 0x0 75 25 26 61 ""
;6 Button 0x54032000 0x0 100 25 25 61 ""
;7 Button 0x54032000 0x0 125 25 26 61 ""
;12 Button 0x54032000 0x0 165 25 20 40 ""
;13 Button 0x54032000 0x0 150 25 25 61 ""
;14 Button 0x54032000 0x0 175 25 26 61 ""
;16 Button 0x54012003 0x0 130 5 48 12 "Octave Up"
;15 Button 0x54020007 0x0 15 5 190 95 "QM Synth"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

str controls = "16"
str c16Oct
if(!ShowDialog("QM_Synth" &QM_Synth &controls)) ret

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 14
,Octave_Up
,;B
,bee _B 100
,case 12
,;A#/Bb
,bee _A1 100
,case 13
,;A
,bee _A 100
,case 11
,;G#/Ab
,bee _G1 100
,case 7
,;G
,bee _G 100
,case 10
,;F#/Gb
,bee _F1 100
,case 6
,;F
,bee _F 100
,case 5
,;E
,bee _E 100
,case 9
,;D#/Eb
,bee _D1 100
,case 4
,;D
,bee _D 100
,case 8
,;C#/Db
,bee _C1 100
,case 3
,;C
,Octave_Up
,bee _C 100
,case IDOK
,case IDCANCEL
ret 1

Function Octave_Up
Code:
Copy      Help
Acc a=acc("Octave Up" "CHECKBUTTON" win("QM Synth" "#32770") "Button" "" 0x1001)
int state=a.State()
if state=1048576; CURRENCY+ _C=65.41
else; _C=65.41*2
if state=1048576; CURRENCY+ _C1=69.30
else; _C1=69.30*2
if state=1048576; CURRENCY+ _D=73.42
else; _D=73.42*2
if state=1048576; CURRENCY+ _D1=77.78
else; _D1=77.78*2
if state=1048576; CURRENCY+ _E=82.41
else; _E=82.41*2
if state=1048576; CURRENCY+ _F=87.31
else; _F=87.31*2
if state=1048576; CURRENCY+ _F1=92.50
else; _F1=92.50*2
if state=1048576; CURRENCY+ _G=98.00
else; _G=98.00*2
if state=1048576; CURRENCY+ _G1=103.83
else; _G1=103.83*2
if state=1048576; CURRENCY+ _A=110.00
else; _A=110.00*2
if state=1048576; CURRENCY+ _A1=116.54
else; _A1=116.54*2
if state=1048576; CURRENCY+ _B=123.47
else; _B=123.47*2
#2
Hey Vig,

Inspired by your synth...made a little sample playback keyboard based on yours:

Macro QM_Soundbank_Macro
Code:
Copy      Help
str+ sbdir = "$desktop$\soundbank\"
str background.from(sbdir "background.jpg")
str sbdir_all.from(sbdir "*.*")
str+ sb = "piano"
str+ changebank
str sb_selected
str controls = "16 15"
str cb16 sb15bac
sb15bac = background

;=enumerate soundbank directorys=
Dir d
foreach(d sbdir_all FE_Dir 1)
,str sPath=d.FileName(0)
,_s.format("%s%s[91][93]" _s sPath)
_s.rtrim("[91][93]")
out _s

;DLG_LOOP
changebank = "no"
cb16 = _s
sb_selected.from("&" sb)
cb16.replacerx(sb sb_selected)
cb16.escape(0)
if(!ShowDialog("QM_Soundbank_Dlg" &QM_Soundbank_Dlg &controls)) ret
;=point to new wav directory and reinit dlg=
if changebank = "yes"
,goto DLG_LOOP
end

Function QM_Soundbank_Dlg
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
str whitekey.from(sbdir "white.jpg")
str blackkey.from(sbdir "black.jpg")
str snd1.from(sbdir sb "\1.wav")
str snd2.from(sbdir sb "\2.wav")
str snd3.from(sbdir sb "\3.wav")
str snd4.from(sbdir sb "\4.wav")
str snd5.from(sbdir sb "\5.wav")
str snd6.from(sbdir sb "\6.wav")
str snd7.from(sbdir sb "\7.wav")
str snd8.from(sbdir sb "\8.wav")
str snd9.from(sbdir sb "\9.wav")
str snd10.from(sbdir sb "\10.wav")
str snd11.from(sbdir sb "\11.wav")
str snd12.from(sbdir sb "\12.wav")
str snd13.from(sbdir sb "\13.wav")
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 167 143 "QM Soundbank"
;11 Button 0x54038080 0x0 92 24 14 70 ""
;10 Button 0x54038080 0x0 74 24 14 70 ""
;9 Button 0x54038080 0x0 38 24 14 70 ""
;8 Button 0x54038080 0x0 20 24 14 70 ""
;3 Button 0x54038080 0x0 10 24 18 108 ""
;4 Button 0x54038080 0x0 28 24 18 108 ""
;5 Button 0x54038080 0x0 46 24 18 108 ""
;6 Button 0x54038080 0x0 64 24 18 108 ""
;7 Button 0x54038080 0x0 82 24 18 108 ""
;12 Button 0x54038080 0x0 112 24 14 70 ""
;13 Button 0x54038080 0x0 100 24 18 108 ""
;14 Button 0x54038080 0x0 118 24 20 108 ""
;17 Button 0x54038080 0x0 138 24 20 108 ""
;16 ComboBox 0x54230243 0x0 62 6 96 213 ""
;15 Static 0x5400000E 0x20000 0 0 194 174 "back"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,;DT_Init(hDlg lParam)
,int white=qm.LoadPictureFile(whitekey 0)
,SendMessage(id(3 hDlg) BM_SETIMAGE IMAGE_BITMAP white)
,SendMessage(id(4 hDlg) BM_SETIMAGE IMAGE_BITMAP white)
,SendMessage(id(5 hDlg) BM_SETIMAGE IMAGE_BITMAP white)
,SendMessage(id(6 hDlg) BM_SETIMAGE IMAGE_BITMAP white)
,SendMessage(id(7 hDlg) BM_SETIMAGE IMAGE_BITMAP white)
,SendMessage(id(13 hDlg) BM_SETIMAGE IMAGE_BITMAP white)
,SendMessage(id(14 hDlg) BM_SETIMAGE IMAGE_BITMAP white)
,SendMessage(id(17 hDlg) BM_SETIMAGE IMAGE_BITMAP white)
,
,int black=qm.LoadPictureFile(blackkey 0)
,SendMessage(id(8 hDlg) BM_SETIMAGE IMAGE_BITMAP black)
,SendMessage(id(9 hDlg) BM_SETIMAGE IMAGE_BITMAP black)
,SendMessage(id(10 hDlg) BM_SETIMAGE IMAGE_BITMAP black)
,SendMessage(id(11 hDlg) BM_SETIMAGE IMAGE_BITMAP black)
,SendMessage(id(12 hDlg) BM_SETIMAGE IMAGE_BITMAP black)

,case WM_DESTROY
,DT_DeleteData(hDlg)
,DeleteObject(SendMessage(id(3 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))
,DeleteObject(SendMessage(id(4 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))
,DeleteObject(SendMessage(id(5 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))
,DeleteObject(SendMessage(id(6 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))
,DeleteObject(SendMessage(id(7 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))
,DeleteObject(SendMessage(id(8 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))
,DeleteObject(SendMessage(id(9 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))
,DeleteObject(SendMessage(id(10 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))
,DeleteObject(SendMessage(id(11 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))
,DeleteObject(SendMessage(id(12 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))
,DeleteObject(SendMessage(id(13 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))
,DeleteObject(SendMessage(id(14 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))
,DeleteObject(SendMessage(id(17 hDlg) BM_GETIMAGE IMAGE_BITMAP 0))

,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3 ;;     C
,,bee snd1
,case 8 ;;     C#/Db
,,bee snd2
,case 4 ;;     D
,,bee snd3
,case 9 ;;     D#/Eb
,,bee snd4
,case 5 ;;     E
,,bee snd5
,case 6 ;;     F
,,bee snd6
,case 10 ;;     F#/Gb
,,bee snd7
,case 7 ;;     G
,,bee snd8
,case 11 ;;     G#/Ab
,,bee snd9
,case 13 ;;     A
,,bee snd10
,case 12 ;;     A#/Bb
,,bee snd11
,case 14 ;;   B
,,bee snd12
,case 17 ;;     C 8va
,,bee snd13

,case CBN_SELENDOK<<16|16
,,,if(CB_SelectedItem(id(16 hDlg) sb) >= 0)
,,,,changebank = "yes"
,,,,DT_Ok hDlg
,case IDOK
,case IDCANCEL
ret 1

To test, put the "soundbank" folder (download zip file -- 1.57MB) on the desktop. More sample soundbanks can be added simply by creating a new subfolder in the soundbank folder with wav files named 1.wav - thru -13.wav (for keys C to C octave). Any new soundbank subfolders are automatically picked up by the macro and added to the drop-down soundbank selector.

Steve


Attached Files
.qml   Soundbank.qml (Size: 4.55 KB / Downloads: 594)
#3
Great job guys, i use to produce music awhile ago..this is a great novelty and unique to QM!
VεRiTλS


Forum Jump:


Users browsing this thread: 2 Guest(s)