PERF tutorial part 2 now available

Part 2 of a three part tutorial about Linux-tools PERF is now available.

Part 1 of the series shows how to find hot execution spots in an application program. It demonstrates the basic PERF commands using software performance events such as CPU clock ticks and page faults.

Part 2 of the series — just released — introduces hardware performance counters and events. I show how to count hardware events with PERF and how to compute and apply a few basic derived measurements (e.g., instructions per cycle, cache miss rate) for analysis. Part 3 is in development and will show how to use sampling to profile a program and to isolate performance issues in code.

All three parts of the series use the same simple, easy to understand example: matrix multiplication. One version of the matrix multiplication program illustrates the impact of severe performance issues and what to look for in PERF measurements. The issues are mitigated in the second, improved version of the program. PERF measurements for the improved program are presented for comparison.

The test platform is the latest second generation Raspberry Pi 2 running Raspbian Wheezy 3.18.9-v7+. The Raspberry Pi 2 has a 900MHz quad-core ARM Cortex-A7 (ARMv7) processor with 1GByte of primary memory. Although the tutorial series demonstrates PERF on Cortex-A7, the same PERF commands and analytical techniques can be employed on other architectures like x86.

A special note for Raspberry Pi users. The current stable distribution of Raspbian Wheezy — 3.18.7-v7+ February 2015 — does not support PERF hardware events. Full PERF support was enabled in a later, intermediate release and full PERF support should be available in the next stable release of Raspbian Wheezy. In the meantime, Raspberry Pi 2 users may profile their programs using PERF software events as shown in Part 1 of the tutorial. First generation Raspberry Pi users are also restricted to software performance events.

Brave souls may try rpi-update to upgrade to the latest and possibly unstable release. I recommend waiting for the next stable release unless you really, really know what you are doing and are willing to chance an unstable kernel with potentially catastrophic consequences.

RPi2: Work in progress 1

Here’s a quick status update on working with Raspberry Pi gen 2. The installed operating system is Raspbian Wheezy 3.18.7-v7+ built on 16 February 2015.

I’m happy to report that I could profile programs using PERF software events. I’m disappointed to report that PERF does not recognize any hardware (performance counter) events. This distro has Linux-tools-3.2 installed. I uninstalled 3.2 and installed 3.18 which matches the kernel:

sudo apt-get remove Linux-tools-3.2
sudo apt-get install Linux-tools-3.18

Still no joy when attempting to use hardware events. If you want to profile your program using PERF software events, please see my current PERF tutorial about finding execution hot-spots. I tried all of the commands and, with the exception of one typo, everything still works!

I’m in the process of troubleshooting my loadable kernel module for user-space performance counter events. I’ve encountered many of the same old stumbling blocks (e.g., finding the correct headers and Module.symvers file). At the present time, the kernel will attempt to load the module, then die. I cannot tell at this stage if there is a problem in the module itself or if there is a bug in Raspbian Wheezy. In case you want to dive into module development yourself, I’ve started a permanent page for building kernel modules on RPi2.

Once again, after two+ years, I want to make a public plea for more open information about the underlying hardware and for guidance and support for end-user device driver development. Quite frankly, Broadcom plays this situation too close to the chest, especially for a computer that’s advertised as a vehicle for learning and education. The dearth of information is stifling. People still struggle to identify and download essential information (e.g., Module.symvers) for device driver development. This is not true of other major Linux distros and the Raspbian folks really need to take note! Broadcom, in particular, runs the risk of killing off the goose laying the golden eggs.

Before signing off, here is a quick PERF command cheat sheet. I recommend reading the tutorial, but if you really must peck away at the keyboard… All the best!

perf help
perf list
perf stat -e cpu-clock ./program
perf record -e cpu-clock ./program
perf record -e cpu-clock,faults .program
perf report
perf report --stdio --sort comm,dso --header
perf report --stdio --dsos=program,libc-2.13.so
perf annotate --stdio --dsos=program --symbol=function
perf annotate --stdio --dsos=program --symbol=function --no-source
perf record -e cpu-clock --freq=8000 ./program
perf evlist -F

Replace “program” with the name of your application program and replace “function” with the name of a function in your program.

Second generation RPi is here

The second generation Raspberry Pi (RPi2) is now shipping in large quantities! Given the excitement on the Web, this machine should be at least as popular as its first generation parents. Although the RPi2 model B has the same overall form factor as the first generation model B+, the designers made two substantial improvements which make the RPi2 a contender for your desktop:

  1. The single core Broadcom BCM2835 is replaced by the quad core BCM2836.
  2. Primary memory is increased to 1GByte of LPDDR2 RAM.

That’s just the face of it. Not only does the BCM2836 have four processor cores instead of one core, the cores are based on the ARMv7 architecture (Coretx-A7) including the NEON single instruction, multiple data (SIMD) instructions. The clock frequency is increased to 900MHz (from 700MHz). I’ve already begun to explore the ARMv7 micro-architecture and plan to write up a short, concise summary of its performance-related characteristics.

The BCM2836 has a different memory controller. Primary memory is no longer implemented using the Package on Package (PoP) approach. The Elpida (Micron) B8132C4PB-8D-F memory chip is mounted on the bottom of the RPi2 board (instead of the PoP piggyback).

The RPi2 sold out at Sparkfun almost immediately. Fortunately, Canakit, Element14 and Microcenter have received shipments, too. Amazon advertised the Canakit Raspberry Pi 2 Ultimate Starter Kit at a very attractive price and I immediately bought a kit. Microcenter in Cambridge had a mound of RPi2s and impatience took the best of me — I bought one. Yes, after getting the mail, I now have two.

I copied the latest Raspbian Wheezy release (16 February 2015) to a 16MByte microSD card using Win32DiskImager. The Canakit ships with NOOBS on an 8GByte card and I hope to try and report about NOOBS later. There was a little drama while bringing up Raspbian Wheezy as some relatively small, but annoying problems did crop up. Once I got past the sand traps, the new RPi2 proved to be an able performer.

Today, I copied my test software over to the RPi2. Here is a quick comparison between the older RPi model B and the new RPi2.

Platform Naïve MM Interchange MM
RPi model B gen 1 18.67 sec 6.75 sec
RPi gen 2 3.15 sec 2.42 sec

