Digital Piano Sound Source (Updated: Video - Overview)

Bring your custom casings, arduinos, raspberry pi's, axoloti's and other creative hardware projects

Moderators: MattKingUSA, khz

dbp
Established Member
Posts: 13
Joined: Tue Oct 13, 2015 4:18 am

Digital Piano Sound Source (Updated: Video - Overview)

Post by dbp »

I play digital piano in leisure time with my Casio PX-750, which sounds excellent in its price range, far better than Yamaha etc. The downside is that it only has limited set of instruments: few piano sounds, a couple of string and organ. Few weeks ago, I use my laptop to setup real time sampler and play. Viola! It gives superior sound!

I am considering to setup a smaller system to attach my DP so that I don't need to connect with the bulky notebook. This would be quite challenging technically. Real-time requirement, CPU performance, lack of drivers, sound quality, control interface, ... and of course, price of the hardware.

The most similar projects found are using Raspberry Pi, while from previous posts it is not an option due to its low CPU performance and bad sound output. Now I am looking for some Intel low-end platform. Will share later with updates. :)

Updated 2015-10-26: Functional Requirements http://linuxmusicians.com/viewtopic.php ... 979#p65979
Updated 2015-11-12: Intel Compute Stick http://linuxmusicians.com/viewtopic.php ... 344#p66344
Updated 2015-11-27: Windows Pad(!) viewtopic.php?f=52&t=14717&p=66698#p66698
Updated 2015-12-28: Completed viewtopic.php?f=52&t=14717&p=66698#p67439
Updated 2016-03-24: Video - Overview viewtopic.php?f=52&t=14717&p=69945#p69945
Last edited by dbp on Thu Mar 24, 2016 3:17 am, edited 9 times in total.
Linux enthusiast do play music :)
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Digital Piano Sound Source

Post by asbak »

Raspi2 has good performance and possibly will work well with a USB audio interface like a cheap Behringer UCA202/222, more info here.
I haven't tried to make use of these myself so cannot vouch for how well it works.

http://autostatic.com/2015/04/18/raspbe ... revisited/
http://autostatic.com/2015/09/13/buildi ... pberry-pi/
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
dbp
Established Member
Posts: 13
Joined: Tue Oct 13, 2015 4:18 am

Re: Digital Piano Sound Source

Post by dbp »

The spec of Cirrus Logic Audio Card really attracted me, must to have a check on it. Thanks asbak!
Linux enthusiast do play music :)
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Digital Piano Sound Source

Post by asbak »

There may have been some issues with drivers for those cards, so please make certain it is really what you want. The cheapo USB Behringers usually work and have pretty good sound quality, especially for the price.
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
glowrak guy
Established Member
Posts: 2315
Joined: Sat Jun 21, 2014 8:37 pm
Been thanked: 251 times

Re: Digital Piano Sound Source

Post by glowrak guy »

The quality of the headphone output will be the 'bottleneck', so from a price-to quality perspective,
you want a setup 'as good as' those outputs, but not substantially better, unless you have
plans to make use of that better quality in the near future.

Have you tested the Casio output played through quality amplified home-theater speakers?
Compare that to the output of a laptop running through the same speakers,
using the zynaddsubfx or yoshimi synthesizers,
with some of the included e-piano presets.

This can be achieved by installing via package manager, to your existing linux, or by using avlinux, all ready to use,
booting it from a live dvd. You'll need to downoad the iso, burn it to dvd, boot the dvd using the laptop's
'early boot' system, maybe watch some youtubes showing zynaddsubfx/yoshimi setup/functions.

Connect an adaptor cable from laptop audio out, to the amplifier inputs.
If it is good enough, for the sum of your parts, you don't need a separate audio interface.
Later, Hexter and Dexed synths can both load all the worlds Yamaha DX7 sysex sounds,
and the recently linux native oxefm synth, specializes in DP sounds.

http://www.youtube.com/watch?v=BnhBfLK3oR4

A good linux compatible audio interface, at the above link, is the Native Instruments Komplete Audio 6

(If you don't have home theater, you can get a pair of used line6 Spider III or iV guitar amps, on the cheap,
and use a splitter cable from your laptop, to their aux-in jacks, which bypasses the effects/modelling,
to some pretty nice flat-response speakers. $60-$80 is the high end of a good range in the U.S.)

