diff --git a/content/2014/03/python-ctypes-wrapper-for-flac.html b/content/2014/03/python-ctypes-wrapper-for-flac.html new file mode 100644 index 0000000..f745edd --- /dev/null +++ b/content/2014/03/python-ctypes-wrapper-for-flac.html @@ -0,0 +1,36 @@ +--- +title: Python ctypes wrapper for FLAC +description: > + Python ctypes wrapper for FLAC +created: !!timestamp '2014-03-15' +tags: + - Python + - FLAC + - audio +--- + +As many people know, I've a fan of Python and I have been using it for +over 15 years now. + +One of the recent improvements that Python has made is the inclusion of +ctypes, which allows you to write a wrapper around shared libraries in +Python making it much easier to integrate libraries. Previously you'd +have to know the C Python API to get a module. There was SWIG, but if +the library was complicated, it'd often not produce working code and even +if it did, you'd have to hand tweak the output to get it to work the way +you think it should. + +One of the projects I've worked on is a UPnP media server. One of the +features it has is the ability to decode a flac file and support seeking +with in the file. + +I have now released a package of the code: +[ctflac-1.0.tar.gz](https://www.funkthat.com/~jmg/releases/ctflac-1.0.tar.gz). + +The one issue w/ ctypes is that some code can be very slow in Python. +The FLAC library presents the sample data as arrays for each channel, +though most libraries interleave the channel data. I have written a very +small library (that is optional) interleave.c that does this interleaving +in faster C code. In my tests, using the C code results in about a third of the CPU usage. + +Hope this is useful for others! diff --git a/content/2014/10/meta.yaml b/content/2014/meta.yaml similarity index 100% rename from content/2014/10/meta.yaml rename to content/2014/meta.yaml diff --git a/content/media/css/custom.css b/content/media/css/custom.css new file mode 100644 index 0000000..f26ed17 --- /dev/null +++ b/content/media/css/custom.css @@ -0,0 +1,9 @@ +ul.tags { + list-style-type: none; +} + +ul.tags li { + padding-left: .5em; + padding-right: .5em; + display: inline-block; +} diff --git a/content/media/css/tufte.css b/content/media/css/tufte.css index 976bbd9..1594981 100644 --- a/content/media/css/tufte.css +++ b/content/media/css/tufte.css @@ -45,7 +45,7 @@ html { } body { - width: 87.5%; + width: 83.5%; margin-left: auto; margin-right: auto; padding-left: 12.5%; @@ -114,6 +114,7 @@ article { } section { + padding-right: 5%; padding-top: 1rem; padding-bottom: 1rem; } @@ -343,7 +344,7 @@ h3 > code { pre > code { font-size: 0.9rem; - width: 52.5%; + width: 77.5%; margin-left: 2.5%; overflow-x: auto; display: block; diff --git a/layout/article.j2 b/layout/article.j2 deleted file mode 100644 index 8f114a5..0000000 --- a/layout/article.j2 +++ /dev/null @@ -1,28 +0,0 @@ -
- -

{{ res.meta.title }}

- -

Posted: {{ res.meta.created.strftime('%B %e, %Y') }}

- -{% if res.meta.tags %} - -{% endif %} -
-{% refer to res.relative_path as post %} -{{ post.post|markdown|typogrify }} -{# -{% filter markdown|typogrify -%} -{% mark post -%} -{% block post -%}{%- endblock %} -{%- endmark %} -{%- endfilter %} -#} -
diff --git a/layout/base.j2 b/layout/base.j2 index a42b29c..cf1f2e2 100644 --- a/layout/base.j2 +++ b/layout/base.j2 @@ -47,6 +47,7 @@ {% block css %} + {% endblock css %} {% block endhead %}{% endblock endhead %} @@ -67,7 +68,7 @@