The two test cases are the naïve matrix multiplication program and the loop nest interchange matrix multiplication program. (Get the code in the source section of the web site.) Yes, that is a 6x improvement in performance for the naïve case. It’ll be fun to explore and find the reasons behind the speed-up. Fast matrix multiplication depends upon memory bandwidth and there must be some significant improvements in the memory subsystem. Naïve matrix multiplication incurs a lot of translation lookaside buffer (TLB) misses, so improvements in TLB miss handling could also contribute to the speed-up in the naïve test case.

I ditched the Epiphany Web browser as it seems to have significant bugs. The browser crashed repeatedly when loading the New York Times front page. This is unacceptable. I installed Midori, which came with the initial release of Raspbian Wheezy. The New York Times front page is a bit of a torture test. Midori loaded the page in less time than the RPi gen 1, but still felt slow and logy. I suspect that many applications will need to be compiled for ARMv7 before we end-users get the full benefit of the BCM2836. The initial result, however, is encouraging.

Well, I’ve started to reorganize the site’s menu structure in order to get ready for new content about the RPi2. I intend to retain the older articles as they remain quite relevant. More to come!

Make music with MMS on a PSR

Yamaha Mobile Music Sequencer includes features for Motif, MOX and Tyros5, but did you know that you can create music using MMS on your PSR arranger? Yes, you can!

I’m using MMS with both the Yamaha PSR-E443 and PSR-S950 and I have written up a tutorial on making music with MMS on PSR/Tyros. This article concentrates on set-up, MIDI voice selection and MIDI file export which are aspects not covered by the MMS manual. The tutorial complements the many on-line videos that demonstrate composition and mix down. In particular, I show how to use the full 128 voice General MIDI voice set in the PSR, thereby expanding your sonic palette beyond the limited range of voices built into MMS.

Enjoy and keep on keepin’ on!

Scat voice expansion pack

I’m pleased to release version 1 of my jazz scat voice expansion pack for Yamaha PSR-S950 and PSR-S750 arranger workstations. The expansion pack has five PSR voices which let you create “Take 6” style, a cappella arrangements and other kinds of jazz voice performances. Give the MP3 demo a try!

Four of the PSR voices are individual syllables: DOO, DOT, BOP and DOW. The DOO syllable is looped and let’s you create sustained chords for backing. The DOT, BOP and DOW syllables are short and provide scat-like expression. All four syllables are combined into a velocity-switched voice where you select and play one of the syllables based on how hard you strike the keys (i.e., MIDI note velocity). You will need to adjust touch response (and practice!) to get the most playable and musical result.

Here is a link to the expansion pack file. You need to download and UNZIP this file, then install the YEP file by following the directions in the Yamaha PSR-S950/PSR-S750 Owner’s Manual. See the section titled “Expanding Voices”.

I am also releasing the multi-samples that I used to create the expansion pack in case you would like to create a scat voice for your own synthesizer or software instrument. If you are curious about how I created the expansion pack voices and the samples, please see this blog post.

Both the scat voice expansion pack and the scat voice samples are released under a Creative Commons Attribution 4.0 International License.

Creative Commons License
ScatVoices and ScatVoice samples by Paul J. Drongowski are licensed under a Creative Commons Attribution 4.0 International License.

You are free to use the expansion pack voice or samples (even for commercial purposes) as long as you provide a link to http://sandsoftwaresound.net from your own web site AND/OR explicitly credit me in your creative work, e.g., “Scat samples/voice by Paul J. Drongowski”.

Sampling “scat”

In this post, I describe the process and tools that I used to capture samples for my jazz scat voice. I will eventually release the voice (for the Yamaha PSR-S950 workstation) and its samples under the Creative Commons attribution license. I’m not the best singer, so I’ve had to rely on technology as much as possible while still producing a musical result. I want to emphasize that I sang, edited and produced all of the samples and the voice patch; it is original work.

The jazz scat voice is inspired by the (in)famous “jazz voice” patch found in Roland keyboards. The Roland patch is based on samples from the Spectrasonics Vocal Planet library by Eric Persing and Robby Duke. Their work was clearly influenced by Take 6 and other contemporary a cappella artists.

My patch uses four multi-samples where each multi-sample is a particular syllable taken over 12 (or so) pitches. The multi-samples cover the natural range of the human voice from F3 to F6 where C5 is middle C. The four syllables are: DOO, DOT, BOP and DOW. The DOOs are long, looped samples that provide a musical bed or harmony. The remaining three samples are short one shots suitable for melody, punctuation and accents. The DOW syllable falls.

The basic patch design is summarized in the following table.

Syllable Type Vel low Vel high Gain
DOO Loop 1 89 0 dB
DOT One shot 90 105 -3 dB
BOP One shot 106 119 -6 dB
DOW One shot 120 127 -9 dB

The table shows the MIDI velocity range to each syllable (multi-sample). It also shows the relative gain for each syllable. The gain decreases as velocity increases in order to maintain a more consistent volume level as the keys are struck harder to trigger the one shots.

At a strategic level, the sampling production process consists of two major steps:

  1. Capture a natural voice sample for each syllable and pitch. These natural voice samples are the formants to be used in the next step.
  2. Capture a vocoded sample for each syllable and pitch while playing the appropriate formant sample through the PSR-S950 vocoder.

This process produces scat syllable sounds that are consistent, pitch accurate and in the case of the DOO syllable, loopable.

Here’s a run-down of the practical problems that motivated this approach. My voice is an untrained baritone. It cannot possibly cover the F3 to F6 range without hysterical noise and possible voice damage. As I discovered, it is nearly impossible to sing pitch accurate short syllables such as these without proper training! I needed to find a method that would give me a consistent and pitch accurate sound across the desired range of pitches. This is a greater challenge than I originally anticipated and a lot of experimentation led to the two-step method. It took about 3 weeks to find the method and then a further two weeks of production work.

Now, the details.

