Music and mood

I always listen to music, but most of the time I don’t really care or pay attention. I tend to use quite random playlist and mostly let them run. Or at least, this what I thought until I recently checked.

What I discovered surprised me. Most people say their mood will be influenced by the music they listen to. This is explained in detail (and in French) by someone smarter and way more knowledgeable in music (which is easy considering my quasi-null level)

In my case, I tend to influence my playlist based on my mood. The fun thing is that I do that unconsciously and that it seems to correlate sometime surprisingly.

Let’s dig:

Renaud can be good (Molly Malone) or bad (p’tite conne in a loop is a fairly good indicator of depression).  Brel, Moustaki, Ferrat is mostly always bad: not for the singer himself but rather for the memories of a lost one they evoke. Funnily enough, Jean Yanne, which is from the same environment, is not triggered by the same feeling.

On the contrary, classical music, opera and even requiem are an indicator of good mood. I especially like listening to symphonies, Fauré or Mozart requiems as it helps me getting isolated from the rest of thew world.

My main problem now: each time I choose an album, I wonder if I’m making a conscious or unconscious choice. I have several hundreds disks in digital format but no real way or making statistics (as I use several players). Currently, this is more a feeling than hard-data backed evidence, which disturbs me. I know not to trust a feeling as it’s usually the best way to be wrong.

For the coming weeks, I’ll try to sweep the darker area of my collections, to dig into stuff I know less and see if I have the opposite effects. Anyway, I found  funny to realize after so many years and to discover such a correlation.

What I currently play, march edition

Roughly 5 years after everyone, I’ve started playing the Witcher 2. I don’t have much available time so I play in easy mode. The fighting system is good, despite requiring to memorize 6 pictograms for some sorts (I actually did not memorize them but bound them to some mouse buttons). The quest part is simple but interesting, with lots of content and a nice story.It probably would not win the game of the year but it’s good to waste some time that I don’t have. It’s super cheap on steam, so definitely worth the few bucks it costs if you didn’t try it yet.

As part of the previous of april’s monthly humble bundle, I received this War of Mine. It’s the same price tag as the previous game, but a very different kind of game. Instead of being a super badass, with nearly unlimited powers trying to kill their way to fame and fortune, you play a bunch of struggling civilians, trying to survive in the middle of a city in war, fighting for medicines, food, water, avoiding the various dangers represented by robbers, other scavengers, snipers. The game is black and white, with a very gloomy look and feel. The realization is definitely awesome, it’s interesting to play, but it has a psychological toll: you are constantly reminded that life can end without notice, that your hard-earned resources can be stolen by a group of robbers, leaving you with gashing wounds. I definitely enjoyed the few hours I spent on the game, but I would have a very hard time recommending it. While game usually translates you into an imaginary world, this one does its best to remind you in what environment some people live. On top of the survival struggle, should you choose the path of violence, your characters will start worrying about their fate and soul, making you actually feel bad for taking such a decision. Do you prefer to save the 2 begging kids mother or your friend? Cause there is not enough medicine for everyone. If you feel the immersion is not enough, your team is represented through realistic pictures, with a short bio explaining their struggles and evolving over time. And in case you’re wondering, death is final, there is no saving and reloading in real world.

I’ve played Jamestown which is a good old fashioned shoot them up. Not much to say, it’s hard, entertaining, good to empty your brain. Several ships with different weapons, an hair-fetched scenario. I had it for a while, rather a good surprise and one of a few games that can be played with the kids watching, thanks to the very cartoon-like/unrealistic feeling (easy to spot the bad : they’re ugly)

GRAVARK: Survival Evolved, Rust: these were games I really wanted to play. Open-world, mmo, sandboxing. I was really hoping for a feeling of collaboration, man against the environment, creativity. What I got was half finished games, full of bugs, almost impossible to play, with lots of gankers, fuzzy objectives, broken scenario. Clearly a huge deception and I don’t recommend investing time in these, which was a surprise for me.

Last, millie is a very nice snake-like game. I didn’t play much but it’s one of the few games which is really nice and playable by one of my 5 years old twin.

 

