<div dir="ltr">With the MIDI note added to the AIFF file markers, plus my changeset, everything works correctly; the [<span style="color:rgb(0,0,0)">ScorePlayerMorph extraExample openInHand] example plays properly (and pleasingly) when all the instruments are set to the new SampledInstrument 'cello f'. </span></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Feb 5, 2022 at 9:41 AM David O'Toole <<a href="mailto:deeteeoh1138@gmail.com">deeteeoh1138@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thank you so much for your help Karl!<div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Feb 5, 2022 at 9:37 AM karl ramberg <<a href="mailto:karlramberg@gmail.com" target="_blank">karlramberg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Cool</div><div><br></div><div>Best, <br></div><div>Karl<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Feb 5, 2022 at 3:32 PM David O'Toole <<a href="mailto:deeteeoh1138@gmail.com" target="_blank">deeteeoh1138@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">"markers last last" <---- this isn't correct, it should be "markers second last" as it is definitely legitimate for AIFF files to contain more than two markers. Indeed with the following changeset, I get a working (if somewhat wonky and still needing to be debugged) instrument.<div><br></div><div>vCello := SampledInstrument readSimpleInstrument: 'cello' fromDirectory: '/home/dto/sessions/orch.mosaic'.<br></div><div>vCello playChromaticRunFrom: 10 to: 40.<br>(vCello soundForMidiKey: 20 dur: 8.0 loudness: 0.5) play.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Feb 5, 2022 at 9:03 AM karl ramberg <<a href="mailto:karlramberg@gmail.com" target="_blank">karlramberg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br>
</div><div>I think there is something wrong with the logic for AIFFFileReader instance variable isLooped.</div><div>I don't see the error if I hard code isLooped to false in method below.</div><div><br></div><div>AIFFFileReader>>readInstrumentChunk: chunkSize</div><div>...</div><div>
isLooped := sustainMode = 1.

</div><div>(isLooped and: [markers notNil]) ifTrue: [<br>             ((markers first last > frameCount) or:<br>              [markers last last > frameCount]) ifTrue: [<br>                       "bad loop data; some sample CD files claim to be looped but aren't"<br>                     isLooped := false]].</div><div><br></div><div>
The logic for determining if a sound is looped seems a little error-prone.

</div><div><br></div><div>Loop length in AIFFFileReader is calculated from markers</div><div>Markers in 
36.aif is 
 #(#(1 '' 44100) #(2 '' 88200) #(3 '' 0) #(4 '' 0)). <br></div><div><br></div><div>markers := #(#(1 '' 44100) #(2 '' 88200) #(3 '' 0) #(4 '' 0)).</div><div>markers last last - markers first last  "How AIFFFileReader calculates loop length"<br></div><div>-44100</div><div><br></div><div>Best,</div><div>Karl</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Feb 5, 2022 at 1:36 PM David O'Toole <<a href="mailto:deeteeoh1138@gmail.com" target="_blank">deeteeoh1138@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Try placing the unzipped "cello f" folder into directory "path_to_foo" then: </div><div><br></div>SampledInstrument readSimpleInstrument: 'cello' fromDirectory: 'path_to_foo'<div><br></div><div>I see your comment about the negative loop length, however this appears to be the bug itself---I verified in Snd that the loop points are 44100 and 88200.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Feb 5, 2022 at 7:08 AM karl ramberg <<a href="mailto:karlramberg@gmail.com" target="_blank">karlramberg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">
<pre>Do you have a short doIt to load these samples ?<br>I'm not sure how you set it up.<br>A quick look at aiffloop.txt I see this: <br>LoopedSampledSound>>samples:loopEnd:loopLength:pitch:samplingRate:
        Receiver: a LoopedSampledSound
        Arguments and temporary variables: 
                aSoundBuffer:   a SoundBuffer(0 0 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 2 2 2 2 1 1 0...etc...
                loopEndIndex:   0
                loopSampleCount:        -44100<br><br></pre><pre>So there will probably be issues with negative number of samples in the loop<br><br></pre><pre>Best,<br>Karl<br></pre>

</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Feb 5, 2022 at 2:46 AM David O'Toole <<a href="mailto:deeteeoh1138@gmail.com" target="_blank">deeteeoh1138@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>(Apologies if this is a double post, I think the other will be rejected on account of the 2+MB AIFF file I attached. Instead I've put up a Zip file of the AIFFs I'm trying to import, on GDrive: <a href="https://drive.google.com/file/d/16BvtxS9tkIPJRcx-cri1gPGM5p0E7uV_/view?usp=sharing" target="_blank">https://drive.google.com/file/d/16BvtxS9tkIPJRcx-cri1gPGM5p0E7uV_/view?usp=sharing</a></div><div><br></div><div>Original message: </div><div><br></div><div>I have AIFF files with loop points all set the same, beginning at sample 44100 and ending at 88200. I am trying to use SampledInstrument(class)>>#readSimpleInstrument:fromDirectory: to create a sampled instrument. </div><div><br></div><div>In Snd i can verify the loop points are correct:</div><div><br></div>> >(sound-loop-info (open-sound "~/sessions/orch.mosaic/cello f/36.aif"))<br>(44100 88200 0 0 0 0 1 1)<br><div><br></div><div>But as you can see in the bug report/screenshot, the end point becomes 0 somehow when it reaches note 36.aif, resulting in an error. I've also included the offending .aif file, which might be malformed in some way I haven't discovered. </div><div><br></div><div>How might I go about debugging this further? </div></div>
<br>
</blockquote></div>
<br>
</blockquote></div>
<br>
</blockquote></div>
<br>
</blockquote></div>
<br>
</blockquote></div>
<br>
</blockquote></div>
</blockquote></div>