I wanted an easy-er way to create tunes with the sound command, else than testing/programming over 40 times to get the notes right.
Initial plan was to create everything from a windows apps, then output notes to pic, but finally I was tempted to use the PIC as a sound card...
Result is, a small application running under windows, showing you a virtual music keyboard and notes supported by the PB sound command.(I did my best to match the real frequencies with the ones emitted by a PIC, but they are not all 100% accurate).
You can clic the keyboard, and notes will be sent on the serial port to the PIC for playback.
Of course you can record/delete clicked notes to a list, and in the end ask the software to output a PBasic command line to put into a program.

not 100% bulletproof tested, but functionnal over here.
Made at least 6 tunes in less than 15 minutes with it.
It come pre-loaded with JS Bach Minuet =)
program EXE is here:
http://www.flipperdesign.com/BeepMaster_midi.rar
http://www.flipperdesign.com/projects_speciaux_main.html
Code required in the PIC to get the notes is here:
; sound generator PIC12F683, @20Mhz
; testing Sounds, and they wait for Data from seial to play more..
; For use with BEEPMaster.exe Program to create tunes
'-------------------------------------------------------------------
' PIC12F683
'-------------------------------------------------------------------
' PIN NAME USE/CONNECTION
' 1 Vdd +5VDC
' 2 GPIO.5 XT
' 3 GPIO.4 XT
' 4 GPIO.3 N/C, MCLR
' 5 GPIO.2 LED OUTPUT
' 6 GPIO.1 SERIAL INPUT
' 7 GPIO.0 SPEAKER OUTPUT, with a small caps
' 8 VSS GROUND
'-------------------------------------------------------------------
DEFINE DEBUG_REG GPIO
DEFINE DEBUG_BIT 1 ' GPIO.1
DEFINE DEBUG_MODE 0 ' 1 = inverted, 0 = true
DEFINE DEBUG_BAUD 38400 ' test 38400(fonctionne pas toujours sur le INTOSC)
DEFINE DEBUGIN_REG GPIO
DEFINE DEBUGIN_BIT 2 ' GPIO.2
DEFINE DEBUGIN_MODE 0 ' 1 = inverted, 0 = true
DEFINE OSC 20
CMCON0 = 7 'Analog Comparators OFF
ANSEL = %00000000 ' Set A/D OFF, necessaire pour SOUND!
ADCON0 = %00000000 'Analog converter OFF(test)
WPU = 0 ' Internal pull-ups = off, maybe REQUIRED for MCLR_OFF
INPUT GPIO.2
OUTPUT GPIO.1
Speaker var GPIO.0
output Speaker
Freqtest var Word
Duration var byte
curNote var byte
;LedPort var GPIO.2
;Output Speaker
dlzic var byte
curNote=0
;High LedPort
Pause 200
dlzic=40
pause 100
sound Speaker,[105,dlzic,99,dlzic,102,dlzic,90,dlzic*2,0,15,90,dlzic,102,dlzic,105,dlzic,99,dlzic ]
; Super Cool warp!
for Freqtest= 200 to 600
FREQOUT Speaker,10,Freqtest
next Freqtest
;High LedPort
; NOW that fun is over, lets wait for client input
waitforkeydata:
pause 1
DEBUGIN [WAIT("DT")]
DEBUGIN [HEX2 curnote]
DEBUGIN [WAIT(",")]
DEBUGIN [HEX2 duration]
DEBUGIN [WAIT(13)] ; wait carriage return
pause 2
sound Speaker,[curnote,duration ]
;High LedPort
GOTO waitforkeydata
END


Menu

Re: Has anyone tried AI with PICBASIC
That's a great observation. Specifying 'PicBasic Pro 3' significantly narrows the AI's search space, reducing the risk of it blending in syntax from other similar BASIC languages.You've hit on a...
lester Today, 06:43