POP: noise reduced and schematics uploaded

After cabling audio internally with shielded wires, and solving a grounding problem in the input jack, noise has been reduced drastically when working from battery. There is still an annoying computing noise when connected to an external 9V power supply. I am going to put a removable ferrite bead, still waiting for the parcel to arrive.

I have also finished schematics for the project, that have been uploaded to https://www.hackster.io/manolonte/pop-programmable-open-pedal-9acddf

popv1-0_esquematico

 

Next steps:

  • Trying with ferrite bead
  • Adjusting output volume, too high right now
  • Giving a function to second switch, maybe fast reset for changing mode quickly
  • Reducing latency
  • Creating new effects: some ideas:
    • dubbler
    • auto-ovation: just for fun, when you stop playing, simulate an audience ovation, just like in  “Blues Deluxe”, from Jeff Beck Group
    • tremolo, phaser, etc.
Advertisements

POP: Programmable Open Pedal, first test

First recordings of POP through a Fender Blues Deluxe 40W AB tube amplifier. Camera is a GO Pro HERO. The amplifier is looking towards the wall in order to save our ears. Guitar is a Yamaha Revstar 420, I love it.

Impressions

Sound quality looks promising, though still I can hear some computing noise, specially when configuring a compressor or a distortion/overdrive. When using delay type effects, or reverb, noise is quite bearable.

I am using a 512 bytes buffer, and getting around 20ms of latency, still too much.

Some more research is needed to get the best from this unit, keeping in mind the limitations: CHIP board works at 1GHz, and sound card is integrated in the SoC, as long as I know.

Stay alert for new tests.

I have also still to publish some documentation about the project. More details can be found here: https://www.hackster.io/manolonte/pop-programmable-open-pedal-9acddf

https://www.hackster.io/manolonte/pop-programmable-open-pedal-9acddf/embed?use_route=project

Please leave any feedback you consider relevant or funny.

POP: Programmable Open Pedal

What is POP?

dsc_0022

This is my most recent project. Based upon the C.H.I.P. board form Next Thing Co, I have built a stompbox guitar digital pedal. These are its main features:

  • stereo output
  • true bypass
  • standard 9v input
  • three modes of operation
  • reset/shutdown  button (the red one)
  • additional programmable button (the black one)
  • wifi, enabled inly in one of the modes
  • microusb input, for serial connection
  • USB  input, where you can connect a MIDI controller, so effect parameters can be modified on the run
  • backup battery, so if you unplug the unit, you have the chance to shutdown gracefully

C.H.I.P board offers a good opportunity to build this kind of units because it has audio capture capabilities natively, without the need to plug an external (usually slow) USB sound card.

At this moment I am still doing tests, trying to improve sound quality. Some software stacks I have tested up to now:

  • Rakarrack on jack: unstable in this platform
  • Guitarix on jack:  quite stable and very good sound quality, but a lot of CPU consumption. The good point is that you can configure and control the unit graphically, doing a SSH -X from a computer.
  • Supercollider on jack. Super-flexible, Supercollider is a programming language, so you can create any effect your imagination dictates. The problem is that I haven’t reached the sound quality I am looking for, maybe a SC expert can do.
  • LV2 plugins on jack, running with mod-host. With this combination I have got the best results, in a next post I will upload some sound clips. You can control parameters with a MIDI controller, and preset parameters. You can choose from a huge list of already programmed effects, and combine them in any order.

My current software configuration is based on LV2 on jack. I have programmed three modes of operation using the switch you can see at the right in the above picture:

  • switch up: double delay, controlling feedback and delay time of the two delays with a Korg Nanokontrol2 MIDI controller
  • switch middle: compressor, controlling attack, release and gain
  • switch down: reverb, controlling room dimensions and warmth. In this position, I activate wi-fi interface and sshd, so I can connect my computer and make changes, update the software, fix issues, etc.

Some advices for anyone looking for something similar:

WIFI

