<br><font size=2 face="sans-serif">OK, &nbsp;Here is the answer:</font>
<br>
<br><font size=2 face="sans-serif">There are three implementors of 'storeSampleCound:bigEndian:on:' :</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; AbstractSound&gt;&gt;storeSampleCount: samplesToStore bigEndian: bigEndianFlag on: aBinaryStream</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; LoopedSampledSound&gt;&gt;storeSampleCount: samplesToStore bigEndian: bigEndianFlag on: aBinaryStream</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; SampledSound&gt;&gt;storeSampleCount: samplesToStore bigEndian: bigEndianFlag on: aBinaryStream</font>
<br>
<br><font size=2 face="sans-serif">The AbstractSound implementation does what you want, while the other two (which are identical) do not account for the envelopes. &nbsp;These were all present as of December 2001, &nbsp;attributed to John Maloney and were modified by Stephane Ducasse in 2003 to clean up the way that the current endianness is checked.</font>
<br>
<br><font size=2 face="sans-serif">I don't know why there are two essentially different implementations. &nbsp;My initial inclination is that the 'LoopedSampledSound' and 'SampledSound' implementaions are unnecessary and should be removed, but I really don't know what John was thinking about, and the comments don't really say. &nbsp;Does anybody know the history on this? &nbsp;I don't know if it would break any extant code if only the 'AbstractSound' implementation were kept.</font>
<br>
<br><font size=2 face="sans-serif">Regarding 'RepeatingSound', that will take some more digging. &nbsp;I can say that if you add the envelope to the SampledSound that is created from the wave file, then create a RepeatingSound using the SampledSound that has an amplitude envelope, you will hear the envelope for each repetition.</font>
<br>
<br><font size=2 face="sans-serif">This might be a weakness in how envelopes are used for playback. &nbsp;Presumably, an envelope applied to the 'RepeatingSound' should control the overall volume of the composite sound, but that doesn't seem to be what is happening.</font>
<br>
<br><font size=2 face="sans-serif">As Chris mentioned, the debugger is your friend. &nbsp;Add &quot;self halt.&quot; before a message send you want to debug, click on 'Debug' when the 'Halt' notification window pops up and then use the 'Over' and 'Into' buttons to single step through the code.</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; -Dean</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>Dean_Swan@Mitel.COM</b></font>
<br><font size=1 face="sans-serif">Sent by: squeak-dev-bounces@lists.squeakfoundation.org</font>
<p><font size=1 face="sans-serif">05/05/2006 05:11 PM</font>
<br><font size=1 face="sans-serif">Please respond to The general-purpose Squeak developers list &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br>
<td><font size=1 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; To: &nbsp; &nbsp; &nbsp; &nbsp;rjriv@sbcglobal.net, The general-purpose Squeak developers list &lt;squeak-dev@lists.squeakfoundation.org&gt;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; cc: &nbsp; &nbsp; &nbsp; &nbsp;Dan@SqueakLand.org, jmaloney@media.mit.edu</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Subject: &nbsp; &nbsp; &nbsp; &nbsp;Re: How to Fade-In/Fade-Out a Sampled/Repeating/Mixed Sound</font></table>
<br>
<br>
<br><font size=2 face="sans-serif"><br>
Hi Rob,</font><font size=3 face="Times New Roman"> <br>
</font><font size=2 face="sans-serif"><br>
If you try this:</font><font size=3 face="Times New Roman"> <br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;snd := (SampledSound fromWaveFileNamed: 'aWAVFile.wav').<br>
 &nbsp; &nbsp; &nbsp; snd addEnvelope: (VolumeEnvelope exponentialDecay: 0.96). <br>
 &nbsp; &nbsp; &nbsp; &nbsp;snd play. <br>
</font><font size=2 face="sans-serif"><br>
You will hear the effect of the envelope, as desired.</font><font size=3 face="Times New Roman"> <br>
</font><font size=2 face="sans-serif"><br>
This:</font><font size=3 face="Times New Roman"><br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;snd storeWAVOnFileNamed: ' out.wav'.<br>
</font><font size=2 face="sans-serif"><br>
should have done what you want, but obviously it does not. &nbsp;I have spent a little time tracking this, but I haven't found the problem yet.</font><font size=3 face="Times New Roman"> <br>
</font><font size=2 face="sans-serif"><br>
I will send another reply when I figure this out (maybe today, or later this weekend).</font><font size=3 face="Times New Roman"> <br>
<br>
</font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;-Dean</font><font size=3 face="Times New Roman"> <br>
<br>
<br>
<br>
<br>
</font>
<table width=100%>
<tr valign=top>
<td width=1%>
<td width=52%><font size=1 face="sans-serif"><b>&quot;Rob Rothwell&quot; &lt;r.j.rothwell@gmail.com&gt;</b></font><font size=3 face="Times New Roman"> </font><font size=1 face="sans-serif"><br>
Sent by: squeak-dev-bounces@lists.squeakfoundation.org</font><font size=3 face="Times New Roman"> </font>
<p><font size=1 face="sans-serif">05/03/2006 10:25 PM</font><font size=3 face="Times New Roman"> </font><font size=1 face="sans-serif"><br>
Please respond to rjriv; Please respond to The general-purpose Squeak developers list &nbsp; &nbsp; &nbsp; &nbsp;</font><font size=3 face="Times New Roman"> </font>
<td width=46%><font size=1 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=1 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;To: &nbsp; &nbsp; &nbsp; &nbsp;squeak-dev@lists.squeakfoundation.org</font><font size=3 face="Times New Roman"> </font><font size=1 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;cc: &nbsp; &nbsp; &nbsp; &nbsp;</font><font size=3 face="Times New Roman"> </font><font size=1 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;Subject: &nbsp; &nbsp; &nbsp; &nbsp;How to Fade-In/Fade-Out a Sampled/Repeating/Mixed Sound</font></table>
<br><font size=3 face="Times New Roman"><br>
<br>
<br>
Does anyone know how to fade a mixed sound? &nbsp;I am creating a MixedSound which includes both a RepeatingSound (based on a looped SampledSound from a WAV file), and an FMSound. &nbsp;<br>
<br>
I pretty much know how to apply a VolumeEnvelope to an FMSound by looking at the exponentialDecay method, but applying a VolumeEnvelope to a SampledSound, RepeatingSound, or MixedSound seems to have no effect. <br>
<br>
For example...<br>
<br>
snd := RepeatingSound new.<br>
snd setSound: (SampledSound fromWaveFileNamed: 'aWAVFile.wav') iterations: 1.<br>
snd addEnvelope: (VolumeEnvelope exponentialDecay: 0.96).<br>
snd storeWAVOnFileNamed: ' out.wav'.<br>
<br>
...shows no effect on the waveforms in the resulting WAV file, even if I change the step size of the increments in the exponentialDecay to drag the decay out much further...<br>
<br>
Do I need to write a method to modify the SoundBuffer values of the SampledSound directly? &nbsp;If so, I'm afraid I will need much more help! <br>
<br>
I just don't know enough technically about sound generation to trace my way through the updateTargetAt method of the VolumeEnvelope class to figure out what is going on with a non-FMSound...<br>
<br>
Thanks,</font>
<br><font size=3 face="Times New Roman"><br>
Rob<br>
</font><font size=2 face="Courier New"><br>
</font><font size=3 face="Times New Roman"><br>
<br>
</font><font size=2 face="Courier New"><br>
</font>
<br>
<br>