' ---------------------- Titles ------------------------------------- ' Title Penguin VSC Virtual Sound Synthesizer Chip Toggle Demo v1.0 ' Code Name penguin_toggle.bpx ' Purpose Create a discrete sound example using Toggle with ' techniques of the VSC Virtual Sound Chip ' Author humanoido ' Version 1.1 ' Begin 03 July 2007 ' Update 08 April 2008 ' Hardware Stock Penguin ' ---------------------- Directives --------------------------------- ' {$STAMP BS2px} ' {$PBASIC 2.5} ' ---------------------- Error Correction --------------------------- #IF $STAMP <> BS2PX #THEN #ERROR "This program requires a Penguin Robot with a BS2px." #ENDIF ' ---------------------- Descriptions ------------------------------- ' Welcome to the Virtual Sound Chip ' The following capabilities and functions can be found in VSC suite ' of programs: ' Multiple Filtered Penguin Channel Synthesizer ' This program uses the Virtual Sound Chip. ' Multiple Voice Electronic Virtual Sound Processor ' Independently controlled voices ' Frequency Modulation ' Multiple Envelope Derivatives ' Independent Sound Morphing ' Includes Oscillators and Mixers ' This code is a discrete running sample using a demo of Toggle ' to generate sound waveforms. ' ---------------------- Declarations ------------------------------- Counter VAR Nib ' Counting sound loop nibble n VAR Nib ' 1st timimg channel nibble nn VAR Nib ' 2nd timing channel nibble ' ---------------------- Program Starup ----------------------------- ' C4,D4,E4,F4,G4,A4,B4,C4 C4,B4,A4,G4,F4,E4,D4,C4 FREQOUT 12, 500, 262:FREQOUT 12, 500, 294:FREQOUT 12, 500, 330 FREQOUT 12, 500, 349:FREQOUT 12, 500, 392:FREQOUT 12, 500, 440 FREQOUT 12, 500, 494:FREQOUT 12, 500, 523 FREQOUT 12, 500, 523:FREQOUT 12, 500, 494:FREQOUT 12, 500, 440 FREQOUT 12, 500, 392:FREQOUT 12, 500, 349:FREQOUT 12, 500, 330 FREQOUT 12, 500, 294:FREQOUT 12, 500, 262 ' ---------------------- Main program ------------------------------- DO ' Main continuous loop FOR n = 0 TO 2 ' First timing channel ' ------------------------------------------------------------------- FOR nn = 2 TO 0 ' Second timing channel ' ------------------------------------------------------------------- FOR Counter = 0 TO 15 ' Counting sound loop TOGGLE 12 ' Penguin Sound using Toggle Pin 12 PAUSE n ' 1st sound delay TOGGLE 12 ' Modify high low status of speaker port 12 PAUSE nn ' Introduce secondary sound delay NEXT ' Next counter iterate NEXT ' Next iterate for 2nd timing channel NEXT ' Next iterate for primary timing channel LOOP ' Return to beginning - main continuous loop ' -------------------------------------------------------------------