How do you like the pedals on the Casio? Do all three function in piano-like manner?
My wife is a stickler for pedal response, and Christmas is coming!
Cheers
dbp
Established Member
Posts: 13
Joined: Tue Oct 13, 2015 4:18 am

Re: Digital Piano Sound Source

Post by dbp »

glowrak guy wrote:The quality of the headphone output will be the 'bottleneck', so from a price-to quality perspective,
you want a setup 'as good as' those outputs, but not substantially better, unless you have
plans to make use of that better quality in the near future.
I just tried a cheap USB sound card with a fairly good in-ear earphone, the quality is far below my expectation. But once plugged with a hardware volume control to increase the impedance, the quality improved greatly. To the extend over the quality of my earphone can tell. This is the same case as with the digitial piano. I used to get poor quality for the earphone from the digital piano and solved by the hardware volume control.
Have you tested the Casio output played through quality amplified home-theater speakers?
Compare that to the output of a laptop running through the same speakers,
using the zynaddsubfx or yoshimi synthesizers,
with some of the included e-piano presets.
I did not try the home theater speakers since it is a wireless model and gives fairly large delay.
This can be achieved by installing via package manager, to your existing linux, or by using avlinux, all ready to use,
booting it from a live dvd. You'll need to downoad the iso, burn it to dvd, boot the dvd using the laptop's
'early boot' system, maybe watch some youtubes showing zynaddsubfx/yoshimi setup/functions.

Connect an adaptor cable from laptop audio out, to the amplifier inputs.
If it is good enough, for the sum of your parts, you don't need a separate audio interface.
Later, Hexter and Dexed synths can both load all the worlds Yamaha DX7 sysex sounds,
and the recently linux native oxefm synth, specializes in DP sounds.

http://www.youtube.com/watch?v=BnhBfLK3oR4

A good linux compatible audio interface, at the above link, is the Native Instruments Komplete Audio 6

(If you don't have home theater, you can get a pair of used line6 Spider III or iV guitar amps, on the cheap,
and use a splitter cable from your laptop, to their aux-in jacks, which bypasses the effects/modelling,
to some pretty nice flat-response speakers. $60-$80 is the high end of a good range in the U.S.)
Thank you very much for these valuable information. Actually these days I was busying in trying many types of software and hardware settings and found the hardware limitation is beyond my expectation. Say, the i915 HDMI driver introduced fairly large delay when the screen is not updating (!), so I have no chance to get the sound from HDMI digital source.
How do you like the pedals on the Casio? Do all three function in piano-like manner?
My wife is a stickler for pedal response, and Christmas is coming!
Cheers
I have no idea how it likes real piano. This was the birthday gift for my wife too, though I play it far more than her (laugh). Before I purchase I saw some people in net says it is non-continuous. From what I experience this is true, perhaps few levels.
Linux enthusiast do play music :)
dbp
Established Member
Posts: 13
Joined: Tue Oct 13, 2015 4:18 am

Re: Digital Piano Sound Source

Post by dbp »

Functional Requirements, Software Requirements and Hardware Requirements

As I treat this project extremely serious - more serious than any projects got paid (laugh), I run it with a clear plan. The first step is neither seeking which software or hardware to do with, but to clarify what is the purpose of this thing?

- This will be a sound source to play with an digital piano. As a result, sound quality cannot be compromised.
- It should be easy to use and having an unique control interface. But I don't find any suitable. As a result, a custom GUI communicating with the synth software running in background can be achieved.
- As a Linux enthusiast, I wish everything is open source. Unfortunately this seems unavoidable in firmwares.

This sets the core functional requirements as below:

- A sound font based, provided communication interface, real-time MIDI synthesizer
- An easy to use control interface
- Connectivity to high quality, low latency USB sound card (USB Audio)
- Connectivity to Digital Piano (USB MIDI)

There are two choices for the sound font based real-time MIDI synthesizer: Linux Sampler and FluidSynth.
I like very much the architecture of Linux Sampler, particularly a clear way to add different plug-ins. While Linux Sampler itself is not open source software (What?), according to http://opensource.org/osd-annotated.
I also like FluidSynth in its all-in-one design. It is just too easy to play with my digital piano!
To assess the core functional requirements and the choice of sound font based real-time MIDI synthesizer, I go for FluidSynth.

