blog.8-p.info

tricot is a Japanese rock band. The small sub-genre they belong often called “math rock” in Western.

While they sing exclusively in Japanese, they have international fans and appeared in Fader (2015), Vice (2017) and NPR (2018). They have toured multiple countries even before signing with a major label.

I thought they would become a band which is known in other countries rather than Japan, such as Cibo Matto or Shonen Knife. But they recently signed with Avex, one of the major labels in Japan. tricot’s lead vocal, Ikkyu Nakajima also sings in Genine High, that apparently brings new fans. All data points I have is YouTube’s comments though.

So, tricot would be big in 2020!

I was thinking about enabling this blog’s RSS - IFTTT - Twitter integration once again, and then found that Chris Krycho left Twitter completely. I know and like him because his New Rustacean podcast. He has elaborated the reasons on Breaking Up With Social Media.

Unlike Chris, I would not delete my Twitter account. Compared to my Instagram account which I’ve deleted, I feel that my tweets were somewhat connected to other tweets. I had meaningful conversations and I don’t want to delete them. I do hate 404s on the internet. Cool URIs don’t change.

That being said, I can relate to what he has elaborated. So I may not enable the Twitter integration and be better at handling the silence.

I’m writing a small parser in Rust, with nom, a parser combinators library.

If you have heard about nom, you might know nom is using macros heavily. It was, but not anymore since 5.0.0.

This version comes with a complete rewrite of nom internals to use functions as a base for parsers, instead of macros. Macros have been updated to use functions under the hood, so that most existing parsers will work directly or require minimal changes.

Writing a parser in nom reminds me boost::xpressive. It feels like writing a regexp with functions.

fn parse_literal<'a>(input: &'a str) -> IResult<&'a str, Literal, VerboseError<&'a str>> {
    alt((
        map_res(digit1, |s: &str| s.parse::<i32>().map(Literal::Number)),
        map(
            preceded(
                char('\"'),
                terminated(escaped(none_of("\\\""), '\\', one_of("\"n\\")), char('\"')),
            ),
            |s: &str| Literal::String(s.to_string()),
        ),
    ))(input)
}

For me, writing a parser in nom starts from thinking about its abstract syntax tree, often with a lot of enums. Then I write all small parsers like the function above.

FitBit’s sync had been a long issue for me, but disabling battery optimization by following this forum answer made it super stable.

Nowadays I listen music on YouTube, Amazon Music and other streaming services. I haven’t moved my iTunes library from my old laptop for years. I still have a bunch of CDs, but don’t have a playing equipment anymore.

Except for a USB CD/DVD drive.

So I decided to combine the CD/DVD drive and a Raspberry Pi 3 to make a CD player.

Power

First Raspberry Pi 3’s USB power is not enough for spinning a CD. My drive has a DC power input in addition to the USB port. Plugging the drive to an external AC/DC adapter is pre-requisite.

CD drives cannot play CDs anymore

Then I tried cdplay but it didn’t work.

$ cdplay
cdplay: ioctl cdromplaymsf: Operation not supported
$ sudo cdplay
cdplay: ioctl cdromplaymsf: Operation not supported
$

cdcd looked fine, but it didn’t play any music.

$ cdcd play; echo $?
0
$

It turned that CD drives nowadays cannot play CDs anymore. This Stack Overflow answer told me what “cdromplaymsf” means and the alternative such as mplayer.

Buffering

But MPlayer frequently choked with Write error: Broken pipe.

$ mplayer cdda:// 
...
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:  15.5 (15.4) of 2530.4 (42:10.4)  0.1% 
[AO_ALSA] Write error: Broken pipe
[AO_ALSA] Trying to reset soundcard.
A:  17.8 (17.8) of 2530.4 (42:10.4)  4.4% 
...

Apparently the issue is coming from the fact that the CD drive is not that fast. Adding -cache like mplayer -cache 1024 cdda:// made the situation better.

Next?

I have a few ideas;

  • Getting rid of the drive completely and play MP3 or FLAC instead.
  • Building a graphical user interface.
  • Making my own streaming service. My work meetings are happening on my work laptop. I don’t want to plug/unplug my headphone for listening music.