<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>2718.us blog &#187; 16-bit signed little-endian pcm</title>
	<atom:link href="http://2718.us/blog/tag/16-bit-signed-little-endian-pcm/feed/" rel="self" type="application/rss+xml" />
	<link>http://2718.us/blog</link>
	<description>Miscellaneous Technological Geekery</description>
	<lastBuildDate>Tue, 18 May 2010 02:42:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Converting to Asterisk-Native SLN Audio with ffmpeg</title>
		<link>http://2718.us/blog/2008/07/21/converting-to-asterisk-native-sln-audio-with-ffmpeg/</link>
		<comments>http://2718.us/blog/2008/07/21/converting-to-asterisk-native-sln-audio-with-ffmpeg/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 13:31:00 +0000</pubDate>
		<dc:creator>2718.us</dc:creator>
				<category><![CDATA[Telephony]]></category>
		<category><![CDATA[16-bit pcm]]></category>
		<category><![CDATA[16-bit signed little-endian pcm]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[asterisk native]]></category>
		<category><![CDATA[asterisk sounds]]></category>
		<category><![CDATA[audacity]]></category>
		<category><![CDATA[big endian]]></category>
		<category><![CDATA[endianness]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[little endian]]></category>
		<category><![CDATA[moh]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[music on hold]]></category>
		<category><![CDATA[pcm]]></category>
		<category><![CDATA[pcm_s16le]]></category>
		<category><![CDATA[s16le]]></category>
		<category><![CDATA[signed linear]]></category>
		<category><![CDATA[sln]]></category>
		<category><![CDATA[sox]]></category>
		<category><![CDATA[wav]]></category>

		<guid isPermaLink="false">http://2718.us/blog/?p=62</guid>
		<description><![CDATA[I have spent a large chunk of the past two weekends trying to find some kind of instructions as to how to get audio into the native Asterisk &#8220;SLN&#8221; format.  Specifically, I wanted to convert some mp3s of classical music (such as from Musopen) to SLN for music-on-hold.  I was able to discern that SLN [...]]]></description>
			<content:encoded><![CDATA[<p>I have spent a large chunk of the past two weekends trying to find some kind of instructions as to how to get audio into the native Asterisk &#8220;SLN&#8221; format.  Specifically, I wanted to convert some mp3s of classical music (such as from <a href="http://www.musopen.com/">Musopen</a>) to SLN for music-on-hold.  I was able to discern that SLN files are &#8220;raw&#8221; or headerless &#8220;wav&#8221; format, 16-bit signed PCM or signed linear (hence SLN).  After several attempts to convert mp3s, wavs, and other things to this format, only to have them play as painfully loud static, I tried reversing the process and importing some working sample SLN files in Audacity.  This led to the big ah-ha! moment of the weekend—the Asterisk SLN files are 16-bit <strong>little-endian</strong> signed PCM, whereas SoX, Audacity, et al, were putting out big-endian 16-bit signed PCM.  I couldn&#8217;t for the life of me find an option to change the endiannes in Audacity, however.</p>
<p>In searching some more, I found that <a href="http://ffmpeg.mplayerhq.hu/">ffmpeg</a>, one of the best swiss-army-knife-type audio/video conversion programs, specifically supports signed 16-bit little-endian PCM.  Here&#8217;s the command to convert just about any audio (anything ffmpeg can handle) to the appropriate format for Asterisk music-on-hold:</p>
<pre lang="bash">ffmpeg -i "[input file]" -ar 8000 -ac 1 -acodec pcm_s16le -f s16le "[output file].sln"</pre>
<p>You may also want to add a volume modifier, to make the music appropriately quiet for music-on-hold, and ffmpeg allows this to be specified in dB gain like &#8220;-vol -15dB&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://2718.us/blog/2008/07/21/converting-to-asterisk-native-sln-audio-with-ffmpeg/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