Wireless interface can be a problem if you enclose a computer inside an aluminium box, as is the case in this project. If you use a plastic box, you will have too much electromagnetic noise. For a compromise, I decided to drill a hole in the case, right above the wireless antenna. With an eight millimiters hole, and putting the unit not far from an access point, I am getting a quite good network access.

FAN

Another problem derived from the case is temperature. Without a fan, temperature was reaching 70 Celsius degrees. With a small 12V 25 mm fan, powered at 9V, temperature keeps stable at 51 degrees, even lower with wireless deactivated. I put the fun below the hole I had already done for wifi waves to escape the enclosure, as you can see in the pictures just below the switch.

JACK

I mean jack software. You have to compile it for no GUI, as they describe here: https://capocasa.net/jackd-headless

For the rest of the software (LV2, mod-host) I will write a dedicated article.

SOUND INPUT AND OUTPUT

I have got the best results using the minijack input for audio capture, and board connectors for output. I have grounded the audio capture and output with the board connectors and at this moment there is almost no computer noise.

POWER SUPPLY

My advice is to power the board using pin U13-2 CHG-IN, instead of powering it using the microUSB connector: it is discussed here: https://bbs.nextthing.co/t/chip-power-pins-maximum-current/7164/9.

I built a 5v/9v converter using a tipical 7805 IC, and fixed to the case with a screw. Don’t put the thing too close to the board.

FLASHING CHIP

With kernel 4.4, I got errors when capturing audio, so I sticked with kernel 4.3, until I can do some new tests or someone tells me it is fixed:

https://bbs.nextthing.co/t/dsp-with-c-h-i-p-and-audio-capture/6993/5

dsc_0006

So I am very excited now with this project. My main concern now is sound quality and usability.  I’ll write some additional posts with audio clips and new notes and advices. I would like to upload some schematics with the internals of the unit.

If someone is interested in more details about the project, or have some questions, please write some comments,  or send me an email to manolonte@gmail.com.

The ugly, the good and the minor third

Why does a melody sound good to us, to some of us but not to others? Why does a song sound sad while another one sounds glad or awfully dissonant? I don’t know, of course, but it seems to have to do with evocation of known melodies, cultural conventions and something in our brain that is still to be discovered.

Some time ago I was curious about what kind of sound resulted from the addition of two notes in a chord or a melody.

Let’s consider a root note, let’s say A440, known to have a frequency of 440Hz. The sound will be a sinusoidal wave,  something that would seem like a flute.

root

Now let’s add a perfect fifth. We’ll consider a perfect fifth to have a frequency = 3/2 of its tonic.

5th

In black we have the tonic, in red perfect fifth and in blue the sum of both signals. What happened? The resulting sound is a signal with a frequency of 1/2 * 440Hz = 220 Hz.

