On Monday, March 13, 2023 2:11:11 PM CET Dorinda Bassey wrote: > Hi Volker, > > > > To hear this, > > start QEMU with qemu-system-x86_64 -machine pcspk-audiodev=audio0 > > -device ich9-intel-hda -device hda-duplex,audiodev=audio0 -audiodev > > pipewire,id=audio0,out.mixing-engine=off ... > > > I hear the clipped audio stream with these options. IMO, I don't think > memset is responsible for that behaviour, I still hear the harsh sound with > "-audiodev pa". I also tried using an alternative like: > > @@ -117,7 +118,7 @@ playback_on_process(void *data) > } > > if (avail == 0) { > - memset(p, 0, n_bytes); > + p = g_malloc0(sizeof(n_bytes)); > } else { > > The clipped audio issue is still persistent.
Are you sure about sizeof(n_bytes) here? That's 4. ;-) Volker's point was that "silence" is the center of the wave range. With signed range that's zero, yes, but with unsigned range that's 2^(bitdepth) / 2. So you need to memset() the correct value to generate "silence". Best regards, Christian Schoenebeck