I used a Roland Micro-BR digital recorder to capture both natural voice and vocoded samples. This little wonder is great — easy to use, fast and above all, quiet. For natural voice, I sang into a Shure PG-81 condenser microphone feeding an ART TUBE MP preamp. The TUBE MP is a really Swiss army knife providing phantom power for the PG81, a little bit of tube warmth, and conversion from XLR to a line level audio signal. The output of the TUBE MP is connected to the Micro-BR. For vocoded voice, I connected the line level mono output of the PSR-S950 to the Micro-BR. In both cases, all Micro-BR input effects are disabled and gain staging is established before hitting the RECORD button.

Formants are captured and produced in the following way. I sang each syllable multiple times at each of the desired pitches while recording to the Micro-BR. The pitches cover the F3 to F6 range such that no resulting final sample would be transposed up more than one semi-tone and/or down two semi-tones. Transposing up or down more than these limits negatively affect sound quality (obvious sample speed-up/slow-down). The entire sampling session is converted to WAV format and then transferred to a PC where Sony Sound Forge Audio Studio is used to review the sung syllables and to select the best one at each pitch. Each selected syllable is saved in its own WAV file. The selected syllables are tuned with Celemony Melodyne. The tuned syllables are the formants for the vocoding phase.

Sony Sound Forge is a solid audio editor. I can work fast in Sound Forge and its “Copy new” function is ideal for cherry picking a recording session. In a few cases, I had to amplify a sample to compensate for low level. When singing across such a wide range of pitches, one needs to rely on electronics/software for amplification in order to avoid voice strain! For tuning, I used the trial version of Celemony Melodyne Single Track which installed with Sonar X3. Although the procedure to enable the trial period was wonky, Melodyne is a great tool and I will very likely buy a copy.

In the second major production step, the formant syllables are sent to the PSR-S950 vocoder and vocoded syllables are recorded on the Micro-BR. The S950 vocoder is not a true synth vocoder. (The Motif/MOX and Tyros vocoders are true “synth” vocoders.) The S950 vocoder is part of its vocal harmony proceesor. Its “VocoderMONO” mode is designed to let (untrained) voices sing into a microphone and impose the formants onto a rather natural sounding, pitch accurate synthetic voice sound.

My early investigation found that the PSR-S950 vocoder needs clean formants that are near the desired final pitch. By clean, I mean formants that do not overdrive the vocoder input and are relatively free of the (un)natural gurgles and what not in the sounds made by the human vocal system. (Well, my vocal system anyway.) The first major step in the overall process let me select the cleanest formants. However, attempts to sing outside one’s natural vocal range introduce gurgles and rasps at the low end and off-pitch histrionics and screeches at the high end. The first major process step choses the cleanest formants and tunes them to the desired pitches.

I loaded the formant samples into a Roland RD-300GX piano as an Audio Key set. Each formant sample is assigned to a particular key and is played by the RD-300GX when the key is struck. Basically, this arrangement gives me a simple one-shot playback engine. The output of the RD-300GX is connected to the microphone/line input of the PSR-S950 in order to drive the vocoder. The mono output of the PSR-S950 is connected to the Micro-BR.

Once everything is connected and levels are set, a little trial and error is needed to find the best formant at each desired vocoder pitch. Think of this as a dry rehearsal for the final recording. Frequently, the formant at the same desired vocoder pitch is the best choice for the vocoded sample. However, sometimes one of the nearby formants is better or produces a more consistent timbre or articulation across the multi-sample. This involves a lot of critical listening and A/B comparison, producing a list of formant and pitch pairs.

Then, it’s time to hit RECORD and capture the vocoded samples by playing the desired pitch on the S950 keyboard and playing the corresponding desired formant on the RD-300GX. Once again, the recording session is converted to WAV format, is transferred to the PC, and is separated into individual WAV files.

At this point, the DOT, BOP and DOW one shot samples are pretty much complete. The DOO samples need to be looped. For some zany reason, Sony Sound Forge Audio Studio saves loop points in Acid METADATA within a WAV file. The Yamaha voice editor does not pick up this information. After searching the Web, I discovered that loop info within a WAV file is not really standardized. Given that the target tool is from Yamaha, I decided to use Yamaha’s Tiny Wave Editor (TWE) to loop the vocoded DOW samples. This worked out pretty well as TWE’s crossfade looping eliminated some bad thumps without introducing artifacts. A lot of trial and error was still involved in choosing the loop points, however. TWE can be found for free on the Web, by the way.

The final production step is to bring all of the vocoded samples into the Yamaha Expansion Voice Editor (EVE) and produce the final voice as part of an S750/S950 expansion pack. I made five voice patches:

  1. DooLoops: DOO syllables over MIDI velocities 1 to 127
  2. GetLayeredUp: All syllables, velocity-switched
  3. DatStuff: DOT syllables over MIDI velocities 1 to 127
  4. BopOnPop: BOP syllables over MIDI velocities 1 to 127
  5. Dow2008: DOW syllables over MIDI velocities 1 to 127

The multi-samples are most easily tested and normalized individually. Plus, the DOO loops and other syllables are musically useful by themselves without velocity switching. I built the GetLayeredUp patch after testing the individual multi-samples and normalizing the volumes of the individual samples within. Choosing the patch names was really fun! (Apologizes to George Clinton.)

The Yamaha Expansion Voice Editor is a trial version for which the trial period was, ahem, adjusted. Yamaha needs to just face facts and release an official version of EVE. Zillions of S750/S950 people are already using EVE and if Yamaha is somehow trying to protect its expansion pack franchise, well, that train done left the station a looooooooooong time ago. At this point, an official EVE would enhance the PSR product ecosystem and sales.

EVE does not implement velocity levels/switching. I used V. Muller’s version of the OLE Toy binary editor to set the element velocity ranges in the GetLayeredUp patch. Thank you, V. A huge amount of effort went into the analysis of YEP files and Python coding and he deserves all of the credit.

Thanks to vocoding, the final samples have a consistent sound. They are a little bit plain Jane by themselves, however. I gave each patch a little bit of reverb (reverb send level 20). I also added the “Ensemble Detune 2” DSP effect (send level 64). This is a truly spiffy effect — a chorus without modulation that gives the impression of an ensemble of slightly detuned voices. It is exactly the kind of gloss that the scat voices need.

Although the velocity ranges in GetLayeredUp are reasonable, users should still expect to tweak the keyboard velocity sensitivity and touch response to their personal needs. For example, I need to play GetLayeredUp on the softest touch setting. Your mileage will definitely vary!

