[squeak-dev] Sound mixing makes nasty noises
tim Rowledge
tim at rowledge.org
Sun Jan 3 00:53:51 UTC 2021
> On 2021-01-02, at 2:14 PM, tim Rowledge <tim at rowledge.org> wrote:
>
>
>
>> On 2021-01-01, at 9:38 PM, tim Rowledge <tim at rowledge.org> wrote:
>>
>> The Great Saga marches onward...
The recently update pulse libraries for Pi seem to have removed a lot of the especially ugly graunching, which is nice to hear. It's still quite nasty when using full volume range sounds and playing multiple sounds simultaneously though; maybe some use of MixedSound might help but it remains true that the alsa setup doesn't do this.
I've also realised that there is a definite buffer-size aliasing problem regardless of the alsa/pulse setup.
Given that the normal buffer size is set to 120mS worth of samples, consider this snippet
|snd volume dur|
volume:= 100.
dur := 120.
10 timesRepeat: [
snd := FMSound new.
snd
setPitch: (AbstractSound pitchForMIDIKey: 60)
dur: 1000
loudness: ((volume / 100.0) within: 0.0 and: 1.0).
snd play.
dur milliSeconds wait.
snd stopGracefully.
snd := FMSound new.
snd
setPitch: (AbstractSound pitchForMIDIKey: 58)
dur: 1000
loudness: ((volume / 100.0) within: 0.0 and: 1.0).
snd play.
dur milliSeconds wait.
snd stopGracefully]
This makes a nice dee-dah-dee-dah... sequence, very cleanly.
Change 'dur' to 150 and try again...on either sound library the second version is incorrect and more dee-dah-de-da-dee-daaah-d-dah.. sort of choppy. 300 is less awful but still wrong. 240 is fine, as one might imagine.
Just whose idea was generating sounds with computers? I want a word...
tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Flabbergasted (adj.), appalled over how much weight you have gained.
More information about the Squeak-dev
mailing list
|