There are many considerations on choosing hardware, namely, cost, CPU performance, features.

Stick to the core functional requirements, I need a "easy to use control interface", what I thought of is either a touch screen or WiFi connecting to my mobile phone. The latter should be cheaper in case.
Stick to the requirements again, a "sound font based real-time MIDI synthesizer" means a 256 polyphony, around 10ms latency and a PREEMPT / RT kernel. This implies a high end CPU requirements I could not tell until benchmark test.
Other requirements should be consider standard like "USB Audio" and "USB MIDI" as they are class compliant devices.

This lead me to think of trying the Baytrail platform. The first thing come to mind is the Intel Compute Stick (Linux version) which cost $100 and I immediately acquired one to play with.

Next time I will post the detail after clearing up the messy setup and benchmark tests.
Linux enthusiast do play music :)
dbp
Established Member
Posts: 13
Joined: Tue Oct 13, 2015 4:18 am

Re: Digital Piano Sound Source

Post by dbp »

Intel Compute Stick

Hi everyone, below is the update of the Digital Piano Sound Source running on Intel Compute Stick:

Hardware:
Intel Compute Stick (of course :lol: ) linux version
Casio PX-750 digital piano
HDMI audio out (trial 1)
Generic USB audio sound card (trial 2)

Software:
Debian Linux 4.2 with PREEMPT and 1000Hz config
Fluidsynth

Trial 1: Initially I think a linux version of Intel Compute Stick should let me avoid from fighting with drivers but just to use those existed. Unfortunately I was wrong. HDMI audio out of the Linux Compute Stick is closely tied with the i915 display driver, as a result PREEMPT and 1000Hz does not give low latency enough for piano playing without buffer underrun. The thing drive me crazy is in order to solve this issue is to generate some X screen updates at 1000Hz which cause CPU fighting with fluidsynth. Anything deal with power saving could not solve the issue and seems need to look very deep inside the i915 driver to solve it.

The potential issue was also being foresee, the HDMI audio out is digital signal only, which means another whatever types of HDMI audio D/A converter is required and yield some more latency. At this point I think is the end of the attempt with HDMI audio.

Trial 2: Using a generic USB audio sound card immediately solve the issues in trial 1. The latency is low enough that I could not feel anything late. While in order to measure it quantitatively, I think the easiest way is to use a stereo recorder which I am missing:

1. Connect the digital piano and the USB audio sound card to the Intel Compute Stick
2. Verify playing a note with digital piano makes the USB audio sound card sounds
3. Connect a small analog speaker to the USB audio sound card
4. Face the left channel of microphone of the stereo recorder to digital piano keyboard closely
5. Face the right channel of microphone of the stereo recorder to small analog speaker / headphone closely
6. Hit the keyboard strongly to make it got physical sound, as a result, the physical sound as well as the speaker sound will be recorded
7. Measure the time difference of the keyboard sound and speaker recorded in computer

There was people measure latency of various software by loopback to computer, but the physical location between my digital piano and computer could not let me do it easily. As a result, I use my iPhone to treat as the recorder. Without the stereo microphone capability, I could not distinguish the voice pattern for keyboard sound and headphone sound. The good thing is it means the latency is low enough for me to distinguish. :wink:

CPU Performance:

As expected, the performance is good enough for 256 polyphony or even above. All MIDI files played did not saturated the CPU and I did not make a crazily crowd MIDI to test its limit, so I cannot tell how the maximum polyphony is the limit. (If anyone know any MIDI use up the 256 polyphony limit can give me a try)

Sound quality:

The quality is limited by the USB audio sound card and the quality of sound font. Precisely means CD quality. A USD50 sound card should be a little bit better than a USD5 sound card, while with a good external volume control at USD5 which used to increase the input impedance of the headphone, I am totally satisfied with a USD5 sound card.