Please stay tuned for the initial release of the expansion pack and multi-samples.

Vocaloid is not just for anime!

As I mentioned in my last post, I’m developing a new sample-based voice for the Yamaha PSR-S750/S950 arranger workstations. Roland is famous for its “jazz scat” voice which uses velocity-switching to trigger syllables like DOO, DAT, BOP and DOW at pitch. This synth voice is good for a cappella-like arrangements (think “Take 6”) or free melody lines. It’s a real boon for those of us with weak natural voices and technique.

The Roland scat voice incorporates samples from the Spectrasonics Vocal Planet library produced by Eric Persing and Roby Duke. Although these are great sounds/samples, I want to distribute both the workstation voice (as an expansion pack) and the samples within. I intend to make my work available under a Creative Commons attribution license. Thus, I want and need to produce fully original samples in order to avoid copyright and licensing issues.

The quest

These goals and desires launched a month-long quest for suitable “scat” samples. I decided to base the scat voice on the four syllables DOO, DOT, BOP and DOW where the DOOs are looped and the other syllables are one-shots. The DOOs are triggered at relatively low velocity and provide a pad-like bed while the DOTs, BOPs and DOWs provide short staccato accents/melody. The voice implementation requires a set of multi-samples for each syllable where the multi-samples are spread across the natural range of the human voice (F3 to F6 where C5 is middle C).

Freesound.org has a few individual sounds, but nothing in the way of multi-samples across a range of pitches. I next decided to try sampling my own voice. A few tentative attempts left me highly discouraged! I’m a baritone with a relatively small range — definitely not F3 to F6! Plus, I lack training and my technique is not particularly good.

I then began to experiment with vocoding. I was hoping to achieve loopable, pitch-accurate samples by using my voice as a formant and imposing my voice on a pitch accurate synth sound (the carrier). I experimented with the vocoders in the PSR-S950 and the Yamaha MOX6 workstation. The MOX6 vocoder is great at producing dance-floor sounds, but not so good at producing more natural vocal sounds suitable for jazz.

Not to be too cagey, I eventually found good use for the S950 vocoder and will describe this process in a separate post. Before I went in that direction, however, I discovered and tried Yamaha’s Vocaloid.

Vocaloid

Here is how Yamaha describes Vocaloid.

Vocaloid is a technology for singing voice synthesis developed by Yamaha, and the name of this software application. The software allows users to input melody and lyrics in order to synthesize singing. In other words, with this technology, singing can be produced without a singer. Singing voice synthesis is produced by using fragments of voices recorded from actual singers, called the Singer Library.

To a user, Vocaloid consists of two parts: the Vocaloid editor and one or more libraries. Generally, Yamaha does not provide the libraries and prefers to license the Vocaloid technology to third parties (like Zero-G) who develop libraries using their own artists.

Vocaloid has an active and enthusiastic on-line community among anime enthusiasts. There are Japanese and English singer libraries for various anime characters or personas. These singers are not appropriate for jazz! Fortunately, there are a few singer libraries for pop and classical vocals.

Mini-review

Vocaloid is not inexpensive. The full Vocaloid version 3 editor is about $160USD and individual Vocaloid 3 singer libraries are $150USD. Thus, it’s hard to take a casual drive by the latest Vocaloid technology and give it a try. Vocaloid 4 has just been announced along with Cyber Diva. Pricing, unfortunately, has not budged.

Luckily, Zero-G has a fire sale on a few individual Vocaloid 2 libraries which include the version 2 editor. I bought the Zero-G Tonio library for $50USD. This is a much smaller amount to gamble in order to get a taste.

Tonio is an opera singer. The Tonio demo is very good (it’s opera!) and after messing with Vocaloid and Tonio, someone sank a lot of work into that demo! You can get very nice results from Vocaloid if you are willing to spend countless hours tweezing a performance. I recommend the on-line Vocaloid reviews at Sound on Sound Magazine. The reviews are right on the money and provide useful information to help get you started with Vocaloid. (SOS is great that way.)

To make a long story very short, you edit the vocal performance in the editor by entering lyrics into a piano roll editor. You then change the attack, vibrato and other aspects of the vocal performance. These tweaks are essential for getting a good result.

Ultimately, Tonio is an opera singer and his vocal characteristics are a distinct part of the vocal samples that underlie the singer library. There ain’t no way to turn this nice Italian boy out and make him sing pop! He isn’t Bruno Mars. Please keep this in mind if you decide to try Vocaloid in a project of your own. Make sure that the voice library is a simpatico match with the target genre/style. This is why I moved on from Tonio and Vocaloid for the scat voice project.

The technology

Yamaha has invested heavily in the Vocaloid technology and have filed many patents. They are conducting joint research with The Music Technology Group (MTG) of the Universitat Pompeu Fabra in Barcelona. The MTG, by the way, are the people behind the Freesound.org web site.

Vocaloid does a lot of intense digital signal processing (DSP). It modifies and concatenates sound in the frequency domain. It performs a Fast Fourier Transform (FFT) to convert from the time domain to the frequency domain, modifies the spectral characteristics of the sound, and then performs an inverse FFT to return to the time domain. This is too much computation to perform in real-time. Thus, there is always a delay while Vocaloid renders a performance before playback.

Yamaha protects its intellectual property (IP) through patents and rarely publishes results in the scientific literature. Vocaloid is an exception, probably due to the partnership with MTG. Here is a short list of a few papers on Vocaloid and its technology.

  • Singing synthesis as a new musical instrument, Hideki Kenmochi, IEEE International Conference on Acoustics, Speech and Signal Processing, 2012 (ICASSP 2012).
  • Sample-based singing voice synthesizer by spectral concatenation, Jordi Bonada and Alex Loscos, Proceedings of the Stockholm Music Acoustics Conference, August 6-9, 2003 (SMAC 03).
  • VOCALOID – Commercial singing synthesizer based on sample concatenation, Hideki Kenmochi and Hayato Ohshita, International Speech Communication Association (ISCA), Interspeech 2007.

You don’t need to know all of this to use Vocaloid, but it’s good to know that there is cutting edge science behind the product.

