<div dir="ltr">that'd be a dream come true :)</div><div class="gmail_extra"><br><div class="gmail_quote">2016-04-03 3:23 GMT-03:00 Dan Wilcox <span dir="ltr"><<a href="mailto:danomatika@gmail.com" target="_blank">danomatika@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Throwing something else out there: looking at d_soundfiler.c, it looks like it wouldn’t be that hard to add a second outlet that could send out the number of channels and samplerate of the loaded file. As far as I can tell, the number of channels is already read, so it involves reading the samplerate. This would allow for the calculation of the correct playback speed for samples irregardless of source & playback samplerates.<div><br></div><div>WAVE:</div><div><br></div><div>The samplerate is the 4 bytes after the number of channels in the WAVE fmt chunk. Ref: <a href="http://www.lightlink.com/tjweber/StripWav/Canon.html" target="_blank">http://www.lightlink.com/tjweber/StripWav/Canon.html</a><br><div><br></div><div>AIFF:</div><div><br></div><div>The samplerate is the last field in the COMM (Common) chunk. </div><div> <div>typedef struct {</div><br><div>     ID              ckID;</div><div>     long           ckSize;</div><div>     short          numChannels;</div><div>     unsigned long  numSampleFrames;</div><div>     short          sampleSize;</div><div>     extended   sampleRate;</div><br><div>}  CommonChunk;</div></div><div><br></div><div>Ref: <a href="http://www-mmsp.ece.mcgill.ca/documents/audioformats/aiff/Docs/AIFF-1.3.pdf" target="_blank">http://www-mmsp.ece.mcgill.ca/documents/audioformats/aiff/Docs/AIFF-1.3.pdf</a></div><div><br></div><div><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">--------<br>Dan Wilcox<br><a href="https://twitter.com/danomatika" target="_blank">@danomatika</a><br><a href="http://danomatika.com" target="_blank">danomatika.com</a><br><div><a href="http://robotcowboy.com" target="_blank">robotcowboy.com</a></div></div>

</div>
<br></div></div></div><br>_______________________________________________<br>
Pd-dev mailing list<br>
<a href="mailto:Pd-dev@lists.iem.at">Pd-dev@lists.iem.at</a><br>
<a href="http://lists.puredata.info/listinfo/pd-dev" rel="noreferrer" target="_blank">http://lists.puredata.info/listinfo/pd-dev</a><br>
<br></blockquote></div><br></div>