For everyone tried cheap USB audio sound card and find it does not sound good, make sure to match the input impedance of the headphone / speaker to the output of the sound card. You may not know either or both of them (since they are too cheap to provide such information), so you need an external volume control for 'try and error'. The symptom of 'unmatched impedance' is 'Bass too low, high background noise, volume too high even the output volume knob is low. The symptom of 'matched impedance' is 'volume is enough when the output volume knob is about 50%-75%'.

The problem:

Intel Compute Stick does not have any input interface, so I think of using web server to control it from my iPhone. Another issue comes out here! The wifi driver lead to random buffer underrun. This is a well known case and everyone advice is: turn off wifi when dealing with real time things! It seems no solution at this point. I can make the compute stick be controlled by my iPhone and once configured, disable the wifi and let it play. But this is too weird if I need to make some control, I have to reboot the Compute Stick to get the wifi back. :shock:

The solution:

The solution is to seek for other platform but not Intel Compute Stick. The details will be posted here soon after clear the things up.
Linux enthusiast do play music :)
dbp
Established Member
Posts: 13
Joined: Tue Oct 13, 2015 4:18 am

Re: Digital Piano Sound Source

Post by dbp »

Windows Pad (!)

Hi everyone, this would be the most exciting update of the Digitial Piano Sound Source.

After realize of the limitation on using WiFi with iPhone as remote control with Intel Compute Stick, I decided to replace it with a Windows Pad (!) ... and replace it with Linux, of course!

The selection of Windows Pad need to take extra care: Does the BIOS locked with secure boot only? Does the BIOS provide UEFI boot only? Does the UEFI BIOS support 32-bit code only? Does the internal storage accessible by Linux driver? ... This is all talking about pre-installation, more challenges to come in installation, configuration and the hardest part, device driver as before. After all, the selected Windows Pad is a Chinese Windows Pad which should be based on some reference design. The main advantage is it is coming with dual boot Windows 8 and Android Kitkat, which implies the BIOS has high chance not being enforced with secure boot.

Linux bootable image is working with USB stick. If everything goes wrong can boot with rescue image and fix. After install, as expected, almost every device driver not work.

The first thing to try to resolve is to grab and compile the latest kernel. It would be a little bit old with even 4.2(!). The latest WiFi driver even suggest to have kernel 4.3. The sound driver, unfortunately is out of my expectation, it just not work. At first I expect it would only need special configuration as many reported Asus T100 works (running with same chipset) by using customized asound.state and a special version of firmware etc. After fighting for nights still failed to make it works. Since the (even better) alternative is to use the USB sound card, I put it down for a while.

Another thing drives me crazy is the i915 driver for display. I have no idea what is the problem, the display becomes out of sync after running for a couple of minutes and the display become garbages. The workaround was disable the kernel mode and luckily it support framebuffer mode, so I get a decelerated X window.

USB is working flawlessly as the Intel Compute Stick, so the first fire for fluidsynth and USB sound card with the digital piano success.

There would be a lot of work to make a nice interface for the control. Stay tuned!
Last edited by dbp on Mon Dec 28, 2015 2:41 am, edited 1 time in total.
Linux enthusiast do play music :)
dbp
Established Member
Posts: 13
Joined: Tue Oct 13, 2015 4:18 am

Re: Digital Piano Sound Source

Post by dbp »

Completed

Merry Christmas!

After almost a month time of fine tuning, the Digital Piano Sound Source finally plays!

Hardware used:

1. 7" Windows Pad
2. Generic USB sound card
3. 5" sub-woofer with high frequency speaker

Software used:

1. OS: Debian GNU Linux with preempt Linux kernel 4.2
2. Sampler: ALSA + Fluidsynth with various bug fix patches
3. Interface: XOrg + Nginx + PHP + Chrome

I tried using FluidGM3 soundfont with this setup to play and everything works great. While there is some delay while playing with customized Salamander soundfont (Salamander soundfont does not have SF2 format for Fluidsynth and have too loud key press sound after converted to SF2, as a result need customization to reduce the key press sound). It would probably due to incorrect customization being done. I will spare some time to check.

The best part I think is the interface being used. Since it is a web interface, The graphics and animation inherited should be the best interface ever existed in digital piano interface. I will take some photo to share next time.

5" sub-woofer with high frequency speaker is just a convenience choice since I would prefer an in-ear headphone for quality. Some 2.1 computer speakers would do better.