I strongly recommend the developer interview with Michael Wilson which is published at the Vocaloid US web site. The interview gives insight into the incredible amount of work and detail behind the development of the latest library, Cyber Diva. This interview is extremely informative. Thanks, Michael. Articles such as this one bridge the gap between vacuous press releases and scientific papers giving everyone a greater appreciation for the technology behind a product.

It is also the best case to be made against software piracy. Innovation, research and development is fueled by money. Cheat developers out of their just payment only if you wish to kill off future innovation!

The Vocaloid technology reminds me a little bit of Super Articulation 2 (SArt2) on Tyros. SArt2 concatenates tones together to product realistic articulations such as legato and glissando. SArt2 works in the time domain and computes in real time although latency remains a very practical concern. (There are patents.) Perhaps someday when sufficient parallel processing resources are inexpensive, there will be an SArt3 that computes in the frequency domain.

A dive into some old Roland gear

I haven’t taken a deep dive into any gear lately and my ears need a break! So, here goes.

The Web is a wonderful source of distractions. After discovering the new Roland Sound Canvas app for iPad, I was searching for some information about the later model Sound Canvas modules and came across the Roland Service Notes for the XP-80 workstation, the XV-1010 module, and the SK-88Pro Sound Canvas. I still have these instruments in my sonic arsenal although they don’t see as much day-to-day use anymore. The orchestral sounds, in particular, hold their own today and I occasionally play the XP-60 at my church gig. Some of the sounds like the Voice expansion board (taken from Vocal Planet) are unique and stellar.

Roland have their “Service Notes” and Yamaha have their “Service Manuals.” To each his own name. However, keep these terms in mind when searching the Web for documentation on the innards.

As you might expect, there are similarities to Yamaha’s approach and some differences. These instruments are embedded computer systems for Pete’s sake — they just happen to make joyful noise. These instruments were developed in the late ’90s and early 2000s.

Roland — like Yamaha — drew from the Hitachi (now Renesas) processor families. The XP and XV use the more powerful SH-1 series CPUs while the SK uses the less powerful H8/510.

All of instruments have a custom tone generation chip. Roland’s naming convention for the tone generator ICs does not suggest how these chips fit into a family although the “XP” mnemonic is used throughout. The tone generators each have a dedicated RAM for effects processing similar to the Yamaha SWP51 series. The tone generators have a dedicated wave memory interface. The Yamaha SWP51 supports two 16-bit channels while the Roland tone generators have a single 16-bit data channel. I’m just know starting to appreciate how tone generation is a bandwidth-sensitive application and the single vs. double channel difference may be functionally significant. Certainly, the Yamaha approach requires many more pins, but it supports higher bandwidth. More polyphony? More voice elements? Hmmm.

Since these are older instruments, the wave memory size is not about to knock you out. However, this is an important reminder that wave memory size isn’t everything. Roland developed and programmed very good sound sets for these instruments. The wave memory may seem miniscule in the era of multi-gigabyte sample libraries, but it’s what hits the ears which matters the most.

Here are the details — straight, no chaser. Speaking of which, I’m knee deep in the development of a scat vocal voice for the PSR-S950. This project has taken a month so far and I’m only about 90% finished. Stay tuned.

Roland XP-80

Following is a list of the most relevant bits of sand in the Roland XP-80 workstation:

IC5     XP         Unidentified      Custom tone generator

IC12    SH CPU     HD6437034SC66F    Hitachi SH7034 Superh RISC engine
IC36    WAVEROM B  LHMN5PNA          4MByte WAVE ROM for tone generator
IC37    WAVEROM A  LHMN5PN9          4MByte WAVE ROM for tone generator
IC10    MASK ROM   TC5316200CF       MASK ROM on system bus (data+code)

IC17    SRAM       HM62864LFP-7SLZ   SRAM on CPU system bus
IC19    SRAM       HY6264ALJ-70TE2   DRAM for LCD controller
IC14,15 DRAM       LH64256BK-70      EFX DRAM for tone generator
IC21,22 DRAM       HM514800CJ-80     DRAM on CPU system bus

IC39,41 DAC        PCM69AU-1/T2      24-bit DAC

The SH7034 is a 32-bit RISC engine (SH-1 architecture) with peripheral interface logic integrated onto the chip. The SH7034 chip also has a 64KByte ROM/EPROM and a 4KByte RAM. The CPU has 32-bit datapaths, sixteen 32-bit general registers and a five stage pipeline. It has a multiply and accumulate (MAC) unit.

The XP tone generator (TG) is not explicitly identified in the parts list. It is merely labeled “XP” in the circuit schematic. The tone generator interface to the WAVE ROM has 23 address bits and is 16-bit data parallel. The WAVE ROMs provide data as 16-bit words. Each ROM has 21 address bits and the 16-bit data bus is shared between all ROMs. Each ROM is 4MBytes for 8MBytes total WAVE ROM. This checks with Roland marketing literature.

The Burr Brown PCM69AU is a dual 18-bit DAC capable of 16x oversampling. This part was also manufactured by Texas Instruments.

Roland XV-1010

The XV-1010 is a one expansion slot sound module in the JV/XV family. The XV-1010 has the basic XP sound set plus the “Session” expansion sounds — essentially a built-in SRJV expansion board. The XV-1010 does not have much of a user interface and not much is required in terms of processor power to support it.

Here is a table of the main ingredients in the XV-1010:

IC1    CPU            HD6437016F28
IC2    SRAM           TC551001CF-70L      RAM on CPU system bus
IC3    XP6            RA09-002            Custom tone generator
IC4    DRAM           MN414260DSJ-06T1    DRAM on CPU system bus
IC5    DRAM           MN414260DSJ-06T1    Tone generator effect DRAM
IC6    WAVE ROM A     LHMN0PVW            8MByte WAVE ROM
IC7    WAVE ROM B     LHMN0PU5            8MByte WAVE ROM
IC14   FLASH MEMORY   LH28F160S5T-L70     FLASH memory on CPU system bus
IC26   DAC            AK4324-VF-E2        DAC driven by tone generator

The Hitachi SH7016 is another member of the SH-1 RISC processor family. Peripheral interface logic is integrated onto the chip making it ideal for embedded applications (like a synthesizer). The CPU has 32-bit datapaths, sixteen 32-bit general registers, and a five stage pipeline. The CPU has a multiply-accumulate (MAC) unit. The SH7016 has 64 KBytes of mask ROM and 2 KBytes of RAM (when the 1KB cache is enabled).

