[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> Re: SOUND experiments...



> to testsnd
> make "freq random 10000
> sound [:freq 100]
> end

That's not what I sent you !!!

You must understand how to form lists or you will be very
confused with logo. It's the power behind logo.

This is what I sent you and works fine.

SOUND (list random 10000 100)

OR this is also fine (both extracted from my email)

make "freq (random 20)*1000
SOUND (list :freq 100)

SOUND takes a LIST of elements. The number of elements must be even.

SOUND [1000 100 2000 100 3000 100]

The reason for this is so you can build long complex strings of
notes without Logo parsing speed interfering (no clicks or gaps).
See the online example for SOUND which does exactly this. Here is
that example which is a bit more complex.

make "zing []
repeat 50 [make "zing lput repcount*10 :zing make "zing lput 100 :zing]
sound :zing

The above starts with an empty list and appends "values" to the end,
a frequency (controlled by the loop counter) always followed by a fixed
delay of 100. After running the above try.

SHOW :zing

The below is wrong and the reason I referred you to the SETPENCOLOR
example.

make "freq 1000
SOUND [:freq 100]

You sent SOUND the list containing an element that is a string ":freq".
You want logo to take the value of :freq (1000) and put 1000 in a new
list.

The function LIST does this and takes the value of :freq and puts that
value
into a list and then outputs [1000 100] which is then passed to SOUND
and then SOUND is happy, so happy it sings.

Try this so you can SEE what SOUND will see.

make "freq 1000
SHOW [:freq 100]
SHOW (list :freq 100)

To get help on something do this:

HELP "SETPENCOLOR
HELP "SOUND

Bob Gorman wrote:
> 
> Some experiments from Brian's response:
> [from Brian
> About your specific questions first:  I don't know what George's
> SOUND primitive requires, but I gather from your example that
> it's two numbers.  You said
>         sound [random 10000 100]
> and what I'm guessing you meant is
>         sound (random 10000) (random 100)
> RANDOM takes one input and (like all functions) gives one output;
> you can't get two at once.  Also, the square brackets mean that
> you are using the actual text inside as the input to SOUND, not
> the result of evaluating that text as a Logo expression.
> ]
> 
> sound (random 10000) 100            -->Sound Error - Bad Argument
> Stopping...
> sound (random 10000) (100)    -->Sound Error - Bad Argument
> Stopping...
> sound [(random 10000) (100)]  -->Sound Error - Not paired
> Stopping...
> sound [(random 10000) 100]    -->Sound Error - Not paired
> Stopping...
> sound (random 10000) (random 100)-->Sound Error - Bad Argument
> Stopping...
> 
> I also tried it in a procedure...
> to testsnd
> make "freq random 10000
> sound [:freq 100]
> end
> I get "sound doesn't like :freq as input  in testsnd"
> 
> any thoughts?
> Bob

-- 
===============================================================
George Mills
email: mills@softronix.com
http://www.softronix.com
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home