Box with non vertical sides

box

While creating a perch for our parrot, I stumbled upon something non trivial : if you want to assemble a box with non vertical sides, what cut angle are you supposed to use to have a nice assembly ? It’s obvious that it should be a trapeze, but what would be the α angle ?

Screenshot from 2016-02-16 13:21:13Easy peasy, let’s dig into the maths!

On the schematics, once assembly is done, we have B=B’ and A,B, B’, A’ in same plane.

Supposing that we have an angle β with vertical (meaning a standard box has β=0), this means

\( tan(\alpha)=\frac{AB}{OA}=\frac{OA’.sin(\beta}{OA}\)

as OA = OA’, we have trivially \(\alpha=atan(sin(\beta))\)

If you need to be convinced, the animation above is done with β=30°. It’s been realized with pov and the code can be found on my POV repository on bitbucket.

And by the way, why did I need that ? Just to make it real :

IMG_20160214_162044

 

 

Je regarde youtube

Pour changer, voilà un article en français. J’ai longuement hésité à le faire, puis je me suis lancé. Avec 10 ans de retard, je découvre youtube. J’ai un peu honte, je travaille dans la technologie, j’ai travaillé dans l’industrie des médias et c’est seulement maintenant que je m’intérèsse à ce nouveau média.

Pour moi, youtube, c’était des mauvaises vidéos de chat, c’était des gens qui tombent filmés en SD, surencodés et pixellisés, c’était également du contenu copyrighté dont la légalité avait souvent la même odeur que la qualité. Et petit à petit, je me suis mis à regarder de plus en plus de vidéos et à changer d’avis.

Tout d’abord, youtube est certes un repaire de pré-ado, surtout en lecture. De nombreux contenus font peur, par leur naïveté ou pour la violence de leurs propos. En tant que parent, je me dis que jamais je ne laisserai un téléphone portable ou une caméra à mes enfants. Et bien sûr, je n’aurai pas le choix.

Alors oui, il y a des vidéos de gens ivres morts qui font la fête, d’accidents horribles non censurés, de gamines de 13 ans qui font des tuto maquillage hyper sexués sans se rendre compte de l’image qu’elles projettent. Ou sans se rendre compte de qui peut être derrière l’écran. Oui, il y a des viédos de chat qui font des millions de vue. Oui, Gangnam Style a fait tellement de vues qu’il a fallu coder le nombre de vues sur 64 bits. Ca fait quand même plus de deux milliards de vue sur une vidéo qui a de la publicité, probablement de quoi se payer quelques menus objets.

À côté de ces gros tubes, il y a plein d’autres choses et c’est à elles que je veux rendre hommage. Personnellement, les comiques qui passent à la TV ne me font que rarement rire, mais je me marre quand je regarde le rire jaune.

Et puis, il y a de vrais créateurs, qui passent des messages forts ou une vision alternative, de la réalité. Souvent des messages forts, artistiques, contestataires.

Ce qui m’a décidé à faire ce billet, ce sont quelques vidéos que je vais mettre ici, brutes de décoffrage

Les jeunes et la drogue, de Nad Rich’ Hard

Facebook, tu ne nous auras pas, sauf que pour certains métiers, c’est nécessaire. Ou comment la loi est impuissante devant les impératifs business (en anglais sous-titré – le texte anglais est plus policé):

Vous pensez que les motards sont tous de jeunes cintrés de vitesse. Changez d’avis avec mehdiator

Ce que sont les crises d’angoisse, avec Meghan Rienks (en anglais)

JB Bullet chante son indignation au lendemain des attentats de Charlie Hebdo (un an déjà…)

L’analyse musicale par LinksTheSun

Comment bricoler un tour avec une perceuse, par Jack Houweling (en anglais)

J’en aurais encore des centaines comme ça. Des clips, des court-métrages qui mettent une grande baffe. J’ai du faire un choix, il est forcément injuste. Il est forcément très personnel, biaisé. Peut-être même politique, qui sait. Moi pas, en tout cas.

Le point commun entre tous ces clips: ce sont des créations indépendantes, faites par de vrais artistes, souvent peu connus, souvent jeunes, toujours passionés. Des gens qui se battent pour essayer de vivre de leur passion, de se faire un nom, qui donnent de leurs trippes. Quand je compare ce que diffuse la télévision et que paient mes impôts à la qualité du contenu de Youtube, j’avoue que je fais mon choix. Oui, Youtube vit avec la publicité (ou par souscription pour les pays qui ont Youtube Red). Personnelllement, je préfère voir quelques vidéos de publicité et soutenir directement des artistes de valeur que regarder des spots entiers de publicité pour du contenu médiocre. Et parfois, même si je n’y suis pour rien, je suis un peu fier de l’entreprise pour qui je travaille qui permet à cela d’exister.

Les commentaires sont comme d’habitudes modérés et le seront fermement contre tout troll. Cet espace est ouvert au débat, pas à la haine. Et à titre de rappel, ce sont ici exprimés mes avis personnels et non ceux de mon employeur, de mon perroquet ou d’une éventuelle conspiration franc-maçonnique.

Et bien sûr, ça fait un peu plus d’un an, mais je reste charlie.

Egg shape and camshaft

cameIntroduction

For some tinkering, I wanted to be able to draw a standard, egg-shaped cam and compute the displacement it was generating.

I thought this was a trivial problem, but I couldn’t find anything, so I’ll describe the path I used. As a side note, the end-goal was to generate some 3D animation with persistence of vision, so I was somehow constrained by what as doable with this software (knowing that I don’t generate anything and just use the software, so no real way of numerical solution and such)

The approach I followed seems to have been used for centuries by architect to create egg-shaped curves.

It uses 2 parameters, that I named r and h. I’ll describe the geometrical construction and then go to the calculus phase.

As a side note, I had great fun finding all of these and coining it into an article, hope you’ll like reading it as much as I had writing it 🙂 Some other may follow on related subjects, depending on interest / time.

Construction

  • Choose a point (O), this will be your center of rotation for your cam.Screen Shot 2016-01-25 at 6.14.54 PM
  • Draw a circle S1 (black one) , centered on O and radius r
  • Draw a diameter, creating points A and B on circle intersection.
  • Draw a perpendicular diameter and pick a new point C so that OC = h
  • From now, the construction is symmetrical, I’ll focus on one side.
  • Draw a circle S2 (red one) centered on A and going through B (hence, radius = 2r )
  • let D be the intersection of S2 and OC
  • Draw a circle S3 (green one) center on C and going through D
  • Your egg-shape is now, starting from bottom : S1 to B, then S2 to D then S3

 

Calculus

Diameter of green circle

By definition,\(AD = 2r\)

Using pythagore on ACO, \(AC = \sqrt{r^{2}+h^{2}}\)

Then \(CD = \rho = 2r-\sqrt{r^{2}+h^{2}}\)

BOD Angle

If you project D on AB to have a new H point, then you have \(\widehat{HOD} = \widehat{BOD} = \beta\) and \(tan (\beta) = \frac{DH}{OH}\)

\(tan (\widehat{OAC}) = \frac{OC}{AO} = \frac{h}{r}\) then \(\widehat{OAC} = \alpha = tan^{-1}{\frac{h}{r}}\)

\(AH = 2r.cos(\alpha)\) and \(DH = 2r.sin(\alpha)\)

\( OH = AH – OA = 2r.cos(\alpha) – r = r(2.cos(\alpha)-1)\)

Finally : \(tan(\beta) = \frac{2r.sin(\alpha)}{r(2.cos(\alpha)-1)} = \frac{2.sin(tan^{-1}{\frac{h}{r}})}{2.cos(tan^{-1}{\frac{h}{r}})-1}\)

Polar coordinates

Let’s continue the fun, the end-goal is to have the polar coordinates of the cam…

We’ll use \(\theta\) as parameter and assume it’s value is 0 on AB axis. Function will have nice properties:

  • \(f(\theta+2\pi)=f(\theta)\)
  • \(f(\frac{3\pi}{2}-\theta)=f(\theta)\)

Meaning that we can focus on \([-\frac{\pi}{2},\frac{\pi}{2}]\)

On \([-\frac{\pi}{2},0]\), solution is trivial : \(f(\theta)=r\)

On \([0,\beta]\), solution is circle center on (-r,0) radius 2r, which has implicit equation

\( (x+r)^{2}+y^{2} = (2r)^2\)

Using standard polar replacements:

\( (f(\theta)cos(\theta)+r)^{2}+f^{2}(\theta)sin^{2}(\theta) = (2r)^2\)

The interesting function is now a second order equation, that can be trivially solved:

\(f(\theta)=r.(\sqrt{cos^{2}(\theta)+3}-cos(\theta))\)

On \([\beta,\frac{\pi}{2}]\), solution is circle center on (0,h) radius ρ, which has implicit equation

\( x^{2}+(y-h)^{2} = \rho^2\)

or  \(f(\theta)^{2}cos^{2}(\theta)+(f(\theta)sin(\theta)-h)^{2} = (2r-\sqrt{r^{2}+h^{2}})^2\)

Again, the interesting function is now a second order equation, which can be (not so) trivially solved:

\(f(\theta)= h.sin(\theta)+\sqrt{h^{2}sin^{2}(\theta) +5r^{2} -4r\sqrt{r^2+h^2} }\)

Limits on parameter

Due to the way the cam is built, h must be positive.

In addition, the worst case is having D aligned with O and C (actually C = D), and then, using pythagore:

\( h \in [0,\sqrt{3}]\)

Realization with Pov-Ray

Now that we’re done with the maths, it’s time to do the actual stuff. Real implementation can be found on my POV repository, core is in an include file and there is a reference example file.

The cam itself is generated using CSG : intersection of cylinder and plan, the exact same way I’ve explained before. I encapsulated it into a macro with 2 parameters, h and r. With these explanations, reading the file is really straightforward.

The polar function is implemented using a bunch of functions within POV. There are a few caveats:

  • it seems recursion is not well supported and maybe using a modulo would be smarter
  • using an horizontal egg instead of a vertical one (i.e. changing the theta reference) would allow to have a symmetrical function (the current one has a pi/2 offset)
  • POV function do not allow to use #if statement (seems to be limited to global variable). Using select is a ice workaround but is really killing readability

To have an idea of how h parameter influences the result, quick matrix of rendering with r=1 and h variable:

result

Free bonus, script used for the rendering, with some image magick in it:

#/bin/bash
BASE="came"
OUTPUT=output

find $OUTPUT -iname "$BASE*.tga" -delete
TOTAL=""
for a in `seq 0.1 0.1 1.6`; do 
 OUT=$OUTPUT/${BASE}_${a}.tga
 OUT2=${OUTPUT}/${BASE}_${a}.jpg
 TOTAL="${TOTAL} ${OUT2}"
 povray -W200 -H200 +k0.1 -Iscene/$BASE.pov -O${OUT} Declare=h_parameter=$a
 convert ${OUT} -fill white -stroke red -pointsize 40 -gravity south -annotate 0 "h:$a" ${OUT2}
done

montage ${TOTAL} -geometry +2+2 result.jpeg

Chromasquad

I’ve recently had to fly oversea (yesterday) and this is usually for me the opportunity to try new things: can’t really sleep, in-flight entertainment is usually crappy, so here I go.

I tried a new game called Chromasquad. Reason why I tried this is simple : I recently got it in a humble bundle (monthly one I guess), it’s DRM-free (I could get it from humble bundle website easily), it’s small (in 100 of MB at most) and runs decently on a mac book air, which has close to no power.

I tried and I got surprisingly addicted: pitch is pretty simple, a bunch of stuntsmen go out of their studio and start making their own power rangers clone. The game itself is close to XCom, enemy unknown : you work your team, improve it then play in a turn by turn. Gameplay is quite addictive, not as easy as it sounds initially. Graphics are… well, let’s say they fit with nostalgia with a nice principle of hand drawn, blocky old fashioned sprites. Either you love or you hate, it personally reminds me of my youth 🙂

Seeing how cheap the game is, I strongly recommend to buy it. Seeing that I missed the trophies (playing out of steam), I’ll probably redo it really soon and keep it as a plane friendly, low-power game.

Of course, the other games I did in the plane were less fun. They included tearing of my seat with the help of the steward to fetch my headphones converter, 45 minutes of turbulence in the middle of lunch and using a 10 inches screen to watch an SD movie. I don’t understand how in-flight entertainment can still be that crappy.

Youtube and me, second round

My first try with youtube was such a tremendous success  (ahem) that I had to try again. The main problem of previous video was a really crappy sound. I did lots of tests since and discovered that my headset is producing decent sound quality with audacity. However, if I try to record directly from lightworks or OBS, the sound becomes awfully crappy. I don’t have an explanation yet.

Today’s topic is a response to tripa’s challenge to do a dodecaedron with a straigth edge and a compass. I found it quite interesting as it allowed me to explore other alternatives.

Let’s go to the gory details:

  • Shooting is done using my reflex (Canon EOS 550D) and a 28-55 optic (if I remember correctly).shoot_reflex The setup involved holding the reflex vertically and connecting it to my computer via USB. The challenges were mostly that the optic I used is a zoom and tended to fall and change focal and that the vibrations tended to shake slightly the video. Overall, I’m pretty happy with the video quality
  • Shooting was done with my crazy parrot trying to help. Not sure if she was successful to help but she had a great time.
  • I used lightworks, again, and I’m still not convinced. I was unable to zoom / trim my still pictures in the video editor (hence these nice black band) and export is limited to 720p, which is a pity knowing the initial material is 1080p… Some UI issue killed me as well, I have a feeling  that I’m not in control and it makes me slightly uncomfortable. Especially, I liked the concept of using subclips and reusing them, but I was hoping for references rather than copies : if I make a “introduction” edit and use it in my main edit, it seems like editing the intro one has no effect on the main one….
  • Getting decent light is not trivial either, probably need to work on that one, I played easy as it was dailight and I had natural diffuse light (thanks to the snow falling from the sky)
  • I used some background music that I took from bensound.com. I checked 10 times and it seems to be really fine with what I’m doing, I’m no musician but I found having a soft background sound helped. I definitely should do better with regards to music editing, I feel really crappy (no soft transition, lack of music at some point). I hope it does not cover my voice.
  • I recorded the voice using audacity, then exporting sub-sample and mixing them. Not using face video means not having to care about AV synchro 🙂
  • I inserted a title and some rolling credentials, was surprisingly easy !

My conclusion, it’s not trivial to do but it’s doable if you’re fine with a sub-par result. If you aim at higher quality, then the effort grows exponentially (and so does the headache)

 

Youtube and me

I’m from a generation who was taught that the ultimate source of knowledge are the books. I managed to evolve on my own and found that internet is a wonderful place where lots of people share lots of interesting stuff. I was pretty happy with that situation : look for a blog post or an instructable, a random tutorial, more or less crappy, follow and tune, troll. I had the manual on how to do it, from newsgroup to phpbb forum. Eh, I even got my own personal blog!

The new generation seems however to have moved out of written knowledge and shit into using video as a solution to any problem. I personnally don’t like too much, I find much easier to skip and follow written instruction than a video whose focus is not always on the interesting part. Anyway, if the moves has moved that way and the cool kids are doing that, I guess I don’t have too many choices : follow and try to be a cool kid (ahem) or start becoming obsolete. I feel too young to be obsolete, so I looked at what is the effort required to create a decent youtube tutorial.

Bear with me: I didn’t want to do a crappy video with my smartphone of me doing something stupid (see : tthat how you plug an sdcard into a raspberry pi while focussing on the cable behind. I wanted to do something nice, not prolfessional but somehow useful.

Conclusion, it’s tough! My personal computer environement is composed of mac (corporate laptop), linux (poor laptop) and windows (gaming rig). It seems obvious that I want cross-platform tools, I got kids and less freetime than the average student, not talking about the random teenager which seems to be the most adept at posting content.

Ok, I tried tonight, spent roughly 3 hours on a simple inkscape tutorial

  • I used Open Broadcaster Software for screencasting and mixing video and sound
  • I used lightworks (free as in free beer, not free speech) for assembling clips together

Lessons learnt:

  • if you want to explain something, better know exactly what you are doing. Especially, first try was a one shot with lots of trials and errors. So shot sequences and mix them later.
  • mounting sequences is hard: it took half the time to just link them together and it seems I managed to export a 30 minutes video while having 10 minutes of content
  • software limitations are bitches: I shoot in 1080p, could only export to 720p, which is a major issue when shooting a screencast.
  • my microphone was saturating, so I reduced gain. And then you can’t hear me (used my heaphones as microphone)
  • had to shoot twice cause I used a bad codec the first time, this pissed me of (we’re in 2015, isn’t the codec mayhem supposed to be fixed?)

Next time:

  • redo the same video, I’m becoming exceedingly efficient at drawing dodecahedrons schematics
  • write a script that you can follow
  • keep empty space before and after each recording, it’s easy to trim
  • read more tutorial on mounting tool, maybe switch to cinelerra?
  • prepare an intro, add titles and copyrights
  • merge some sound as background and control current sound level
  • avoid any kind of copyright infringement

If you want to laugh, here is the result:

Monthly Humble monthly: december edition

Recently (november 2015), humble bundle decided to have a subscription based bundle: instead of buying a game bundle, you opt in for a flat fee (12 USD) and you got a surprise package.

I like this concept as it forces to discover and try new games while limiting the budget impact to almost nothing. Games are redeemed on steam, which is for me currently the most efficient distribution platform (with lots of efforts on linux gaming as a nice bonus). I was quite reluctant at beginning as I already own a whole bunch of cheap-ish games from steam sales or humble bundle packages (and they tend to have the same game included in many packages), but the cheap price got me.

After 2 bundles, I can say that I’m overly satisfied with this. Here is a quick review of what I got and how I felt.

November:

  • Legend of Grimrock 2: old fashioned RPG, was on my wish list. Tried it, didn’t really play, seems that it requires some good hard core attention to detail
  • Towerfall Ascension
  • Besiege: was on my wishlist, it’s kerbal space programs on catapults: built your siege weapon and conquer the town (or die winning a Darwin award). Not tried yet, but clearly a nice one.
  • Valkyria Chronicles: a weird japanese mix between storyline, manga and fps. Played the tutorial, was not really convinced.
  • Lethal League: not tried
  • SanctuaryRPG: Black Edition. Not tried yet.
  • Saints Row IV: already had it from a previous bundle, never really played it. Seems a funny FPS, not really politically correct.

December:

  • Banished. Hard-core city building game. Reminds me of settlers for the game mechanics: you act on your population by asking to build dedicated buildings and specializing your settlers. There is no colonization/war part, only economical survival. So far, seems pretty tough and fun, really for hard core gamer. Kinda like Eve online is spreadsheets in space, that one is very likely sheets in settlement.
  • Rust: MMO survival game, seems awesome, was on my wishlist, not tried yet. Games seems to be plagued by gankers and fairly hard, will see…
  • Chroma Squad: not tried yet
  • Neon deluxe edition: not tried yet
  • Company of Heroes 2 + add-on: not tried yet, seems to be a commando-like game, very strategic. Will probably give it a try over x-mas vacations.
  • PayDay 2: the games seems to have a lots of potential for fun team playing. The offline/single player mode involves playing with stupid bots and is not fun at all. Either I missed something(but I tried hard) or the game is just made only for multi. As I’m unlikely to find 3 friends to play with me, probably not going to use this one much.

Overall, for very little investment (24$), I got a bunch of games I personally wanted and some recent blockbusters titles. The ratio quality/price is awesome and if they manage to keep this track, this is an awesome deal,  much higher quality in my opinion than the average humble bundle.

This however points the fact that with a job and a family, getting 5+ games a month is just too much of me to try playing it. If someone wants to sneak at my profile, I can be found on steam as Darkbruce.