The tone generator IC wave memory interface has 23 address bits and a 16-bit data bus. Each WAVE ROM has 22 address bits and they share the 16-bit data bus. The basic XP sound set is stored in an 8MByte ROM and the Session sound set is store in an 8MByte ROM for a total of 16MBytes of wave memory.

The EXP-B SLOT has 21 address bits and an 8-bit data bus. The narrow data bus is probably a legacy artifact from the earlier JV-series instruments.

The Asahi Kasei (AKM) AK4324 is a 1-bit, 128x oversampling stereo DAC with
a maximum 96KHz sample rate. It includes a 24-bit digital filter.

Roland SK-88Pro

The SK-88Pro is an SC-88 Sound Canvas built into a 3 octave MIDI controller with the Roland two-way pitch bend/modulation stick. The SK has two MIDI IN ports with 16 channels each. The controller is built like a tank and is almost as rugged as made-of-metal Roland workstations. I would not trade this thing for any of the toy-like controllers on the market today!

Here is a table listing the important integrated circuits:

IC1     CPU              HD6415108F          H8/510 microcontroller
IC3     XP               RA01-005            Custom tone generator
IC4     CUSTOM DSP       MB87837PF-G-BND     Unique to the Sound Canvas?

IC8     PROGRAM ROM      LH538U29            Main program and data
IC17    WAVE ROM         UPD23C32000AGX-314  4MByte WAVE memory
IC13    WAVE MASK ROM    LHMN0PNM AB         4MByte WAVE memory
IC15    WAVE MASK ROM    LHMN0PNN CD         4MByte WAVE memory
IC12    DSP RAM          NN514260J-60        256K x 16-bit word memory

IC50,51 DAC              UPD63200GS-E2       DAC for each channel

IC5     SUB CPU          M38881M2-152GP      Handles MIDI input/output
IC7     SUB PROG ROM     LH5S4H0B            Program and data ROM

The Hitachi H8/510 microcontroller family uses a 16-bit CPU core. The H8 has 16-bit datapaths, eight 16-bit general registers and a maximum speed of 10MHz. The H8/510 has integrated peripheral logic and is designed for embedded applications.

The SUB CPU handles MIDI input and output nothing more, nothing less. This is different than Yamaha’s SUB CPU which does heavy lifting.

The custom DSP IC communicates with the XP tone generator. The custom DSP has a dedicated 256K x 16-bit word DRAM. The tone generator has a dedicated 256K x 16-bit word DRAM for effects processing.

The XP tone generator has three WAVE ROM ICs: IC13, IC15 and IC17. The three WAVE ROMs have 21 address bits each and share a 16-bit data bus. The tone generator drives 22 address bits; the least signficiant bit, WA0, is not connected. Address bits WA[1:22] are sent to the WAVE ROMs. The high order bit, WA22, appears to function as a (ROM) chip select. This implies 12MByte of WAVE ROM total.

Send MIDI from USB-B to 5-pin

Please see the bottom of this page for an update.

Way back in January 2014, I outlined a way to send MIDI from a USB-B only controller to a keyboard or module with classic 5-pin MIDI using Raspberry Pi as a bridge. Finally, one year later, I got to try out this idea.

It seems like MIDI over USB has taken over the MIDI controller world!

New controllers now communicate MIDI data over USB instead of using the old 5-pin DIN interface. 5-pin MIDI is dirt simple and is just a faster form of plain old serial communication — no bus protocol, no host/client, no hassles.

The world was 5-pin MIDI for a long time and many classic synthesizers and workstations only have a 5-pin DIN interface. Most of the new controllers have only a USB-B device port and expect to be connected to a USB-A host port for power and communication. If you want to use your new controller with an old 5-pin MIDI synth, you have a communication gap to bridge. Because USB is a peripheral bus with a sophisticated protocol, USB cannot be directly connected/converted to simple 5-pin MIDI signals.

There are two ways to bridge the gap:

  1. Buy a bridge box like the Kenton MIDI USB Host (about $115USD) or iConnectivity iConnectMIDI4+ ($200USD).
  2. Use a PC-based DAW to bridge 5-pin MIDI ports and USB MIDI ports.

Both solutions involve software, a computer, a 5-pin MIDI IN/OUT interface, and a USB-A Host interface. The old synth (or whatever) is connected to the computer through the 5-pin MIDI IN/OUT interface and the controller is connected to the USB-A Host port. The software streams the MIDI data between the 5-pin and USB worlds.

The Kenton is portable, but is a little bit pricey for my taste. Also, the Kenton is not readily available in all parts of the world (e.g., the USA) and shipping is expensive. The PC-based bridge is not so portable and maybe you don’t want to take a laptop to the gig.

Hmmm, let’s see. Computer? USB Host interface? Software? Raspberry Pi!

The Rapsberry Pi B+ would be the ideal model with its four USB Host (A) ports. From the hardware perspective, here’s what we need to do:

  • Connect the USB MIDI controller to one of the Raspberry Pi USB-A Host ports.
  • Connect a bog standard 5-pin MIDI to USB-A interface to one of the other USB Host ports.
  • Connect the 5-pin MIDI IN/OUT ports on the interface to the appropriate 5-pin MIDI ports on the old synth.

This is exactly how we would connect the controller and synth if we used the PC and the DAW except we have replaced the PC with the Raspberry Pi (much smaller and only $40USD).

For software, the Raspbian Linux operating system comes with ALSA audio and MIDI support. We need to use the ALSA aconnect utility to identify the incoming and outgoing MIDI ports and to connect the appropriate ports.

I wanted to try this approach without buying any new hardware. Unfortunately, my Raspberry Pi is the earlier model B with only two USB-A Host ports. I need at least one more port to connect a keyboard and mouse, so a hub has to enter the picture somewhere. I found that the ALSA software did not recognize the controller or MIDI interface through my cheapo non-powered USB hub. Please keep this possible limitation in mind during your own experiments.

