<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi<div>sorry, the correct word is probably sustain part, the post-attack-stable part of sound that you may be able to loop easily, for instance the quasi-steady state of a piano tone after the attack during the quasi-flat decay.</div><div>Something found in archives presents very clearly the problem, and a possible implementation :&nbsp;</div><div><br></div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">Let's suppose this is the sample:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">|<i>-----SS-----LB-----LE------|</i></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">where:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">SS= sample start (where we want the sample to start playing the first time)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">LB= loop begin</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">LE= loop end</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">With appropriate calculations, the two phasors can be adjusted so that:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">1) Phasor A reproduces the sample the first time from SS to LE in its first&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">cycle. In subsequent cycles it would do the same but it will be muted so we&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">don't mind.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">2) Phasor B reproduces the loop region; its initial phase is calculated in&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">such a way that at the beginning, when it is muted, it will be producing&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">garbage, but when phasor A will reach point LB for the first time, phasor B&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">will also be on LB, so that, during ONE cycle of phasor B, the two phasors&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">will be reproducing *exactly* the same portion LB-LE synchronously.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">So, at any moment of that cycle, we can (and we must) safely switch from the&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">output of phasor A to that of phasor B; we don't need to do a crossfade&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">because the two outputs are perfectly identical.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">So, for detecting when to switch, we can use a [threshold~] on LB on the&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">output of phasor A, even if threshold is block quantized. No matter if the&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">actual switching occurs with a delay of almost one block, it will still be&nbsp;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 13px/normal Courier; ">safe to switch.</div></div><div><br></div><div>... which seems brilliant ! (sorry i do not remember this contribution's author)</div><div>Has this solution been implemented ?</div><div>Is there an abstraction&nbsp;in a library addressing the same basic need ?</div><div>&nbsp;</div><div>JM</div><div><br></div><div><div>Le 1 août 2012 à 18:54, Patrice Colet a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">hello,<br><br>what is 'resonance part'?<br><br>in principle you compute the loop size in ms and send the result to [phasor~] or [vline~] for driving [tabread4~]<br><br>Colet Patrice<br><br>----- Mail original -----<br><blockquote type="cite">De: "Jean-Marie Adrien" &lt;<a href="mailto:jma@jeanmarie-adrien.net">jma@jeanmarie-adrien.net</a>&gt;<br></blockquote><blockquote type="cite">À: "<a href="mailto:pd-list@iem.at">pd-list@iem.at</a>&nbsp;List" &lt;<a href="mailto:pd-list@iem.at">pd-list@iem.at</a>&gt;<br></blockquote><blockquote type="cite">Envoyé: Mercredi 1 Août 2012 10:10:31<br></blockquote><blockquote type="cite">Objet: [PD] looping at the end of sample<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Hi list<br></blockquote><blockquote type="cite">have looked at the archives threads concerning &nbsp;managing the<br></blockquote><blockquote type="cite">tabread4~'s index &nbsp;for reading an audio sample from the beginning<br></blockquote><blockquote type="cite">and then loop on a chunk at the end (in the resonance part).<br></blockquote><blockquote type="cite">Many things during the last years, but nothing very clear to me...<br></blockquote><blockquote type="cite">Any patch around for playing sample from start and loop at the end ?<br></blockquote><blockquote type="cite">Jm<br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite"><a href="mailto:Pd-list@iem.at">Pd-list@iem.at</a>&nbsp;mailing list<br></blockquote><blockquote type="cite">UNSUBSCRIBE and account-management -&gt;<br></blockquote><blockquote type="cite"><a href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a><br></blockquote><blockquote type="cite"><br></blockquote></span><br class="Apple-interchange-newline"></blockquote></div></body></html>