Audio, Streams, and MailMessage question

Brian Brown rbb at techgame.net
Wed Aug 22 17:27:05 UTC 2007


Hello All,

	I am using SoundRecorder to record and I can use  
SoundRecorder>>storeWAVOnFileNamed: to create a file of the recorded  
sound without fail. The method #storeWAVOnFileNamed: uses  
SoundRecorder>>storeWAVSamplesOn: aStream to save the sampled sound  
to the FileStream. I would like to use that same method so I can get  
the WAV data without writing it to a file and reading it back out again.

I have tried the following:

	s := ReadWriteStream on: (ByteArray new: 5000).
	s binary.
	recorder recordedSound storeWAVSamplesOn: s.
	^ s.

and then later, I send the  stream (s) to   
MailMessage>>addAttachmentFrom:withName:

The resultant email message looks fine and has an attached wav file  
with 0 bytes.


MailMessage>>addAttachmentFrom:withName: creates a MIMEDocument and  
sends #upToEnd to the Stream to get the data. Senders in the image  
usually pass in a FileStream, and I don't understand the difference  
as to why another kind of stream would not work.

Any help would be welcome!

- Brian




More information about the Squeak-dev mailing list