Here’s my test set-up. The keyboard controller is an M-Audio Keystation Mini 32. I used an Apple keyboard and mouse for regular user I/O. The Apple keyboard has a built-in hub and adds two USB-A ports. The keyboard is connected to the Raspberry Pi and the mouse is connected to one of the keyboard USB-A ports. The Keystation is connected to the second USB-A port on the Apple keyboard through a USB-A to USB-B cable.

USB-B to 5-pin MIDI connection diagram

The 5-pin MIDI IN/OUT ports are provided by a Roland (Edirol) UM-2ex USB MIDI interface. This interface is connected to one of the Raspberry Pi USB-A Host ports. The UM-2ex has a switch to select either the standard driver or an advanced proprietary driver. Select the standard driver setting. You want to be “class compliant” all the way for best results. Connect the 5-pin MIDI IN/OUT ports to the synth using standard MIDI cables. For this test, the synth is a Yamaha PSR-S950 arranger workstation.

Boot Raspbian and log in. You can either run aconnect from the initial shell or you can start the X Windows systems. For this example, I chose to start X Windows so I could capture output from aconnect.

Type “aconnect -i” to display a list of the readable input ports. These are the ports which provide incoming MIDI data.

$ sudo aconnect -i
client 0: 'System' [type=kernel]
    0 'Timer           '
    1 'Announce        '
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 20: 'UM-2' [type=kernel]
    0 'UM-2 MIDI 1     '
client 24: 'Keystation Mini 32' [type=kernel]
    0 'Keystation Mini 32 MIDI 1'

The “$” charcter in the example output is the shell command prompt. The output shows the UM-2ex MIDI input port (client 20) and the Keystation (client 24). The Keystation input port is the source of the MIDI data that we want to send to the synth.

By the way, sudo is required when entering these commands through X Windows as an ordinary user. Superuser privilege is needed to set up ALSA connections.

Type “aconnect -o” to display a list of the writeable output ports. These are the ports which send outgoing MIDI data.

$ sudo aconnect -o
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 20: 'UM-2' [type=kernel]
    0 'UM-2 MIDI 1     '
    1 'UM-2 MIDI 2     '
client 24: 'Keystation Mini 32' [type=kernel]
    0 'Keystation Mini 32 MIDI 1'

The output shows the two UM-2ex MIDI OUT ports (client 20 ports 0 and 1) and the Keystation (client 24).

Finally, type “aconnect 24:0 20:0” to establish a bridge between the Keystation port and the UM-2ex MIDI OUT port.

sudo aconnect 24:0 20:0

The first port (24:0) on the command line is the sender and the second port (20:0) is the receiver.

Play a few notes on the controller. If the controller and synth are communicating on the same MIDI channel (usually channel 1 by default), then you should hear some sound from the synth — assuming that the volume is turned up and the synth is connected to an amp, and so forth!

Type “aconnect -x” to remove all connections when finished. Individual connections can be removed using the -d option. If you ever need usage information about aconnect, just type “aconnect -h” or “man aconnect”.

Just for fun, I tried using the Yamaha PSR-E443 for input instead of the Keystation. I replaced the Apple keyboard hub with a powered USB hub, too. (Apple keyboards and Linux don’t always interoperate as friends!) The PSR-E443 keyboard sends on MIDI channels 1 (main voice), 2 (dual voice) and 3 (split voice). By assigning these MIDI channels to RIGHT1, RIGHT2 and LEFT on the S950, I could play a layer in the right hand with a split bass in the left hand.

So, there you go! A simple, cheap bridge between a USB MIDI controller and an old school 5-pin MIDI synthesizer. The next step is to find a way to discover and connect MIDI ports through a boot time, start-up script. If you solve this problem, please post the solution!

Update:If you enjoyed this blog post, then you might like these articles, too:

PSR-E443: Snap review

Ah, it’s always fun to post a “first impressions” review of a new toy! In this case, the Yamaha PSR-E443 portable arranger.

I like to use a battery powered keyboard at rehearsals since an all-in-one sets up and tears down without a lot of work. Up to this point, I’ve been playing an old Yamaha PSR-273. The 273 first made the scene in 2003, so it was definitely time for an update.

The PSR-E443 is the top of the entry-level portable keyboards from Yamaha. It has 61 keys and a built-in stereo sound system comprising two woofers and two tweeters. The E443 is powered by either an AC adapter (PA-150) or six AA batteries. So far, I’ve only used an AC adapter and don’t have a feel for battery life. Fortunately, the MOX6 uses the same PS-150 adapter and I didn’t need to buy yet another adapter. (The E443 does not ship with an AC adapter.)

For the sake of review, I played similar styles and MIDI songs on the old PSR-273 and the more expensive PSR-S950 arranger workstation ($250 street for the E443 version $1,900 street for the S950). The E443 sells for about the same price as a mid-range “boutique” guitar pedal. Given that the E443 consists of a computer-based sound generator, analog-to-digital converter (ADC) for the auxiliary audio input,
LCD display, keyboard and media content (e.g., styles, DJ patterns, voices), it’s quite a manufacturing feat to deliver a fun, usable product at such an aggressive price point!

In terms of build quality, you definitely get what you pay for. The build quality of the old PSR-273 seems to be more robust than the E443. Yamaha definitely has taken cost of the E443 in order to sell it for a $250 street price. Although the E443 is a reasonable solid product for the home, it would definitely not hold up on the road. The push buttons do not have the same solid feel as the S950 (or the MOX synthesizer) and one needs (and should use) a gentle touch when pressing buttons. Cosmetically, the only really bothersome observation is the obvious difference between the top C key and the rest of the keys in the key bed. The top C is an add-on key which is not aligned evenly with the rest of the keys and which has a slightly different color (shade of white) than the other white keys. In comparison, the old 273 and the more expensive S950 have nice even keys and consistent key color.

The E443 has a somewhat “retro” sound set augmented by many additional voices that were added over the history of the E4xx series. The E443 and 273 share many of the same panel voices which is a little disappointing. These common voices sound somewhat better on the E443 due to better effects, equalization and sound system. However, with only a few exceptions, the panel voices in common share the same waveforms. One of the exceptions are the string voices. The E443 strings sound much better especially in the lower octaves.

