[etoys-dev] Accessing sound level (was Re: Join us for a sprint week before Squeakfest in July!)

Bert Freudenberg bert at freudenbergs.de
Sat Apr 24 16:10:53 EDT 2010

(please remember to change the subject line when a discussion thread wanders off the original topic)

On 24.04.2010, at 06:38, Steve Thomas wrote:
> Subbu,
> Thanks, I like the idea of 'smoothing" my main question though is how do I get  "sound level" and "sound pitch" to change values?  On my Mac they are always zero.  World Stethoscope seems to work, I'll try that.
> Thanks,
> Stephen

I can't get it to work on the Mac here, either. But there is a trick I used before:

Get a SoundRecorder. Click Record, then Stop, to get it going. Whenever you make noise, the yellow bar will extend.

Now here comes the trick: that yellow bar is an object. Make some noise to make it large enough to click, then get its halo (it's called "Morph1"). Now you can just use its width (from "extended geometry") in another script ...

There is a lesson to learn for developers from this: whenever possible, don't just modify draw routines, use actual objects instead. The "normal" way to program this would be to paint the bar onto the screen. But when you do that, it's just pixels, not objects anymore. By making the bar an actual object, its properties, such as width, can be accessed. Objects FTW ;)

- Bert -

-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: http://lists.squeakland.org/pipermail/etoys-dev/attachments/20100424/4f50cd8b/attachment.html

More information about the etoys-dev mailing list