Now let’s consider our A flute and an added major third. There are several standards for major and minor third frequencies related to tonic (see https://en.wikipedia.org/wiki/Major_third) but for this exercise I will take the just intonation, in which the major third has a frequency of 5/4 multiplied by its tonic frequency.

M3rd

In black the tonic, in red the major third and in green the sum. Now we have a resulting signal of  1/4 * 440Hz = 110 Hz.

Now let’s add a minor third to the tonic. In just intonation, minor third has a relationship of 6/5 with its tonic frequency.

m3rd

In black the tonic, in red the minor third and in green the addition of both. Now the resulting frequency is 1/5 * 440Hz = 88Hz

The last plot will consider a very dissonant note, a minor second, with a relationship with the tonic of 16:15.

m2nd

The frequency of the resulting signal is 1/14 * 440Hz = 31.42Hz

Obviously, as the second note’s frequency approaches the tonic’s frequency, the resulting signal has a lower frequency.

Now let’s take a chord. A major chord will be something like this:

majorchord

In black the tonic and in red the addition of tonic, major third and perfect fifth. The resulting signal has a frequency of 1/4 * 440Hz=110Hz.

Now with A minor:

minorchord

Now the resulting signal has a frequency of 1/10 * 440Hz.

Let’s summarize the results:

interval/chord frequency note
tonic 440Hz A4
perfect 5th 220Hz A3
major 3rd 110Hz A2
minor 3rd 88Hz ~F2-F#2
minor 2nd 31.42Hz ~B0-C1
A major 110Hz A2
A minor 44Hz ~F1-F#1

Perfect fifth and major 3rd have a curious property: when you add them to the tonic note, you produce a signal whose frequency has the same frequency of the same note in a different octave. However, when you add a minor 3rd or a minor second to the tonic, the resulting signal frequency has no relationship with any note.

I hope you have enjoyed this mathematical experiment and that it will make you think about intervals in a different way. But above all, please enjoy your favorite music, either thinking about intervals or not thinking at all.

Where to put a Fuzz Face

A lot has been written about where to put Fuzz Faces when being combined with other pedals, especially with Wahs. The fact is that Fuzz pedals are based on a very basic circuit, with a very low input impedance, and where the serial resistence of the 9v battery has a lot of influence. I have a Dunlop Fuzz Face that was living in ebay until I changed its alkaline battery for a very cheap carbon zinc one. The improvement in sound was awesome, and its price has increased  10 times (just in case you want to buy it). After I abandoned the idea of putting it in ebay, I had to decide where to put it in the pedals ecosystem.

Instead of explaining the principles behind the personality of this pedal, I will try to test it in different configurations and show the results as sound clips. These results are valid for *my* Fuzz Face, since each one has its own idiosyncrasy, but I expect them to be similar for any other pedal out there.

Gear:
Guitar: Fender Stratocaster American Standard – 2012. Maple neck. Pickup: neck.
Wah: BOSS Fw3
Fuzz: Dunlop Fuzz Face germanium with carbon zinc battery.
Univibe: TC Electronic Viscous Vibe, chorus position, true bypass set (it can be configured as buffered, but I left it as true bypass on purpose, in order to illustrate how impedances influence sound).
OD: Ibanez TS-9
Amplifier: POD 2.0 for recording, bypass position and “modern class a” emulation

Recorded with Ardour.

Before listening to the clips, please keep in mind that I am not a guitar virtuoso, so please concentrate on sound 🙂

  1. Guitar -> Fuzz -> Wah -> OD -> Univibe
    1. Fuzz On, rest off – 
    2. Fuzz On, Wah On – 
    3. Fuzz On, Overdrive On –
    4. Fuzz On, Univibe On – 
  2. Guitar -> Wah -> Fuzz -> OD -> Univibe
    1. Fuzz On, rest off – 
    2. Fuzz On, Wah On – 
    3. Fuzz On, Overdrive On – 
    4. Fuzz On, Univibe On – 
  3. Guitar -> Wah -> Fuzz -> Univibe -> OD
    1. Fuzz On – 

I have tested only some logical configurations. Usually guitarrists have doubts about how to combine Fuzz with Wah or Univibe, but few people would put a Wah after a Univibe or a Fuzz after a Univibe. Some guys put Fuzz after overdrive, I prefer the opposite, but this is just a personal preference.

So I have ommited many configurations, like:
– Guitar -> Univibe -> Wah -> OD -> Fuzz
– Wah -> Guitar -> OD -> Fuzz -> Univibe 🙂
– etc.

Some comments about the configurations, from my point of view: In general, I prefer configurations 2.X over configurations 1.X. With Fuzz Face right after guitar you can control the Fuzz effect with guitar volume. Below 8, there is virtually no fuzz, and beyond that, fuzz comes and begins to increase until 10. I’ll show it in some other post, testing different pickups. But for my taste, the sound is worse than fuzz after Wah (config. 2). After wah the sound is much more full of frequencies, louder, more uniform in time, with better bass presence and more sustain, and what is more important, more Hendrix-like. Univibe in configuration 2 is more metallic and brilliant and again, more Hendrix-some. The difference has to do with the buffer in the Wah pedal, with very low output impedance, instead of the guitar pickup impedance, in the KOhms range. It has a very noticeable influence in the Fuzz Face circuit, that has a low input impedance, far from an ideal effects circuit. For my ears, when putting the fuzz face between two buffers (FW3 and TS-9) the sound is clearer and reacher in frequencies and has better sustain.

I tested configuration 3 in order to show the difference when Fuzz Face has a True Bypass pedal (Viscous Vibe with factory configuration) instead of a buffer. The influence in the output is not as noticeable as in the input, but for me it is somewhat darker than the other way around.

Viscous Vibe pedal is a super-versatile pedal. I have tested it in Chorus Position because I like the sound it gives by default when combined with fuzz. When I combine it with an overdrive, the volume drops too much when it is on, this will be discussed in another post. Actually, I’ve heard that the original Shin-ei Univibe has the same “problem”, so they at TC Electronic did a good job.

Combining Fuzz and Overdrive in my tests is producing too much noise. When combining them, it is better to keep the effect pot at middle position in both. Overdrive can tame the Fuzz effect and shape the frequencies response in some measure, as well as volume.

My comments are of course debatable, and if your opinion is different or you have a different experience, please leave a comment below, it will be appreciated.

To know more about Fuzz Faces, please visit these links:

http://www.dingotone.com/wordpress/wp-content/uploads/2012/06/Discussion-about-fuzzface-batteries-V1.pdf
http://www.geofex.com/article_folders/fuzzface/fffram.htm
http://www.muzique.com/news/buffers-before-fuzz/

You can buy Viscous Vibe here:

 

 

Samsung EVO 16GB MB-MP16D micro-SD card corrupted on Raspberry Pi 2 model B

Yesterday, and today again, the micro-SD card got corrupted after a session of normal functioning and a shutdown or reboot. Root filesystem was formatted as ext4. After reading these sites:

  1. http://www.vanheusden.com/misc/rpi.php
  2. http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=25703

I decided it was time to test f2fs filesystem with Raspbian on Raspberry Pi 2.

Migrating was easy, just format the partition as f2fs on Linux (you need f2fs-tools), and then copy the files with tar. There is no fsck.f2fs for Raspbian yet, but you can download the deb package from https://packages.debian.org/sid/armhf/f2fs-tools/download. Follow the instructions on the 1st link above in order to changes the root filesystem expected by kernel at boot (change it in cmdline.txt) and change filesystem in /etc/fstab as well.

Raspberry booted a while ago two times with this new configuration. I have just upgraded it and will give it a try for the whole day.

Raspberry Pi Model B vs Raspberry Pi 2 Model B

I have just received a new RPi 2 Model B. Yesterday I prepared a microSD card copying the three partitions of another SD card with Raspbian installed. The method was as follows:

– Partition the new microSD card with fdisk, same size except the last partition (swap) that was slightly smaller in the microSD.

– From my home computer, dd from original partition to final one:

# dd if=/dev/mmcblk0p1 of=/dev/sdb1 bs=4096
# dd if=/dev/mmcblk0p2 of=/dev/sdb2 bs=4096
# dd if=/dev/mmcblk0p3 of=/dev/sdb3 bs=4096

Raspbian was updated just before migrating the SD, so it has the last kernel and bootloader updates.  uname -a reports:

Linux parpuja 3.18.5-v7+ #225 SMP PREEMPT Fri Jan 30 18:53:55 GMT 2015 armv7l GNU/Linux

Raspberry Pi 2 boots without any issue, faster than the previous model, as was expected.

Some pictures of the two models:

IMG_20150210_123821IMG_20150210_123856

The only problem was the case. Since the new model has four USB slots instead of two, it does not fit into my homemade Video8 case.

I have some benchmarks made to compare the two models. I found some precompiled benchmarks for RPi ARM A6 here (thanks Roy Longbottom): http://www.roylongbottom.org.uk/Raspberry%20Pi%20Benchmarks.htm

Compiling the benchmarks from source code is not trivial because they include some assembler code for x86. Roy has source code adapted for ARM in his page.

The benchmarks are:

  • busspeed
  • dhrystone
  • linkpack
  • liverloops
  • memspeed
  • whetstone

The two models compared are:

Raspberry Pi B 2011.12 512MB Raspberry Pi 2 Model B V1.1 2014

Benchmarks

 ########################################################

 Linpack Double Precision Unrolled Benchmark n @ 100
 Optimisation Opt 3 32 Bit, Thu Feb  5 11:17:03 2015

 Speed      41.37 MFLOPS

 Numeric results were as expected

 ########################################################
 ########################################################

 Linpack Double Precision Unrolled Benchmark n @ 100
 Optimisation Opt 3 32 Bit, Tue Feb 10 12:54:23 2015

 Speed     119.02 MFLOPS

 Numeric results were as expected

 ########################################################
SYSTEM INFORMATION

From File /proc/cpuinfo
processor	: 0
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 1
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 2
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 3
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

Busspeed

 #####################################################

   BusSpeed 32 Bit V1.1 Thu Feb  5 11:17:24 2015
 
    Reading Speed 4 Byte Words in MBytes/Second
  Memory  Inc32  Inc16   Inc8   Inc4   Inc2   Read
  KBytes  Words  Words  Words  Words  Words    All

      16    290    284    581    984   1044   1185
      32    133    106    121    121    225    426
      64     84     73     87     93    170    341
     128     53     51     48     62    109    249
     256     34     37     32     43     86    177
     512     31     32     31     42     84    173
    1024     31     34     32     45     84    183
    4096     32     32     32     43     87    190
   16384     32     34     34     41     83    176
   65536     31     32     33     44     83    176

        End of test Thu Feb  5 11:17:36 2015

SYSTEM INFORMATION

From File /proc/cpuinfo
processor	: 0
model name	: ARMv6-compatible processor rev 7 (v6l)
BogoMIPS	: 2.00
Features	: half thumb fastmult vfp edsp java tls 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xb76
CPU revision	: 7

Hardware	: BCM2708
Revision	: 000f
Serial		: 0000000022401f90
 #####################################################

   BusSpeed 32 Bit V1.1 Tue Feb 10 12:51:46 2015
 
    Reading Speed 4 Byte Words in MBytes/Second
  Memory  Inc32  Inc16   Inc8   Inc4   Inc2   Read
  KBytes  Words  Words  Words  Words  Words    All

      16    511    533   1333   1777   1706   1750
      32   1023    984   1163   1422   1638   1706
      64    426    409    761   1092   1365   1365
     128    372    393    682   1137   1638   1300
     256    213    232    426    758   1191   1094
     512    148    146    292    546    910    730
    1024     78     85    171    335    662    440
    4096     68     76    146    305    629    322
   16384     67     74    149    290    645    335
   65536     69     74    148    296    592    353

        End of test Tue Feb 10 12:51:57 2015

SYSTEM INFORMATION

From File /proc/cpuinfo
processor	: 0
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt 
   vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 1
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt 
   vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 2
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt 
   vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 3
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt 
   vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

Dhrystone

 #####################################################

 Dhrystone Benchmark 2.1 Opt 3 32 Bit, Thu Feb  5 11:13:07 2015

 Nanoseconds one Dhrystone run:       675.00
 Dhrystones per Second:              1481481
 VAX MIPS rating =                    843.19

 Numeric results were correct

 #####################################################
 #####################################################

 Dhrystone Benchmark 2.1 Opt 3 32 Bit, Tue Feb 10 12:52:43 2015

 Nanoseconds one Dhrystone run:       368.75
 Dhrystones per Second:              2711864
 VAX MIPS rating =                   1543.46

 Numeric results were correct

 #####################################################
SYSTEM INFORMATION

From File /proc/cpuinfo
processor	: 0
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 1
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 2
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 3
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

Linpack

Livermore Loops

 #####################################################

 Livermore Loops Benchmark Opt 3 32 Bit via C/C++ Thu Feb  5 11:17:50 2015

 MFLOPS for 24 loops
   64.3   79.3  128.8  145.0   22.9   29.0  106.7  125.8   89.9   37.6   30.8   24.2
   21.9   19.2   60.6   58.8   80.6   62.3   73.9   46.6   30.0   22.4   69.0   29.4

 Overall Ratings
 Maximum Average Geomean Harmean Minimum
   148.3    64.5    55.0    46.8    19.2

 Numeric results were as expected

 ########################################################
 #####################################################

 Livermore Loops Benchmark Opt 3 32 Bit via C/C++ Tue Feb 10 12:52:47 2015

 MFLOPS for 24 loops
  113.9  129.1  221.3  203.4   84.5   91.3  195.8  246.4  155.2  136.9   74.2   63.6
   62.6   70.2  125.9  125.2  196.3  153.0  132.6  116.2   77.3   41.6  161.2   89.0

 Overall Ratings
 Maximum Average Geomean Harmean Minimum
   246.5   125.7   114.7   103.8    41.5

 Numeric results were as expected

 ########################################################
SYSTEM INFORMATION

From File /proc/cpuinfo
processor	: 0
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 1
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 2
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 3
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

MemSpeed

 #####################################################

     Memory Reading Speed Test 32 Bit Version 4 by Roy Longbottom

               Start of test Thu Feb  5 11:19:32 2015

  Memory   x[m]=x[m]+s*y[m] Int+   x[m]=x[m]+y[m]         x[m]=y[m]
  KBytes    Dble   Sngl  Int32   Dble   Sngl  Int32   Dble   Sngl  Int32
    Used    MB/S   MB/S   MB/S   MB/S   MB/S   MB/S   MB/S   MB/S   MB/S

       8     568    602    853    639    731   1094   1122    465    653
      16     538    602    787    602    682   1023   1142    533    727
      32     301    269    319    292    269    353    984    511    571
      64     243    213    238    232    217    255    341    269    301
     128     182    167    182    176    165    189    284    243    243
     256     142    131    142    136    131    148    146    128    134
     512     140    131    142    136    131    148    121    113    119
    1024     138    129    140    136    131    146    121    108    113
    2048     140    129    140    136    131    146    128    111    119
    4096     140    129    142    136    131    146    124    111    116
    8192     140    131    140    136    131    146    122    111    117
 #####################################################

     Memory Reading Speed Test 32 Bit Version 4 by Roy Longbottom

               Start of test Tue Feb 10 12:54:25 2015

  Memory   x[m]=x[m]+s*y[m] Int+   x[m]=x[m]+y[m]         x[m]=y[m]
  KBytes    Dble   Sngl  Int32   Dble   Sngl  Int32   Dble   Sngl  Int32
    Used    MB/S   MB/S   MB/S   MB/S   MB/S   MB/S   MB/S   MB/S   MB/S

       8    1024   1333   1142   2133   1406   1523   2666   1666   1523
      16    1023   1306   1185   2133   1406   1523   2461   1641   1523
      32    1023   1185   1094   1777   1333   1333   1939   1454   1422
      64     930   1094   1067   1662   1142   1230   1422   1333   1333
     128     930   1067    985   1524   1094   1142   1142   1333   1333
     256     930   1016    986   1525   1094   1186   1142   1454   1334
     512     538    639    568    682    682    639    986    728    728
    1024     393    512    393    465    512    445    891    496    537
    2048     310    445    320    353    445    341    895    460    496
    4096     310    445    310    353    445    330    904    511    465
    8192     297    427    307    338    446    338    906    491    491

SYSTEM INFORMATION

From File /proc/cpuinfo
processor	: 0
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 1
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 2
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 3
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 57.60
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

Whetstone

##############################################

Whetstone Single Precision C Benchmark  Opt 3 32 Bit, Thu Feb  5 11:12:19 2015


Loop content                   Result              MFLOPS      MOPS   Seconds

N1 floating point      -1.12475013732910156        97.087               0.053
N2 floating point      -1.12274742126464844       100.053               0.360
N3 if then else         1.00000000000000000                 693.450     0.040
N4 fixed point         12.00000000000000000                 422.100     0.200
N5 sin,cos etc.         0.49911010265350342                   5.822     3.830
N6 floating point       0.99999982118606567        85.035               1.700
N7 assignments          3.00000000000000000                 550.293     0.090
N8 exp,sqrt etc.        0.75110864639282227                   2.694     3.700

MWIPS                                             268.726               9.973
##############################################

Whetstone Single Precision C Benchmark  Opt 3 32 Bit, Tue Feb 10 12:57:53 2015


Loop content                   Result              MFLOPS      MOPS   Seconds

N1 floating point      -1.12475013732910156       247.727               0.041
N2 floating point      -1.12274742126464844       263.324               0.270
N3 if then else         1.00000000000000000                1368.787     0.040
N4 fixed point         12.00000000000000000                1110.900     0.150
N5 sin,cos etc.         0.49911010265350342                  10.259     4.290
N6 floating point       0.99999982118606567       224.679               1.270
N7 assignments          3.00000000000000000                 888.720     0.110
N8 exp,sqrt etc.        0.75110864639282227                   5.165     3.810

MWIPS                                             530.007               9.981
SYSTEM INFORMATION

From File /proc/cpuinfo
processor	: 0
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 1
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 2
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 3
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

I have ommited system information for tests after the first one for the old model, but not for Model 2. The first difference you can find is the four cores in model B, with an A7 architecture. In the original RPi, the cpuinfo declares 2 BogoMIPS, while in the new one each one is displayed with 57.60 BogoMIPS and sometimes less, 38.40. It has to be due to the frequency, that can vary between 600 and 900MHz. Maybe I shoud repeat the tests forcing 900MHz to optimize for performance. That’s why I left system information, so bogomips can be found for each test.
As can be seen, results are much better for the new model (2-3 times faster, depending on the test), and must be taken into account that the code has been compiled for A6 architecture, and that the tests are designed for one core, so the difference has to be due to the frequency, the new architecture and the improved bus and memory speed (3-4 times faster).

Please leave any comment if you have any additional data or interpretation. Further study and analysis of results are needed, of course.

Python / Cython / Java / Go / Rust

I’m in love with Python. At first I had to use it because I had to make and maintain some Subversion hooks, and hated its indentations, that reminded me of Fortran.

Some years ago I rediscovered it, and I love it as a programming language, it is a language you can have fun programming with, powerful, logical and complete. And it is open source. Recently I discovered Django, and it has become my web framework of choice.

But this Python has a problem. It is not fast as a rattle snake, but slow as a snail. As you may know, Python is interpreted. Unlike C or C++, you cannot compile a machine code executable that the CPU can run directly. The interpreter takes the source file and generates a “*.pyc” byte-code file that is then read for execution. It is a step further than simply interpreting the source code, like BASIC, but it is not real machine code compilation. There are other languages, like Java, that use the same technique.

So let’s do something to accelerate a language we love. Can we compile Python? We have “Cython”, a tool we can use to generate machine code from a Python source code.  Cool! So we have it! Fast Python code, the panacea. Well, it depends. Let’s have a look.

Let’s take a little piece of code that concatenates strings, in Python:

def test_fun():
 s = ""
 for i in range(100000):
 s = s + "/" + str(i)

def main():
 test_fun()

if __name__ == "__main__": main()

If we execute it with python interpreter:

$ time python test.py
real 0m3.766s
user 0m1.812s
sys 0m1.955s

With cython, a C source can be generated, that you can compile with gcc. Let’s give it a chance:

$ cython -2 --embed test.py
$ gcc -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing -I/usr/include/python2.7 -lpython2.7 -o test test.c
$ time ./test
real 0m6.895s
user 0m3.293s
sys 0m3.552s

Oh, no! Compilation <> acceleration. I’m sure this test is too simple, optimizations can be done and all that, maybe cython is good at some specifical tasks, etc. But as you can see, the time as almost double. Not very promising. C code generated by Cython is not optimized at all. In this particular case, it is pesimized.

If we want fast programs, I’m afraid Python is not the choice. But if you want to program fast, Python is your language.

Let’s try to fall in love with some other languages. Well, I have been a Java programmer for years, and I used to love it. I suspect Java will be faster. Let’s translate that simple program to Java. I don’t want to use StringBuffer, instead I want to do it as clear and simple as it is in my Python example above:

package javatest;

public class Test {
   public static void main(String []args) {
     String s = "";
     for (int i=0;i<100000;i++){
        s = s + "/" + Integer.toString(i);
     }
   }
}

How faster will it be?
time will tell us the truth:

$ time java javatest.Test

real	0m36.517s
user	0m37.533s
sys	0m0.277s

Oh, no! My good old Java is slower than Python for this simple task! What can I do now?
It is not two times slower, but TEN times slower. I’m sure that with StringBuffer we can do something better, maybe another day (or you can give me the answer in the comments below).

I’m afraid I will have to learn a new programming language. No problem, I like it. I have heard of two languages with cool names: Go and Rust

Go is a quite new language by people at Google. It is interpreted, very easy to learn and quite interesting. The translation will be something like this:

package main

import (
            "strconv"
        )

func main() {
   s := ""
   for i := 0; i < 100000; i++ {
        s = s + "/" + strconv.Itoa(i)
   }
}

The mecanism for running Go is similar to that of Python: you generate a byte-code file and run it. So let’s Go:

$ time go run test.go 

real	0m2.789s
user	0m2.363s
sys	0m0.093s

Good! Faster than Python, 1 second below Python’s mark. Very promising.

Our other option for today’s little benchmark is Rust. Rust is compilable, like C.   I am not a Rust expert, so I’m sure my translation below could be improved in many ways. In addition to that, Rust development is very active and the language definition is changing to some degree.

fn main() {

    let mut count: int = 0;
    let mut s = "".to_string();
    let mut count_s = "".to_string();
    let bar = "/".to_string();

    loop {
       count += 1;
       count_s = count.to_string();
       s = s + bar.as_slice() + count_s.as_slice();
       if count == 100000 {
            break;
        }
    }
}
$ rustc test.rs
$ time ./test

real	0m0.038s
user	0m0.037s
sys	0m0.001s

What? 38 milliseconds? Rust is similar to C in performance, and this result was expected. Really good result in terms of performace, and Rust is being developed to be a enjoyable language, at least more than C. I agree that C is THE language if you want to program close to the machine, but Rust can be a good alternative if you want to have fun while programming. You have even some web frameworks for it: nickel and Iron, for example.

Web frameworks for Go are also available, and they are very active. Go will go very far (I didn’t want to make more word plays with the name, I swear, but it is too easy…).

I know this benchmark is a I-do-not-know-what-to do-before-going-to-bed-let’s-do-a-benchmark, not very comprehensive, not very accurate, not scientific at all. Comparing Rust with the rest of the languages is not fair. But it served me to have an overview of these programming languages in terms of performance, and wanted to share it with the community.

In summary:

  • Python: 3.8s
  • Cython compiled: 6.9s
  • Java: 36.5s
  • Go: 2.8s
  • Rust: 38ms

Linux on AIRIS Kira N7000

Yesterday I installed Linux (a distribution called Kirbian, excellent job by these guys: http://kirbian.wordpress.com, thanks!!! ) on a AIRIS Kira N7000, an arm based netbook.

Just to help anyone who wants to do the same, I managed to make Wikidpad work on this device. The original wxPython library did not work in this hardware, it threw an “illegal instruction” exception, but after compiling the library on the device, it worked perfectly. Even with 256MB of RAM, it is perfectly suitable for my purposes.

I would like to have Dropbox in the device, but there is still no dropbox for arm. If you are a dropbox user, you can vote for this development in: https://www.dropbox.com/votebox/358/linux-arm-support, as I mentioned in my previous post.

So I installed btsync in both my laptop and kira, and will synchronize Dropbox between them, until there is some arm support from dropbox…

Image