Posts

Showing posts from 2024

Offline use of Visual Studio Code

For the past few years, I've been doing most of my coding in "the Scientific Python Stack (NumPy, SciPy, Matplotlib, ...) , and friends. I still use MATLAB and Mathematica where there are gaps in functionality or the numerics in NumPy/SciPy are not up to snuff.  I used to use Spyder, the IDE included with Anaconda Python, but over the last couple of years have switched to Visual Studio Code for both an IDE and Jupyter notebooks. I'm not alone; VSCode has dominated the  Stack Overflow IDE Survey  for several years. One of the main features of VSCode is the rich ecosystem of extensions. When you're online, installing or updating an extension is a couple of mouse clicks; the procedure for offline use isn't so refined and has changed over time.  If you're starting fresh, VSCode supports a "Portable Mode", documented here: https://code.visualstudio.com/docs/editor/portable "This mode enables all data created and maintained by VS Code to live near itse...

Python Asyncio

Each time I need to write a multithreaded program in Python, I read through the Asyncio page in the Python docs, and give up and code with the threading library. This time I found a pretty good five-part tutorial written by someone at the BBC, so I'm bookmarking it here. https://bbc.github.io/cloudfit-public-docs/asyncio/asyncio-part-1.html https://bbc.github.io/cloudfit-public-docs/asyncio/asyncio-part-2 https://bbc.github.io/cloudfit-public-docs/asyncio/asyncio-part-3 https://bbc.github.io/cloudfit-public-docs/asyncio/asyncio-part-4 https://bbc.github.io/cloudfit-public-docs/asyncio/asyncio-part-5 Of course, this leaves the question of why exactly one should use Asyncio instead of threads https://discuss.python.org/t/what-are-the-advantages-of-asyncio-over-threads/2112 The official, and largely opaque (to me anyway) Asyncio docs https://docs.python.org/3/library/asyncio.html The threading docs and a useful tutorial on condition variables https://docs.python.org/3/library/threadin...

New BBC Radio 3 streams

TL;DR --  Plug  http://lstn.lv/bbc.m3u8?station=bbc_radio_three&bitrate=320000  into the streaming player of your choice.  Be happy! For audio streaming, I use Volumio running on a RaspberryPi 4 with a HiFiBerry DAC . Set up was simple and there's a smart phone ap for remote control.  The reminder of my set up is a Dayton Audio DTA-1 "T Amp" , driving a pair of Wharfedale Diamond 5 loudspeakers (designed by my friend and coauthor, Richard Lee).  Great sound for about $250.  I use Volumio's DSP plug in to add a couple of dB of bass below 80 Hz, and 2.5 dB of treble above 4 kHz. This setup worked well with the BBC's legacy 128 kbit/sec MP3 Shoutcast streams, but the BBC shut them down about a year ago.  A couple of months before the MP3 streams ended, I found a GitHub "gist" with the URLs of their new MPEG-4 DASH streams [1].  For listeners outside the UK, the highest bit rate available was 96 kbit/sec. With MPEG-4 Advanced Audio Coding (A...