home *** CD-ROM | disk | FTP | other *** search
- `Peter Piper 2D, a lip sync demo
- `⌐ 2000, Steve Tiffany, freely distributable
- `Basically, you load 7 different face images, each with the mouth in
- `a different shape, and you make it talk by changing the image that
- `the head-sprite displays.
- `The mouth-shape data is made using my program Lip Sync Lab,
- `available on my web site at www.stevetiffany.com/vintage.html
- `Character modelled in Amorphium.
-
- `Click mouse to stop.
-
- gosub SetUp
-
- do
- `pause for a second before speaking, and between recitations...
- sleep 1000
- restore peterpiper : soundnum=1 : gosub SayIt
- restore picked : soundnum=2 : gosub SayIt
- restore apeckof : soundnum=3 : gosub SayIt
- restore pickledpeppers : soundnum=4 : gosub SayIt
-
- restore apeckof : soundnum=3 : gosub SayIt
- restore pickledpeppers : soundnum=4 : gosub SayIt
- restore did : soundnum=5 : gosub SayIt
- restore peterpiper : soundnum=1 : gosub SayIt
- restore pick : soundnum=6 : gosub SayIt
-
- restore _if : soundnum=7 : gosub SayIt
- restore peterpiper : soundnum=1 : gosub SayIt
- restore picked : soundnum=2 : gosub SayIt
- restore apeckof : soundnum=3 : gosub SayIt
- restore pickledpeppers : soundnum=4 : gosub SayIt
-
- restore howmany : soundnum=8 : gosub SayIt
- restore pickledpeppers : soundnum=4 : gosub SayIt
- restore did : soundnum=5 : gosub SayIt
- restore peterpiper : soundnum=1 : gosub SayIt
- restore pickQ : soundnum=9 : gosub SayIt
- loop
-
- `play the sound and display the mouth shapes...
- SayIt:
- play sound soundnum
- read nummouths
- for k=1 to nummouths
- oldtimer=timer()
- read mouthshape
- read waittime
- sprite 1,255,8,mouthshape
- sync
-
- while timer()<oldtimer+waittime
- if mouseclick()=1 then gosub CleanUp
- endwhile
- next k
-
- `wait here if the sound is still playing when you run out of mouths...
- while sound playing(soundnum)
- if mouseclick()=1 then gosub CleanUp
- endwhile
- return
-
- CleanUp:
- cls 0
- wait 10
- for j=1 to 8
- delete image j
- next j
- delete sprite 1
- for j=1 to 9
- delete sound j
- next j
- cls
- end
-
- SetUp:
- hide mouse
- `load sounds 1-9...
- for j=1 to 9
- read soundname$
- a$="wav\"+soundname$+".wav"
- load sound a$,j
- next j
- `body becomes image 8 so images 1-7 are mouths and match the data...
- load bitmap "bmp\torso.bmp",1
- get image 8,0,0,382,307
- `load face bitmap...
- create bitmap 1,1302,200
- load bitmap "bmp\7smallfaces.bmp",1
- `get faces as images
- for j=0 to 6
- get image 1+j,j*185,0,(j*185)+185,199
- next j
- delete bitmap 1
- `display body...
- paste image 8,168,174
- `display first face...
- sprite 1,255,7,1
-
- `put Sync On down here or you briefly see background without bob
- `(when there's a background, that is...)
- sync on
- return
-
- soundnames:
- data "peterpiper","picked","apeckof","pickledpeppers","did"
- data "pick","_if","howmany","pickQ"
-
- peterpiper:
- data 10,1,48,6,64,2,32,3,32,4,96,1,64,3,128,1,48,3,48,4,64
- picked:
- data 3,1,48,3,80,2,128
- apeckof:
- data 6,3,176,1,48,3,144,2,128,3,80,7,144
- pickledpeppers:
- data 11,1,48,3,80,2,32,3,48,2,64,1,48,3,80,1,64,3,64,4,96,2,240
- did:
- data 3,2,32,3,64,2,80
- pick:
- data 4,1,64,3,144,2,160,1,80
- _if:
- data 2,3,96,7,256
- howmany:
- data 7,2,80,5,64,4,48,1,32,3,32,2,96,6,160
- pickQ:
- data 4,1,64,3,208,2,160,1,208
-