Andrew Cooke | Contents | Latest | RSS | Previous | Next

C[omp]ute

Welcome to my blog, which was once a mailing list of the same name and is still generated by mail. Please reply via the "comment" links.

Always interested in offers/projects/new ideas. Eclectic experience in fields like: numerical computing; Python web; Java enterprise; functional languages; GPGPU; SQL databases; etc. Based in Santiago, Chile; telecommute worldwide. CV; email.

Personal Projects

Choochoo Training Diary

Last 100 entries

Surprise Paradox; [Books] Good Author List; [Computing] Efficient queries with grouping in Postgres; [Computing] Automatic Wake (Linux); [Computing] AWS CDK Aspects in Go; [Bike] Adidas Gravel Shoes; [Computing, Horror] Biological Chips; [Books] Weird Lit Recs; [Covid] Extended SIR Models; [Art] York-based Printmaker; [Physics] Quantum Transitions are not Instantaneous; [Computing] AI and Drum Machines; [Computing] Probabilities, Stopping Times, Martingales; bpftrace Intro Article; [Computing] Starlab Systems - Linux Laptops; [Computing] Extended Berkeley Packet Filter; [Green] Mainspring Linear Generator; Better Approach; Rummikub Solver; Chilean Poetry; Felicitations - Empowerment Grant; [Bike] Fixing Spyre Brakes (That Need Constant Adjustment); [Computing, Music] Raspberry Pi Media (Audio) Streamer; [Computing] Amazing Hack To Embed DSL In Python; [Bike] Ruta Del Condor (El Alfalfal); [Bike] Estimating Power On Climbs; [Computing] Applying Azure B2C Authentication To Function Apps; [Bike] Gearing On The Back Of An Envelope; [Computing] Okular and Postscript in OpenSuse; There's a fix!; [Computing] Fail2Ban on OpenSuse Leap 15.3 (NFTables); [Cycling, Computing] Power Calculation and Brakes; [Hardware, Computing] Amazing Pockit Computer; Bullying; How I Am - 3 Years Post Accident, 8+ Years With MS; [USA Politics] In America's Uncivil War Republicans Are The Aggressors; [Programming] Selenium and Python; Better Walking Data; [Bike] How Fast Before Walking More Efficient Than Cycling?; [COVID] Coronavirus And Cycling; [Programming] Docker on OpenSuse; Cadence v Speed; [Bike] Gearing For Real Cyclists; [Programming] React plotting - visx; [Programming] React Leaflet; AliExpress Independent Sellers; Applebaum - Twilight of Democracy; [Politics] Back + US Elections; [Programming,Exercise] Simple Timer Script; [News] 2019: The year revolt went global; [Politics] The world's most-surveilled cities; [Bike] Hope Freehub; [Restaurant] Mama Chau's (Chinese, Providencia); [Politics] Brexit Podcast; [Diary] Pneumonia; [Politics] Britain's Reichstag Fire moment; install cairo; [Programming] GCC Sanitizer Flags; [GPU, Programming] Per-Thread Program Counters; My Bike Accident - Looking Back One Year; [Python] Geographic heights are incredibly easy!; [Cooking] Cookie Recipe; Efficient, Simple, Directed Maximisation of Noisy Function; And for argparse; Bash Completion in Python; [Computing] Configuring Github Jekyll Locally; [Maths, Link] The Napkin Project; You can Masquerade in Firewalld; [Bike] Servicing Budget (Spring) Forks; [Crypto] CIA Internet Comms Failure; [Python] Cute Rate Limiting API; [Causality] Judea Pearl Lecture; [Security, Computing] Chinese Hardware Hack Of Supermicro Boards; SQLAlchemy Joined Table Inheritance and Delete Cascade; [Translation] The Club; [Computing] Super Potato Bruh; [Computing] Extending Jupyter; Further HRM Details; [Computing, Bike] Activities in ch2; [Books, Link] Modern Japanese Lit; What ended up there; [Link, Book] Logic Book; Update - Garmin Express / Connect; Garmin Forerunner 35 v 230; [Link, Politics, Internet] Government Trolls; [Link, Politics] Why identity politics benefits the right more than the left; SSH Forwarding; A Specification For Repeating Events; A Fight for the Soul of Science; [Science, Book, Link] Lost In Math; OpenSuse Leap 15 Network Fixes; Update; [Book] Galileo's Middle Finger; [Bike] Chinese Carbon Rims; [Bike] Servicing Shimano XT Front Hub HB-M8010; [Bike] Aliexpress Cycling Tops; [Computing] Change to ssh handling of multiple identities?; [Bike] Endura Hummvee Lite II; [Computing] Marble Based Logic; [Link, Politics] Sanity Check For Nuclear Launch; [Link, Science] Entropy and Life

