[squeak-dev] Many questions about sounds :-)

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Mon Jun 28 11:12:31 UTC 2021


Ah, that's interesting. :-) But why is "[] newProcess" blazing fast whereas the invocation in the SoundPlayer is so expensive? Is this somehow related to the resources (closure vector) that need to be shared in this case?


Best,

Christoph

<http://www.hpi.de/>
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 28. Juni 2021 12:41:32
An: squeak-dev
Betreff: Re: [squeak-dev] Many questions about sounds :-)

Hi Christoph.

> Still, I'm confused about how starting a process can take more than 100 milliseconds, which looks suspicious to me ... :-)

While it might be nice if we could somehow speed up "process" management in Squeak, creating OS threads (and similar control structures) is known to be a noticeable overhead for highly-async applications. There are "thread pools" to mitigate this, for example:

https://docs.microsoft.com/en-us/windows/win32/procthread/thread-pools
https://refspecs.linuxbase.org/gtk/2.6/glib/glib-Thread-Pools.html

Such a "process pool" for Squeak would be cool. :-)

pool nextWorker value: [:process | process priority: 45. self doWork].

Best,
Marcel

Am 28.06.2021 12:30:35 schrieb Thiede, Christoph <christoph.thiede at student.hpi.uni-potsdam.de>:

Hi Marcel,


> If you want to play sounds in your application an rely on timing, the SoundPlayer process should never stop but always run. You can achieve this by always playing an "empty sound" while additional sounds will be mixed in.


Yes, I have already considered such a kind of workaround. Still, I'm confused about how starting a process can take more than 100 milliseconds, which looks suspicious to me ... :-)
<http://www.hpi.de/>

Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 28. Juni 2021 11:05:09
An: squeak-dev
Betreff: Re: [squeak-dev] Many questions about sounds :-)

Hi Christoph.

> Why does it take so much time to start the SoundPlayer?

If you want to play sounds in your application an rely on timing, the SoundPlayer process should never stop but always run. You can achieve this by always playing an "empty sound" while additional sounds will be mixed in.

Best,
Marcel

Am 27.06.2021 20:22:20 schrieb Thiede, Christoph <christoph.thiede at student.hpi.uni-potsdam.de>:

Hi all!


As I'm currently developing a small project that uses sounds in Squeak, I have collected a number of questions about the Sound package and am hoping to find some answers here. Even if you are able to answer one or two questions only, I will appreciate your help! :-)


1. What is the difference between QueueSound and SequentialSound? Roughly speaking, they both appear to do the same. AbstractSound >> #, uses SequentialSound whereas QueueSound might be thread-safe. Is there any reason why the two are not unioned into a single class?

2. Why could my coffeeCupClink be broken? It's already the second image in which I, after playing around a bit with sounds, managed to break that sound by accident. In both affected images, Beeper beep just does not beep any more. However, all other SampledSounds still sound fine. SampledSound initialize and VM restart didn't help. I even tried to find out what's going wrong with the help of comparative debugging of #play, but I did not discover any meaningful difference ...

3. SoundService/SoundPlayer/SoundSystem are not thread-safe, are they?

4. Why does it take so much time to start the SoundPlayer? I could reproduce this in two images using: [[PluckedSound default play] timeProfile] fork. In both cases, the image was busy for ~150ms. If another sound is already playing, #play is fast. According to the TimeProfileBrowser, #newProcess eats up all the time (see attachment), but can this really be true? Can you reproduce this on your machines or could this be a Windows-specific thing?

5. Is there any built-in way for loudness normalization (as opposed to "normal" volume)?

6. Can you recommend any further resources in Squeak for other sound concepts such as ring modulation, sawtooth/triangle/square waves, or also other musical instruments? For example, there are flutes and oboes, but I did not find a piano sound. Would it be possible to build one as a combination of FMSounds or are these instruments more sophisticated to program?

Thanks in advance and have a happy weekend!

Best,
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210628/2d606b65/attachment.html>


More information about the Squeak-dev mailing list