<div style="font-family: Arial, sans-serif; font-size: 14px;"><p>It seems that I just found a small bug when playing around with the Sound package.</p><p>From a Workspace do:</p><p>Feature require: 'Sound'.<br>
(PluckedSound default) storeWAVOnFileNamed: '/tmp/foo.wav'.</p><p><br></p><p>Exception raised.. Here's the offending stack:</p><p>SoundBuffer(Object)>>doesNotUnderstand: #asUtfBytes</p><p> UniFileStream>>nextPutAll:: aStringOrBytes<br>
    "Argument can be String, UnicodeString or ByteArray.<br>
    Write to this file. Both kinds of Strings are UTF-8 encoded."<br>
  <br>
    | bytes |<br>
    aStringOrBytes isEmpty ifTrue: [ ^self ].<br>
    bytes := aStringOrBytes.<br>
    (aStringOrBytes is: #ByteArray) ifFalse: [<br>
        bytes := aStringOrBytes asUtf8Bytes].   <---  Exception raised here.</p><p><br></p><p>My naive newbie fix is as follows: </p><p>AbstractSound>>storeSampleCount: samplesToStore bigEndian: bigEndianFlag on: aBinaryStream</p><p>.. Clipped ..<br>
  <br>
    'Storing audio...' displayProgressAt: Sensor mousePoint<br>
        from: 0 to: samplesToStore during: [:barBlock | | remaining out |<br>
            remaining := samplesToStore.<br>
            [remaining > 0] whileTrue: [<br>
                barBlock value: samplesToStore - remaining.<br>
                stereoBuffer primFill: 0.  "clear the buffer"<br>
                self playSampleCount: (bufSize min: remaining) into: stereoBuffer startingAt: 1.<br>
                self isStereo<br>
                    ifTrue: [out := stereoBuffer asByteArray] "<-- answer ByteArray instead of SoundBuffer"<br>
                    ifFalse: [out := stereoBuffer extractLeftChannel asByteArray]. "<--- and here"</p><p>... Clipped ..</p><p>This has let me work around the bug but I'm a complete Cuis noob so take it FWIW.</p><p><br></p><p>Best Regards,</p><p>-Dave </p><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div>
<div style="font-family: Arial, sans-serif; font-size: 14px;" class="protonmail_signature_block">
    <div class="protonmail_signature_block-user protonmail_signature_block-empty">
        
            </div>
    
            <div class="protonmail_signature_block-proton">
        Sent with <a href="https://proton.me/mail/home" target="_blank">Proton Mail</a> secure email.
    </div>
</div>