© 2006-2017 Andrew Cooke (site) / post authors (content).

Getting Jack Working

From: "andrew cooke" <andrew@...>

Date: Sat, 23 Jun 2007 18:06:20 -0400 (CLT)

Jack (Linux Audio) promises to be the solution to getting streaming audio
working from any source.  These are notes on my attempts to get it
working.

- To start Jack use qjackctl.  This is a KDE GUI app.  It will start and
stop jack for you (the start and stop buttons).  When Jack doesn't start,
click the Message button to see why.

- My first error was about a missing libportaudio18.  While it was
present, it turned out I had the 32 bit library installed (with 64 bit
Jack).  The SUSE dependencies didn't pick this up - you need to look very
carefully at the installed version (click on the tabs bottom right in
YAST).

- Next error was about /dev/shm/jack-0 already existing.  This seems to be
a permissions thing related to running as root.  So don't run as root.

- Next error was a problem with access rights to /dev/shm (btw /dev/shm
seems to be some kind of dynamic memory thing - don't mess with it, it's
started automatically by SUSE.  If you delete the shm directory the best
way to get it back is reboot; mkdir doesn't seem to do the right thing). 
I fixed that with chmod 666 /dev/shm/jack-shm-registry (as root)

- Next error indicated that realtime play wasn't possible.  You can
disable this in qjackctl's "setup" menu.  However, jack.play seemed to
want to set it (I was using jack.play to test if anything was working). 
Fix here is to add the following lines to /etc/security/limits.conf:
@audio          -       rtprio          90
@audio          -       nice            -10
@audio          -       memlock         4000000
and then add the user to that group (YAST group management - select the
audio tickbox).  Finally log out and in again (type "groups" on the
command line to check you are a member of the audio group).

- Oh, and earlier I had disabled ARTS (the KDE sound thing) by clicking in
the appropriate checkbox of the KDE "Configure Desktop" GUI.  I did this
because the qjackctl message box was scrolling lots of ARTS related
messages.  I also restarted alsa with /etc/init.d/alsasound restart (Jack
uses ALSA to talk to hardware).

- So with those fixes jack.play works (it gives a misleading error on ogg
files, saying they are corrupted, but works fine with flac).  However
there was no sound.  Clicking on the "Connect" button of qjackctl you can
drag the jack.play thing on the left to the soundcard thing on the right. 
This connects them and you hear something!

- To add volume control, start jackmix, delete the connections you made
earlier, and instead connect jack.play to the mixer input.  Then connect
the mixer output to the sound card.  Finally twiddle knobs on the mixer
until you hear something.

That gets basic files to play.  That's it so far.  Amarok crashes.

Andrew

Amarok with Jack

From: "andrew cooke" <andrew@...>

Date: Sat, 23 Jun 2007 18:44:03 -0400 (CLT)

- Install libxine-jack

- Start ARTS if you killed it earlier.  Without it, Amarok won't start,
and it doesn't seem to cause any harm (well, at various points I restarted
ALSA and Jack as well...)

- In the Amarok config select the jack output plugin (from the xine engine
settings).

- That's it.  Amarok automatically makes the connection to the output card.

Andrew

Alsa, but no Flash, Jack

From: "andrew cooke" <andrew@...>

Date: Sat, 23 Jun 2007 21:45:53 -0400 (CLT)

