<html><head>


<style type="text/css"><!--#xa48a2c786bd2455 p.MsoNormal
{margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;}
#xa48a2c786bd2455 div.WordSection1
{page: WordSection1;}
--></style><style id="css_styles" type="text/css"><!--blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc }
blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; }
a img { border: 0px; }
table { border-collapse: collapse; }
li[style='text-align: center;'], li[style='text-align: center; '], li[style='text-align: right;'], li[style='text-align: right; '] {  list-style-position: inside;}
body { font-family: Helvetica; font-size: 9pt; }
.quote { margin-left: 1em; margin-right: 1em; border-left: 5px #ebebeb solid; padding-left: 0.3em; }
--></style>
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>I agree playing audio was difficult to navigate when I first tried it. I’m a relative outsider to this group and have no sway over things like documentation, but for anyone interested in doing their own legwork on this topic: here’s some code I used to help manage audio:</div><div><br /></div><div>The audio player itself:</div><div><a href="https://github.com/mickleness/pumpernickel/blob/master/src/main/java/com/pump/audio/AudioPlayer.java">https://github.com/mickleness/pumpernickel/blob/master/src/main/java/com/pump/audio/AudioPlayer.java</a></div><div><br /></div><div>A Swing component to help manage it:</div><div><a href="https://github.com/mickleness/pumpernickel/blob/master/src/main/java/com/pump/swing/AudioPlayerComponent.java">https://github.com/mickleness/pumpernickel/blob/master/src/main/java/com/pump/swing/AudioPlayerComponent.java</a></div>
<div style="clear:both"><br /></div><div style="clear:both">A jar that executes it:</div><div style="clear:both"><a href="https://github.com/mickleness/pumpernickel/tree/master/release/jars">https://github.com/mickleness/pumpernickel/tree/master/release/jars</a></div><div style="clear:both"><br /></div><div style="clear:both">A video of the Swing code in action that demos a couple different UIs:</div><div style="clear:both"><a href="https://screenpal.com/watch/cZVVYZVHymx">https://screenpal.com/watch/cZVVYZVHymx</a></div><div style="clear:both"><br /></div><div style="clear:both"> - Jeremy</div>
<div><br /></div>
<div>
<div>------ Original Message ------</div>
<div>From <a href="mailto:mark.yagnatinsky@barclays.com">mark.yagnatinsky@barclays.com</a></div>
<div>To <a href="mailto:swinxythecat@gmail.com">swinxythecat@gmail.com</a></div>
<div>Cc <a href="mailto:client-libs-dev@openjdk.org">client-libs-dev@openjdk.org</a></div>
<div>Date 12/31/23, 2:43:09 PM</div>
<div>Subject RE: the easiest ways to play an audio clip are the discouraged ones</div></div><div><br /></div>
<div id="xa48a2c786bd2455" style="word-wrap:break-word"><blockquote cite="MN2PR12MB36168351D36CF6AE14916061F963A@MN2PR12MB3616.namprd12.prod.outlook.com" type="cite" class="cite2">

<div class="WordSection1">
<p class="MsoNormal">Resending; last one got blocked due to message size so trimming previous conversation<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal"><o:p xmlns:o="#unknown"> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Yagnatinsky, Mark : Markets Pre Trade <br />
<b>Sent:</b> Tuesday, December 26, 2023 12:18 AM<br />
<b>To:</b> 'SWinxy' <<a href="mailto:swinxythecat@gmail.com">swinxythecat@gmail.com</a>><br />
<b>Cc:</b> <a href="mailto:client-libs-dev@openjdk.org">client-libs-dev@openjdk.org</a><br />
<b>Subject:</b> RE: the easiest ways to play an audio clip are the discouraged ones<o:p xmlns:o="#unknown"></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p xmlns:o="#unknown"> </o:p></p>
<p class="MsoNormal">Thanks for responding.  And thanks for the history page!!<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">The sad thing is that the issue is not just a documentation issue.<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">It really does takes around five dozen of lines of code to do accomplish the following task:<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">“play a sound file on my disk without leaking any resources”<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">(Or at least, I haven’t found a way to do it in much less than five dozen lines.)<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal"><o:p xmlns:o="#unknown"> </o:p></p>
<p class="MsoNormal">AudioAction is also “intern-ish”: it seems designed to be called from look & feel code.<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal"><o:p xmlns:o="#unknown"> </o:p></p>
<p class="MsoNormal">As for the tutorials: I realize they are barely maintained and I wish they still were.<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">But I see they still get occasional updates.  Maybe this one could be improved.<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">I suspect the sound tutorial has had no big updates since 1998, though the history page you linked claims 2006 for Java 6… (but where’s getClip() then?)<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal"><o:p xmlns:o="#unknown"> </o:p></p>
<p class="MsoNormal">But lack of good docs is merely the second-biggest problem.<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">The biggest is that the API provides no easy way to accomplish what should be a trivial task.<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">Ideally the following lines of code should Just Work:<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">javax.sound.Player.playAsync(url); // fire and forget; leaks nothing<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">javax.sound.Player.playAndWait(url); // returns once playback is done, leaks nothing.<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">I shouldn’t have to know about ULAW vs ALAW vs PCM.<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">I shouldn’t even have to know about sampled vs midi.<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">(For nontrivial things, obviously those are very different; but not for something this simple.)<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">I shouldn’t have to implement line listeners and create a countdown latch.<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">It really shouldn’t be this hard!<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">The current difficulty level is high enough that people will ask themselves:<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">“do I really need add sound support?  Maybe I can live without it?”<o:p xmlns:o="#unknown"></o:p></p>
<p class="MsoNormal">It should be easy enough that you can do it on a whim!<o:p xmlns:o="#unknown"></o:p></p>
</div>

<p><span lang="EN-US" style="mso-ansi-language: EN-US">This message is for 
information purposes only. It is not a recommendation, advice, offer or 
solicitation to buy or sell a product or service, nor an official confirmation 
of any transaction. It is directed at persons who are professionals and is 
intended for the recipient(s) only. It is not directed at retail customers. This 
message is subject to the terms at: 
<a href="https://www.cib.barclays/disclosures/web-and-email-disclaimer.html">https://www.cib.barclays/disclosures/web-and-email-disclaimer.html</a>. 
</span></p>
<p><span lang="EN-US" style="mso-ansi-language: EN-US">For important disclosures, 
please see: 
<a href="https://www.cib.barclays/disclosures/sales-and-trading-disclaimer.html">https://www.cib.barclays/disclosures/sales-and-trading-disclaimer.html</a> 
regarding marketing commentary from Barclays Sales and/or Trading desks, who are 
active market participants; 
<a href="https://www.cib.barclays/disclosures/barclays-global-markets-disclosures.html">https://www.cib.barclays/disclosures/barclays-global-markets-disclosures.html</a> 
regarding our standard terms for Barclays Corporate and Investment Bank where we 
trade with you in principal-to-principal wholesale markets transactions; and in 
respect to Barclays Research, including disclosures relating to specific 
issuers, see: 
<a href="http://publicresearch.barclays.com">http://publicresearch.barclays.com</a>.<br />__________________________________________________________________________________ 
<br />If you are incorporated or operating in Australia, read these important 
disclosures: 
<a href="https://www.cib.barclays/disclosures/important-disclosures-asia-pacific.html">https://www.cib.barclays/disclosures/important-disclosures-asia-pacific.html</a>.<br />__________________________________________________________________________________<br />For 
more details about how we use personal information, see our privacy notice: 
<a href="https://www.cib.barclays/disclosures/personal-information-use.html">https://www.cib.barclays/disclosures/personal-information-use.html</a>. 
<br />__________________________________________________________________________________<br /></span></p>
</blockquote></div>


</body></html>