triapul.cz

3.5ema

March, March hare!


2024-04-24

headphones ad

openbsd freebsd mpd

mpd & ncmpc

mpd is a music player daemon. ncmpc is an interactive text interface for mpd. mpc is a utility for controling mpd via external commands. This is a guide for using the three locally. It's like a music streaming service that runs entirely in your computer with your own music files.

The configuration process is the same for both OpenBSD and FreeBSD, with the only difference being the audio_output block in mpd.conf. Make sure the music_directory exists and (preferably) contains some audio files.

On FreeBSD mpd and mpc ports are called musicpd and musicpc (if you're installing through pkg), but the binaries are still called mpd and mpc.

config

Create the following directory and populate it with files.

$ mkdir -p ~/.config/mpd/playlists
$ touch ~/.config/mpd/{db,log,pid,state,socket,sticker.sql}

Edit/create ~/.config/mpd/mpd.conf

OpenBSD

music_directory "~/music"
playlist_directory "~/.config/mpd/playlists"
db_file "~/.config/mpd/mpd.db"
log_file "~/.config/mpd/mpd.log"
pid_file "~/.config/mpd/mpd.pid"
state_file "~/.config/mpd/mpdstate"
sticker_file "~/.config/mpd/sticker.sql"

audio_output {
        type "sndio"
        name "sndio output"
        mixer_type "software"
}

FreeBSD

music_directory "~/music"
playlist_directory "~/.config/mpd/playlists"
db_file "~/.config/mpd/db"
log_file "~/.config/mpd/log"
pid_file "~/.config/mpd/pid"
state_file "~/.config/mpd/state"
sticker_file "~/.config/mpd/sticker.sql"

audio_output {
        type "oss"
        name "Default OSS device"
}

usage

I run mpd manually after logging in through xdm/xenodm. I have the following in ~/.xsession (~/.xinitrc, if you start X by hand).

...
mpd
mpc pause
...

mpc pause is there as a sanity check for when I boot up the computer at a funeral, a restaurant or the cabin of a public transport. If you violently shutdown your machine while a song is playing through mpd, it'll continue playing after you start it again.

Whenever you add music to music directory, run $ mpc update this rebuilds the database and the new songs will be searchable and appear in ncmpc.

ncmpc(pp)

ncmpc in xterm in fvwm3

It's a TUI front-end to mpd. It's light, it's easy to use. It's there so you don't have to make playlists with mpc. Some will tell you to get ncmpcpp instead, because it's more colorful and can display ascii visualisations. I'd say get over aesthetics and use the lighter software, but you do you.

mpc

Some basic commands to give you an idea. All of these can also be toggled in ncmpc.

$ mpc update # run after adding files to music dir
$ mpc next # play next song in playlist
$ mpc single # play one song and stop
$ mpc consume # remove a song from playlist after playing it

tips:

cwm keybindings

edit ~/.cwmrc:

bind-key XF86AudioPlay mpc toggle
bind-key XF86AudioNext mpc next
bind-key XF86AudioPrev mpc prev

find and play a song from your library through dmenu

#!/bin/ksh
query=$(mpc listall | dmenu -l 24 -i)
if [[ $(mpc) != *paused* || $(mpc) != *playing* ]]; then
mpc play; fi
if [[ $query != "" ]]; then
mpc insert "$query"; mpc next
fi

rip audio from a youtube video, convert it to mp3

$ yt-dlp --audio-format mp3 -x 'youtube-url'

Cool.


2024-04-24

uytppe.jpg

claudecahun monochrome

1713977579


2024-04-24

kgvetm.png

gopher unix_surrealism

1713953007


2024-04-24

napjnp.jpg

evagonzales

1713910675


2024-04-23

xurggf.jpg

qrstuv softdrink

1713854300


2024-04-23

cevqyi.jpg

bstuf tobacco monochrome

1713854224


2024-04-22

xwkvgv.gif

gif sl computer

1713784038


2024-04-21

rhibdq.jpg

permacomputing penitum ozzelot

1713695775


2024-04-21

closeup of X250 with an OpenBSD 2.8 sticker covering up a crack in the bezel

occ openbsd permacomputing

OLD COMPUTER RESCUE - X250

Newer is not better

Wisps circle around a battlefield, where many men and machine lay slain. Small creatures with long snouts, dressed in leather robes and diving goggles, sift through a thick muck of mixed red and blue body fluids, looking for functional organs.

It's fine, but...

If you've grown accustomed to the heavy old, moving to the elegant can be rather painful, especially if you value features which are now considered obsolete, because corporate software dictates what hardware should look like. Whenever a new machine passes through my hands, I like to note down its compatibility with OpenBSD, and offer my highly biased review from the point of view of a machine asketic. Before you continue, know that I think this machine is fine, works well with OpenBSD (once the issues are resolved), but it won't feel like an upgrade to someone who's existed with some of the last Lenovo IBM-esque models.

The first noticable thing is the lack of LED's on the screen. Things like 'wireless signal' 'caps lock' 'hdd activity' etc. Not a big deal, if you're using a desktop environment with some type of a system bar with beautiful icons for whatever [reason]. I don't and not knowing what the wi-fi is doing is annoying. Admittedly, that's really the only LED I'm missing. One redeeming thing is that the 'moon' LED moved to the 'i' in the thinkpad logo. So you can still at least tell if the computer is suspended or dead. But since it pulsates, if your timing is wrong, you have to stare at the light for a while, wondering if it's going to light up or not. This can be a fun party activity.

As opposed to older models, like the X201, it is not quick nor efficient to swap hard drives. One has to remove the entire bottom cover of the machine and then unscrew the caddy in which the HDD sits. The dock for these newer models no longer has the option to put in another HDD. The machine does have an SD card slot. While I have not tested it here, previous models could boot from it, so it might be viable to use it as a secondary drive for something ominous.

The CPU in this model can be throttled down to 500Mhz, which is fairly efficient even with the beat up battery it came with. The following can do about 3.5 hours of usage:

hw.sensors.acpibat1.watthour0=27.13 Wh (last full capacity)
hw.sensors.acpibat1.watthour4=47.52 Wh (design capacity)

The piano

The keyboard has been so far the most idiotic thing in this machine. I don't know if this is true for all X250's, or just the Czech market, but you can tell very quickly it was not designed for the terminal dwellers.

x250 keyboard

I don't know why instead of the menu key, or even the flag key, there is print screen between AltGr and Ctrl instead. But that is not the most bizarre feature. The insert key is hidden on the end key, requiring Fn to be pressed. This turns pasting into a terminal with Shift+Insert to a gymnastic trick. The most insulting is the fact that the delete key is the size of two keys, so insert could easily be there. There's no scroll lock, because apparently modern computer manufactures don't know what it's for. Standards be damned.

There is no thinklight on the top of the screen or backlight behind the keyboard.

OpenBSD 7.5

The fish installs fine and can boot through UEFI. The particular model I have came with a Realtek wi-fi card, which is not supported. I swapped it for an Intel one (7265) from a dead Dell. It works fine.

sound issues

Sound does not work out of the box. Playing a video or an audio file results in a very choppy output. The solution is to add the following flag to sndiod (the default is play,rec):

 # rcctl set sndiod flags "-m play"

The next sound issue was heavy static when headphones are connected. This was solved by:

# mixerctl inputs.mix2_source=dac-0:1

the end

If you don't mind the elegant bezel and want a fairly powerful machine, this model will run BSD. If you have one, great! Make use of it. If you find one very cheap, great, get it. And remember, it's not the machine's fault that you don't like it.

pros

cons


2024-04-20

htrjuz.png

meta deadnet

1713645074


2024-04-20

ipffnp.gif

no_context

1713625419


2024-04-20

openbsd typewriter

nogui openbsd freebsd mpv

No GUI | mpv

no xorg, no wayland, no friends

The following is tested on OpenBSD and FreeBSD without an X server, neither of which use the linuxian /dev/fb device to display graphical output in the terminal.

mpv in tty

basics

play only audio

$ mpv --no-video file

render video in ascii (straight inside the console)

$ mpv --vo=tct "video file"

Using sdl/drm drivers

The following will play the video file and occupy the entire screen. It's not possible to switch to another tty while mpv is running. Display available drivers for your system by running $ mpv --vo=help and adapt the following appropriately.

$ mpv --vo=sdl "video file"
$ mpv --vo=drm "video file"

display image (on loop, otherwise it will automatically close after a few seconds) and close it with 'q'

$ mpv --vo=sdl --loop "image file"

streaming online content

The following requires you to have yt-dlp installed. In most cases, it comes packaged with mpv already. Use the appropriate video driver for your system (--vo). You don't need to do so, if you're running this under xorg. This will work for things like youtube or twitch. Consult yt-dlp documentation for more options.

Stream a video in the highest available quality

$ mpv --vo=sdl "url"

Stream a video in the worst available quality

$ mpv --vo=sdl --ytdl-format="w" "url"

Stream a video in the closest available quality to 420p, but not higher. You can change the number to whatever you want.

$ mpv --vo=sdl --ytdl-format="bestvideo[height<=?420]+bestaudio[height<=?420]" "url"

Stream just audio from a url

$ mpv --no-video "url"

Stream a video file on a gopher server

$ mpv --vo=sdl "gopher url"

Stream a video in lowest quality from a url and render it in ascii

$ mpv --vo=tct --ytdl-format="w" "url"

2024-04-19

zkazig.JPG

surrovapraha

1713562593


2024-04-15

brouk.png

csrsurrealismus

Bohuslav Brouk

Český Sigmund Freud

Choditi s koulí na noze je sotva vtipný nápad

Sport - stoupa života

brouk na kafi s pani