Total cost (roughly converted to USD): $150 + $10 + $50 = $210.
Last edited by dbp on Mon Dec 28, 2015 2:41 am, edited 1 time in total.
Linux enthusiast do play music :)
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Digital Piano Sound Source (Updated: Completed)

Post by asbak »

Interesting, could you provide more details on the make/model of tablet and the procedure needed to get Linux installed on it?
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
dbp
Established Member
Posts: 13
Joined: Tue Oct 13, 2015 4:18 am

Re: Digital Piano Sound Source (Updated: Completed)

Post by dbp »

asbak wrote:Interesting, could you provide more details on the make/model of tablet and the procedure needed to get Linux installed on it?
Hi asbak, most "dual-boot" (Windows and Android) Pad should be able to install and boot Linux. Dual boot means its UEFI is likely not required secure boot. Another problem may be faced is it is using 32-bit UEFI firmware while you are installing 64-bit Linux OS comes with 64-bit GRUB. Debian 8 has taken care of this. The installation part is nothing more special than "install by USB thumb drive".

For display driver, most if not all, use i915 driver. I could not make it works as it shows some symptom of "out of sync", hope the new driver comes with Linux 4.3 would solve it. At the moment, I use fb driver which is good enough for interface.

For audio driver, most if not all, not work. The driver existed while many hardware pins are connected differently. If you have luck, you can try download Asus T100 ALSA configuration file (asound.state) and try tuning 100 mixer options to see which combination works, if it has not been burnt (Some people reported smoke comes out!). I can at most make it gives beep tone and never get it played.
Linux enthusiast do play music :)
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Digital Piano Sound Source (Updated: Completed)

Post by asbak »

The reason I'm asking is that some tabs are extremely problematic to install, I know, because I have one such tablet which has proved impervious to all attempts thus far to get it to boot from USB in order to reinstall.

The second problem is whether the device hardware is supported under Linux or not. I haven't been able to find any clear information about this. In other words, even if one can get a Doze tablet to boot off USB and install LInux, is it even going to be 1/2 usable or not? Hardly any information about results exists...

So that's why I asked for more specifics. What is the exact method required to get it to boot, what is the hardware/model, how well does Linux run on it ie how well is the tablet hardware supported etc etc.
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
dbp
Established Member
Posts: 13
Joined: Tue Oct 13, 2015 4:18 am

Re: Digital Piano Sound Source (Updated: Completed)

Post by dbp »

asbak wrote:The reason I'm asking is that some tabs are extremely problematic to install, I know, because I have one such tablet which has proved impervious to all attempts thus far to get it to boot from USB in order to reinstall.

The second problem is whether the device hardware is supported under Linux or not. I haven't been able to find any clear information about this. In other words, even if one can get a Doze tablet to boot off USB and install LInux, is it even going to be 1/2 usable or not? Hardly any information about results exists...

So that's why I asked for more specifics. What is the exact method required to get it to boot, what is the hardware/model, how well does Linux run on it ie how well is the tablet hardware supported etc etc.
Hi asbak, I am using this pad: http://www.gearbest.com/tv-box-mini-pc/pp_237097.html

I understand what you are worrying as this question is surrounding all try new hardware with Linux, this problem existed since Linux was created. Since my installation is smooth (nothing more special than install with a USB thumb drive) I have nothing special to point out, except for the UEFI issues others found in their install which I did not experienced.

For driver support:

USB host - work
Interval USB Ethernet - work
i915 kms - not work
SST audio - not work
WiFi - partially work (hang after some minutes)
BT - not tested
Linux enthusiast do play music :)
asbak
Established Member
Posts: 897
Joined: Thu Sep 11, 2014 3:04 pm
Has thanked: 71 times
Been thanked: 64 times

Re: Digital Piano Sound Source (Updated: Completed)

Post by asbak »

Thanks dbp, it looks like your issues are similar to what some others wrote about, there's still a lack of driver support. But for this project it probably doesn't matter. :)
A mini pc may be another option, they're about $115 dollars (without a hard drive and memory).
Some Focal / 20.04 audio packages and resources https://midistudio.groups.io/g/linuxaudio
Post Reply