Archiv für den Monat: Januar 2017

New pinball sound for DE

My latest project is about sound. Inspired from a small project from Christoph found here I was willing to try that with my Jurassic Park machine as well. Raspberry Pi B+ was already lying around so first test run was really fast.

I assembled a small strip board with thread wires to connect the pinball machines inputs via a level shifter to the raspberry pi. I am using active level shifters 74HC4050 that has 6 non inverting buffers in a DIL 16 case, two of them are needed. I also designed a real PCB (see gerber / eagle files in the project directory on gitlab).

To get a better sound quality I also used a USB sound card togX723398.1ether with the PI, because there are many complaints about the poor quality of build in sound. Not sure if this is still true with an actual Rasp Pi 3, but you can get such a sound card for only 4€ or so.

X640814.1In order to get real powerful audio we need to have amplifiers and better speakers at least in the backbox panel. For the speaker I used also rather cheap ones from McGee, that actually sounds much better than the original ones, although you can get one for about 5€ each (see parts list at the end of the page).X630561.1

As amplifier I’m using two modules from here, each has 2x10W one for stereo backbox sound and one additional channel for cabinet speaker. It has a volume control so you can level volume for backbox and cabinet separately.

As an alternative you could also use some of these 2.1 channel car amplifiers like this.

To avoid noise amp2.1or any kind of disturbance I’m using a separate PSU 12V/5A only for the amplifiers. Connections between sound card output and amplifiers input uses shielded cables, also to minimize noise. For the backbox channel I simple combine the two stereo channels (left and right) to one with two resistors.

To control the new sound system in a pinball machine I also connected a rotary encoder with click function to the raspberry pi. It can be installed near to classic volume controller inside the cabinet, so its easy to reach when coin door is open. The click function is used for switching between different sound sets.

In order to get good sounds or good quality we need to have good sounding mp3 or wav files to play. The easiest way to get that is either ripp the sounds from the game roms with a tool called „m1“ or simply download a complete sound set from the internet.

The software on the PI supports the file structure with four subdirectories „jingle“, „sfx“, „voice“ and „music“. Each of these directories containing again another directory that has the sound number encoded in the directory name like „XXXXXX-*“, where XXXXXX is the 6 digit sound number. Just extract a sound set to the sd card and start the „despi“ sound controller with a parameter pointing to the containing directory.

The software uses SDL / SDL_Mixer to produce background music and sound effects and despite it can read many different formats, it is best to use the same format we are going to output from the PI. In our case this means simply use WAV files 16 bit, 44100 Hz. Any other format will converted to this format internally on load time anyways, so effectively this only slows down to load or starting time.

If the PI has enough ram (normally the case) it is best to preload all the sound effects before starting. This avoids latency when the sound gets played. This is controlled with the „-p“ option at startup. If you place an empty file named „dontpreload“ in any of the soundsets directories, sounds of that directory will skipped when preloading. This can be used for sounds that normally never or very rarely gets played, especially when ram is short.

As the program itself has no UI of course, it uses some build in sounds to give status feedback. These sounds are located in the sounds directory and can easily customized.

Wire protocol

The protocol between cpu and sound board is rather simple: there is a 8 bit data word and strobe for communicating from cpu to sound, and a busy and sst0 the other way round.

Data is received when strobe goes low and is acknowledged with a short low pulse on busy. While music is playing sst0 is also pulsed low every 250ms. This is implemented in pincom.c / despi.c and works really simple.

Christoph did a nice job and reverse engineer this with a few logic analyser recordings:

despi_6

Software

The software is based on Arch Linux but raspbian works as well. If you not able / not willing to compile the source for yourself, I can also offer a complete image for the PI (linux and despi included). Only thing to add is of course: sounds!

Assembling

2017012701013300
PSU for sound amplifiers
2017012701013402
Raspberry pi (within the case) and pinball connectors
2017012701013500
everything mounted on a frame
2017012701013401
new backbox speakers
2017012701013301
rotary encoder in the cab front for vol control

2017012701013400

Software repository

The source code is hosted on gitlab https://gitlab.com/sker65/RasPinSound.

SDCard image

There is also an sdcard image ready to use: you can simply „buy“ it in my shop: //go-dmd.de/shop/ (its a 0€ product).

The image is for a 16GB sdcard and has two partitions:

  1. Boot- and data partition (fat32)
  2. Linux partition (ext4)pinsound-dir

Boot partition contains a data/sound directory where the sound sets must be placed. Complete directory structure looks like this:

To configure a usb sound card instead of the build in sound, simply put a file „use-usb.txt“ into the data directory.

The image is tested with a PI3 but should also work with older versions. Base image is a arch linux, with a few tools installed. There’s two users ‚pi‘ and ‚root‘ it you like to connect to the pi via ssh. (password is the same as username).

The sound program itself is installed as a system level service controlled by systemctl / systemd. It is called ‚pinsound‘, so calling ’systemctl status pinsound‘ should produce some status information.

If everything is correctly setup the starting sound system should produce a boot sound like some famous laptop computers and continues saying ‚loading sound set 1‘

Updates are available through the main website: https://tiltaudio.com

And there is also a changelog on https://tiltaudio.com/changelog

Video impressions

First tests

And then everything together

See many more demo videos on https://tiltaudio.com/2020/12/20/demo-videos/

Partslist

Unfortunately pollin has change its link scheme recently so the links provided will not work, but it should be easy to collect the pieces from that shop. Of course there are other sources to buy from available.

Name Needed Price p.U.   Supply Source
RaspPi 3 B 1 36,50 € //www.pollin.de/shop/dt/OTQxNzkyOTk-
USB-Sound 1 3,95 € //www.pollin.de/shop/dt/MTA2NjcyOTk-
10W Stereo Verst. 2 7,95 € //www.pollin.de/shop/dt/ODM0OTYzOTk-
Usb-Stromkabel 1 1,00 € //www.pollin.de/shop/dt/NDYwNzcyOTk-
Klinkenstecker 4 0,25 € //www.pollin.de/shop/dt/NzQwOTQ1OTk-
Drehgeber 1 0,75 € //www.pollin.de/shop/dt/Njg2OTU3OTk-
Geschirmte NF-Leitung 1 0,75 € //www.pollin.de/shop/dt/MDg4NzM0OTk-
SD Card 16GB 1 5,95 € //www.pollin.de/shop/dt/MjI0NzcyOTk-
LS Kabel 1 4,50 € //www.pollin.de/shop/dt/NjA2NzM0OTk-
Stromversorgungskabel 1 1,25 € //www.pollin.de/shop/dt/ODA4NzM0OTk-
Gehäuse Pi 1 5,95 € //www.pollin.de/shop/dt/NjE5NjkyOTk-
74HC4050 2 0,32 € https://www.reichelt.de/?ARTICLE=3228
Steuerleitung 1 1,95 € //www.pollin.de/shop/dt/NTQ3OTM0OTk-
Adapter-Platine 1 3,90 € SR
Stiftleiste 1 0,10 € eBay
Steckerleiste 2×20 1 0,20 € eBay
75,27 €
Lautsprecher Cab 1 29,95 € //www.pollin.de/shop/dt/NTY2OTUzOTk-
Speaker Panel 2 4,95 € //www.pollin.de/shop/dt/NTgxOTUzOTk-
34,90 €
Netzteil 12V/5A 1 9,95 € //www.pollin.de/shop/dt/NTY0ODQ2OTk-
Netzteil 5V/3A 1 9,95 € //www.pollin.de/shop/dt/NTM1ODQ2OTk-
19,90 €
Sound und Netzteil 95,17 €
inkl. Lautsprecher 130,07 €