Shop OBEX P1 Docs P2 Docs Learn Events
Code for R2D2 sounds — Parallax Forums

Code for R2D2 sounds

ArchiverArchiver Posts: 46,084
edited 2001-02-11 21:50 in General Discussion
Many thanks, Josep, we'll have fun ! I'm working on a project at work, a
menthol spraying unit for cigarettes making machines, and I'm thinking about
adding some funny noises to my system...
If I've some time, I'll experiment with a mike to see how the Stamp can
detect sounds.
Best regards,

Phil.

Original Message
From: <jffgres@a...>
To: <basicstamps@yahoogroups.com>
Sent: Wednesday, February 07, 2001 3:05 PM
Subject: [noparse][[/noparse]basicstamps] Code for R2D2 sounds


> It needs some optimization, but it is the basis.
>

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-02-07 14:05
    It needs some optimization, but it is the basis.

    i var word
    j var word
    spkr var nib

    spkr=5 ' speaker pin

    output spkr


    ' --- test ---- (change at your own convenience )

    gosub sound_18
    gosub sound_1
    gosub sound_18
    pause 500

    gosub sound_2
    gosub sound_3
    gosub sound_6
    pause 500


    gosub sound_1
    gosub sound_4
    gosub sound_0
    pause 500

    gosub sound_16
    gosub sound_17
    gosub sound_15
    pause 500

    gosub sound_18
    gosub sound_13
    gosub sound_18
    gosub sound_3
    gosub sound_18
    gosub sound_7
    gosub sound_8

    stop '--- end of test


    ' --- noises
    sound_0:
    for j=1 to 4
    for i=2000 to 50 step 400
    freqout spkr,10,i
    next
    for i=800 to 2000 step 400
    freqout spkr,10,i
    next
    next
    return

    sound_1:
    for i = 800 TO 2000 STEP 100
    freqout spkr,10,i
    next
    for i= 2000 TO 50 step 100
    freqout spkr,10,i
    next
    return

    sound_2:
    for i = 1000 to 40 step 20
    freqout spkr,10,i
    next
    return


    sound_3:
    for i = 10000 to 500 step 500
    freqout spkr,10,i
    next
    return

    sound_4:
    for i = 10 to 50 step 10
    for j = 50 TO 10 step 10
    freqout spkr,15,j*20
    next
    next
    return

    sound_5:
    for i = 1 TO 120 step 2
    freqout spkr,10,(sin(i + 40) * 50)
    next
    return

    sound_6:
    for i=10 TO 50 step 10
    for j = 50 to 10 step 10
    freqout spkr,10,i * J
    next
    next
    return

    sound_7:
    for i = 30 to 70 step 5
    for j = 70 to 30 step 5
    freqout spkr,10,i*j
    next
    next
    return


    sound_8:
    for i= 30 to 60 step 10
    for j = 60 to 30 step 10
    freqout spkr,10,i * j
    next
    next
    return


    sound_9:
    for i=1 to 60 step 7
    freqout spkr,10,(sin(i) + 20) * 30
    next
    return

    sound_10:
    for i = 1 TO 30
    freqout spkr,20,(i * 14) + 450
    next
    return

    sound_11:
    FOR i = 10000 TO 500 STEP 500
    freqout spkr,20,i
    NEXT
    return

    sound_12:
    FOR i = 102 TO 82 STEP 2
    freqout spkr,40,(COS(i/100) + 36) * 25
    freqout spkr,20,(SIN(i/100) + 20) * 50
    NEXT
    return

    sound_13
    FOR i = 1 TO 10
    freqout spkr,40,1195
    freqout spkr,40,2571
    NEXT
    return

    sound_14
    FOR i = 1 TO 3
    freqout spkr,90, 550
    freqout spkr,90, 400
    NEXT
    return

    sound_15
    FOR I = 40 TO 15 STEP 1
    freqout spkr,5,I * 90
    freqout spkr,5,I * 80
    freqout spkr,5,I * 70
    freqout spkr,5,I * 60
    freqout spkr,5,I * 50
    NEXT
    return

    sound_16
    FOR I = 1 TO 20
    freqout spkr,20,1195 - 50 * I
    freqout spkr,20,1195 + 50 * I
    NEXT
    return

    sound_17
    FOR I = 0 TO 150 STEP 10
    freqout spkr,20,1295 - I
    freqout spkr,20,1095 + I
    NEXT
    return

    sound_18
    FOR I = 1 TO 20
    freqout spkr,10,I * 50
    freqout spkr,10,I * 100
    freqout spkr,10,I * 150
    NEXT
    return

    have fun.
    Josep
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-08 13:19
    Thanks much,
    Russ



    Original Message
    From: <jffgres@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, February 07, 2001 9:05 AM
    Subject: [noparse][[/noparse]basicstamps] Code for R2D2 sounds


    | It needs some optimization, but it is the basis.
    |
    |
    | i var word
    | j var word
    | spkr var nib
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-09 11:58
    Good Job and thanks for sharing this with us.

    Tim
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-09 12:52
    --- In basicstamps@y..., Trkeenan@a... wrote:
    > Good Job and thanks for sharing this with us.
    >
    > Tim

    Thank you all, I'm very glad that you like the code, if anyone makes
    modifications or enhacements, I would like to see it.

    Thank you.

    Josep
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-10 05:54
    Could I get that code?
  • ArchiverArchiver Posts: 46,084
    edited 2001-02-11 21:50
    Where is this code for the R@D2 sounds ? Did I miss a message ?

    Leroy@f...

    Philippe Derenne wrote:
    >
    > Many thanks, Josep, we'll have fun ! I'm working on a project at work, a
    > menthol spraying unit for cigarettes making machines, and I'm thinking about
    > adding some funny noises to my system...
    > If I've some time, I'll experiment with a mike to see how the Stamp can
    > detect sounds.
    > Best regards,
    >
    > Phil.
    >
    >
    Original Message
    > From: <jffgres@a...>
    > To: <basicstamps@yahoogroups.com>
    > Sent: Wednesday, February 07, 2001 3:05 PM
    > Subject: [noparse][[/noparse]basicstamps] Code for R2D2 sounds
    >
    > > It needs some optimization, but it is the basis.
    > >

    --
Sign In or Register to comment.