The XG sound set is definitely a step up from the 273 although the S950 XG sound set is at a still higher quantum level in quality. I played the same commercial XG file (“Smooth Operator” by Sade) through all three instruments. The 273 is truly pathetic, the E443 is acceptable, and the S950 is not too bad at all. The E443 does not have the benefit of the XG variation (DSP) effects as available on the S950 and the solo sax sounded just a tad naff. However, I think a typical consumer would be happy with MIDI file playback through the E443; it definitely beats the Microsoft wavetable synthesizer!

Although it sounds a bit negative at this point in the review, the E443 definitely shines brighter than the 273 due to the additional, augmented panel voices. These voices include the several “Cool” and “Sweet” voices, three dynamic velocity-switched voices, a handful of newer voices like “Woodwind Section”, and the many “DJ” synthesizer voices that were added to implement the DJ patterns. There are also some wonderful world voices like Trumpeta Banda and Harmonium. The sound designers also added a few dozen dual (layered) voices. Even though the dual panel voices use the same waveforms as normal non-layered panel voices, many of these dual panel voices are fatter, very playable and usable. I’m looking forward to using these “newer” voices and the improved strings at rehearsals.

The area where the E443 shines brighter than the S950 (!) is the real-time tweaking provided by the two sound control knobs on the front panel. Even though I’m not a huge synth enthusiast, I used the knobs to tweeze voices like the dynamic overdriven guitar while jamming over a style. I’m now sold on having a few knobs around for real-time tweaking and would love to see a couple of knobs on the mid-range arranger workstations. Pressing up/down buttons in the S950 mixing console just doesn’t have the same feel or immediacy. Further, a quick check with MIDI-OX shows that the E443 sends MIDI CC messages for cut-off frequency, resonance, reverb level, chorus level, attack time and release time when the appropriate knob is twisted.

The E443 also has some advantages over the S650 (the next model up in the arranger family). The E443 supports limited voice programming and stores the same six voice parameters for the main and dual voice. These voice parameters are stored in registration memory. This makes the E443 voices tweakable. The S650 lacks even this rudimentary level of voice editing.

Like voices, the styles are a mix of old and new. The styles include many old chestnuts like “Cool8Beat.” The older styles sound better through the improved sound system, but they retain the same essential phrases. The newer styles, especially those in the “Dance” category create more excitement. There are also a few fun additions in the Latin and World categories. Each style has a “One Touch Setting” (OTS) voice that selects a voice that Yamaha deemed to be appropriate for the style. Of course, this is somewhat hit or miss as personal taste and preference varies. There are a few surprises like a very nice Sweet Flute and Piano layer.

The E443 is reasonably adept at playing commercial styles in the original (and older) Style File Format (also known as “SFF” or “SFF1”). I played the styles in the MIDI Spot Soul and Blues pack and got a fairly decent result. These styles were developed for the PSR-9000 (circa 2000). It goes to show that good programming and musicality trumps mere technology! I had more trouble getting the recent “HappyBeat” style to sound decent even though Musicsoft sells this style as “PSR-E443 compatible.” It isn’t just a difference in voicing — the actual harmony sounds off and discordant. I am increasingly disappointed in Musicsoft’s notion of “compatibility.”

I successfully played back the DJX II patterns which I have been converting for PSR. More about this in a future post.

Speaking of DJ patterns, we finally are getting to the E443 functionality that makes it unique in the current arranger product line! There are twenty EDM patterns. I don’t work in the genre, so I’m not really qualified to speak to their currency or quality. However, I do know that EDM styles change with lightning speed! I also know that you cannot load new (user) patterns into the E443. You have to be happy with what Yamaha have provided. Yamaha, even if you continue to keep the internal patterns locked up — a user cannot save or play the patterns to a MIDI file or data stream — please, please, please add the ability to load new patterns. This capability would really enhance the product and create a community of developers around the E4xx series. As Patti Smith said, “This is the era when everyone creates.”

I like the Old Skool and R&B Smooth patterns the best, but that’s just me. Old Skool immediately brings up memories of Grandmaster Flash and “The Message.” Each pattern seems to have an OTS voice (panel voice number 000). The R&B Smooth pattern’s OTS brings up a nice Sweet Flute and Voice Lead layer.

The E443 has 150 arpeggios (musical phrases) for additional instant, real-time fun. The arpeggios track and respond to notes played with the right hand. (BTW, with the main, dual and split voice capability, you can play a left hand bass along with a two-voice layer with your right hand.) Wisely, there are also forty arpeggios voices which automatically bring up a voice and an appropriate arp. This makes it easy to jump into arpeggios without having to do any configuration. Of course, you can change the arp type, voice, etc. to come up with new combinations.

Between the DJ patterns and arpeggios, the E443 approaches the capabilities of the MM6/MM8 “Mini Mo” workstation. The Mini Mo had DSP effects and a smattering of Motif voices, but the E443 has more voice editing and more user style locations — all at a much lower price. If you crave the old MM6/MM8 patterns, they are available through the Yamaha Mobile Music Sequencer (MMS), where Yamaha have re-purposed them. I tried MMS with the E443 and I’m happy to report that you can drive the E443 with MMS on iPad with a little knowledge and consideration of how MMS selects General MIDI voices and drum kits. This is a subject for another day.

The E443 has a pretty decent range of drum kits. Some of the kits have been around the loop once too often and lack punch. When I was experimenting with the DJX II patterns, I noticed that the E443 Dance Kit is the older version of the Dance Kit and has been assigned a different program change number (#113) than the most current kit on the S950. This may be an issue for content creators more so than regular players.

The E443 user interface is a significant refinement of the old PSR-273 era interface. The E443 provides many direct access buttons where you just need to hold a button for a little while in order to be taken to the appropriate editing screen. Further, Yamaha have made it much easier to navigate through the “Function” menu. In the 273 era, one had to repeatedly push the function button to step sequentially through the function menu. With the E443, you navigate through the function menu using the category buttons which do double duty as up and down. Another nice improvement is the transpose button on the front panel. On the 273, I would often skip past the transpose screen and have to circle all the way around the menu. This is a true pain at rehearsals as our music director will often call for a new key right on the spot.

Overall, the E443 is “something old, something new, something borrowed, something blue.” For the street price, it’s hard to find a better value in both sound quality and fun!