[squeak-dev] Sound mixing makes nasty noises

Herbert König herbertkoenig at gmx.net
Thu Dec 24 20:18:59 UTC 2020


Hi Tim,

ATM I get no sound from Squeak or Scratch on my Raspi3. I updated the OS
but it still doesn't say "Raspberry Pi OS"

With some googling I got Audio working from Audacity (simple Audio
Editor I use on Raspi, Linux and Windows). I use Squeak5.3-19439.

Recording with a phone will show some glitches but the bandwidth of
phone (and monitor speakers) mellows down (err filters) the waveform.
Surely only second choice.

I would not mind downloading and using the proper Squeak to get sound going.

Any quick help?

Cheers,

Herbert



Am 24.12.2020 um 20:58 schrieb tim Rowledge:
>
>> On 2020-12-24, at 2:35 AM, Herbert König <herbertkoenig at gmx.net> wrote:
>>
>> There's always a chance that the OS meddles with it too. Notably on
>> Windows if you simultaneously play and record it looses buffers
>> sometimes. And often it is the combination of application and OS.
> Yah. It certainly isn't impossible that changes to the underlying libraries are causing issues; after, my original work on this was done six years ago and the basic sound related stuff may be 20 years old.
>
>> I didn't find the place where Squeak audio goes out to the OS but
>> writing this to a (preferably .wav) file would give a chance to analyse
>> what happens inside Squeak. If anybody can post the necessary changes I
>> can do that and check.
> I can see three plausible places where it might be smart to record things
> a) copy the sound buffer samples as sent to the prim in the #playLoop method
> b) copy the samples actually sent to the OS by the VM
> c) copy the sound output by the OS
>
> I suspect that somebody can point to an application to record the final output cleanly.
>
>> I will set up a Pi and record the audio (hardware) output with another
>> computer to see the sum of the effects.
> I was almost at the point of just aiming my iPhone at the screen.
>
>> Are the snippets in your original post those which produce the problem
>> on a Pi? Would be more comparable then waggling the keyboard.
> Yes and no; that code shows off how the volume level can drive things into a screeching mess.
>
> Here is another snippet that seems to illustrate things a bit better -
>
> |snd volume |
> volume:= 40.
> 10 timesRepeat: [
> 	snd := FMSound new.
> 	"250 milliSeconds wait."
> 	snd
> 		setPitch: (AbstractSound pitchForMIDIKey: 60)
> 		dur: 1000
> 		loudness: ((volume / 100.0) min: 1.0 max: 0.0).
> 	snd play.
> 	50 milliSeconds wait.
> 	snd stopGracefully.
> 	"250 milliSeconds wait."
> 	snd := FMSound new.
> 	snd
> 		setPitch: (AbstractSound pitchForMIDIKey: 58)
> 		dur: 1000
> 		loudness: ((volume / 100.0) min: 1.0 max: 0.0).
> 	snd play.
> 	50 milliSeconds wait.
> 	snd stopGracefully]
>
> You might experiment with
> - the volume setting
> - the variety of FMSound (organ1 includes an envelope or two to mix things up a bit)
> - the commented out between-sound delay, which I used to try to avoid two sounds overlapping in order to test the hypothesis that mixing was messing up
>
> And depending on the update level of your image, the "X milliSeconds wait" might need to be changed back to "(Delay forMIlliSeconds: X) wait" etc.
>
> I get a strangely interesting effect that is probably suggesting something important (and that I'm not yet getting) with the between-sound delay used and set to 150 mS. It's as if there is some mangling of buffers going on. At 100mS it goes berserk; at 200 it sounds perfectly regular.
>
> I'm going to indulge in some code scanning to try to spot changes made that might affect this. I'll be interested how you see, or rather hear, things.
>
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> "Bother!" said Pooh, as Piglet pressed <START> on the Microwave...
>
>
>



More information about the Squeak-dev mailing list