To get Alsa to connect to Jack put the following in ~/.asoundrc:

# convert alsa API over jack API
# use it with
# % aplay foo.wav

# use this as default
pcm.!default {
    type plug
    slave { pcm "jack" }
}

# pcm type jack
pcm.jack {
    type jack
    playback_ports {
        0 alsa_pcm:playback_1
        1 alsa_pcm:playback_2
        }
    capture_ports {
        0 alsa_pcm:capture_1
        1 alsa_pcm:capture_2
        }
}

I was expecting flash (the browser plugin) would work with Jack too (it
uses Alsa), but it doesn't.  The reason is (I think) a 32/64 bit conflict.
 I'd forgotten but I'm running 32 bit Firefox so that the multimedia works
OK.  It's possible to change to 64 bit, but you still need to run flash in
a wrapper as 32bit.

One solution would be to move Jack to 32 bit.  But that means either
breaking dependencies or reinstalling nearly everything (ie KDE) as 32
bit.

So no streaming of Pandora.

No streaming of anything yet, of course.  Next I need to look at getting
airport working (well, after I've reinstalled Firefox to get back to 32
bit...

Andrew

Jack to Airport

From: "andrew cooke" <andrew@...>

Date: Sun, 24 Jun 2007 19:23:51 -0400 (CLT)

Assuming that you have JustePort compiled correctly, and the Airpoert
Express configured, you can then connect Jack to the Airport using
ecasound.

- Install ecasound from YAST (assuming SUSE)
- Change the Jack sampling to 44100Hz
- Use the following command on the command line:
    ecasound -i jack -o stdout | mono JustePort.exe - 10.2.0.3 0
- In qjackctl, connect xine (for example, from Amarok) to ecasound

That's it.  Music comes out of speakers.

Andrew

Streaming Audio and Jack

From: "andrew cooke" <andrew@...>

Date: Mon, 25 Jun 2007 08:55:14 -0400 (CLT)

Unfortunately the streaming with Airport isn't that great.  There are
occasional jumps and about every 15mins the connection goes down, meaning
I need to restart and reconnect the ecasound process.  I think the problem
is that (1) it's not trivial to drive an external DAC which is using a
separate clock (I assume) to my server and (2) the JustePort software is
more a demo of the crypto crack than an attempt at making a reliable, good
sounding audio streamer.

That's frustrating.  But one possible solution to my particular
circumstances is to switch to headphones and use internet streaming.  With
Jack this turns out to be pretty trivial.  I needed to install and
configure icecast (which I've done before - it's trivial) and then add
oddcast.

I use the following config file with oddcast:
Server=localhost
Port=9000
ServerPassword=i changed this of course
ServerMountpoint=/stream.ogg
ServerPublic=1
AutomaticReconnectSecs=10
Encode=OggVorbis
BitrateNominal=128
NumberChannels=2
OggQuality=5
Samplerate=44100
ServerType=Icecast2
ExternalFile=/tmp/song
#YP Settings
ServerStreamURL=http://acooke.dyndns.org
ServerName=Andrew's music
ServerDescription=Music for Andrew
ServerGenre=Any
#Advanced Settings
LogLevel=1
LogFile=oddcastv3.log
SaveAsWAV=0
OutputControl=SERVER,GENERAL,OUTPUT

Then it's just a case of starting as:
> oddcastv3 -c oddcast.cfg JackMix:out_1 JackMix:out_2
(I am using jackmix for volume control - it also provides a nice
"connection point" so each source and destination can connect/start/stop
as required).

The only gotcha in all this was that the mount point has to be /stream.ogg
and not /stream (mplayer and xmms seem to get confused otherwise).

So, in case you're not seeing the wood for the trees, this lets you use a
player like Amarok as the source for streaming radio (instead of having to
use ices or whatever).

Andrew

jjjuste V 1.0 Released

From: "andrew cooke" <andrew@...>

Date: Wed, 11 Jul 2007 21:20:48 -0400 (CLT)

I just released an Airport Express client for Jack:
http://www.acooke.org/jara/jjjuste/

Andrew

Comment on this post