Importing Blender scenes into Godot
Blender often used for creating scenes and 3d models, and Godot is an engine for developing games. Naturally, these two programs can work side by side.
Packaging apps
Packaging apps is useful for running apps on multiple machines without worrying about versions.
Here is a short guide on packaging Python apps, in 20 steps. It first involves “freezing” it using PyInstaller, then bundling it into an AppImage using AppImageKit’s appimagetool.
Sampling rate
Music is recorded and typically stored (encoded) using pulse code modulation (PCM). These files can get large, and FLAC is a common format that uses lossless compression to compress raw PCM files.
A digital audio file can be encoded in b bits and at a sampling rate of r kHz1. For example a “24/96” file is shorthand for b = 24 and r = 96.
Generally the maximum frequency stored in a file is r/2 (half the sampling rate). Humans can listen up to 20 kHz so it can be argued that a sampling rate r > 40 has no effect on enjoyment of music. CDs have r = 44.1.
The bit depth b helps give it dynamic range - how soft and loud it can get.
If someone gives you a file and claims it to be sampled at 96 kHz but a spectrogram (using software such as Spek or Sonic Visualizer) shows the maximum frequency to cut off at less than 48 kHz, then you can assume that they weren’t honest! It is likely that they took a lower quality file and converted it to FLAC.
Most of what I understood comes from here.
Concat to PDF
I wrote a script a few months ago to scrape web novels. I extracted
them as plaintext and saved every chapter. Since some books had over a
hundred chapters, I wanted to concatenate them so it would be easier to
read. Concatenation can be done quickly using cat
and tools
like pandoc
can generate pretty PDFs.
Overriding exit to tmux detach
I was using mosh like this:
function mssh {
echo "> mosh --no-init $1 -- tmux new-session -A -s main"
mosh --no-init $1 -- tmux new-session -A -s main
}
But sometimes I would enter exit
instead of tmux detach
and I would lose the session I had on the remote!
So I found this code block that I inserted into my remote ~/.bashrc
that would help me. It’s simple to read, if the session is not tmux, we exit, but if it is, check if it is desirable to preserve the session.
# also see https://medium.com/@toja/tip-using-mosh-with-scrollback-257a54a848b3
exit() {
if [[ -z $TMUX ]]; then
builtin exit
return
fi
panes=$(tmux list-panes | wc -l)
wins=$(tmux list-windows | wc -l)
count=$(($panes + $wins - 1))
if [ $count -eq 1 ]; then
tmux detach
else
builtin exit
fi
}
Note, pressing (CTRL+D) will still exit the session, if you want.
tags: code
Resolving changes overwritten
So I got this error the other day when I ran git pull
:
“Your local changes to the following files would be overwritten by
merge:” because my package.json
file was outdated.
I always keep git update-index --assume-unchanged
for my
package.json
so it was frustrating that git is trying to
overwrite it. (I know I could edit the .gitignore, but there are other
developers on this project.)
Anyway, in my heart of hearts, I knew that keeping the new
package.json
is probably better, so this is what I did:
git update-index --no-assume-unchanged package.json package-lock.json
git checkout -b k-localchanges1
git add -v .
git commit -m "message" # I'm backing up my copy of package.json into my local branch
git checkout development
git pull
rm -rf node_modules/
npm install
npx expo -c
tags: code
Reaper and Linux
Are you brave enough to produce music on Linux?
To be honest, this is just a guide/notes for myself because I’m not the kind of person to instantly get it on the first try. I’ll be referencing this myself from time to time.
Does this work?
Here’s my first post. *uh oh*
I’m going to try and use this to write short posts and notes. Don’t expect any essays here.
tags: misc