Sound Research (Pt. 3)

by Cory on July 31, 2020 12:48 AM (Edited August 1, 2020 9:10 AM)

This is the third and final post I'm going to make about sound, for now.

Quick recap: I caved and bought a fancy pants DAC (digital-to-analog converter) from Adafruit to pull out sound from the Raspberry Pi to my homemade speakers. This was before I got the them driven with PWM output which, by the way, was something I was trying out while waiting for the DAC to come in simply as an experiment.

After getting the DAC working, I'm glad to say that it blows the signal quality of the PWM output out of the water (as expected). On the other hand, this piece of crap is 7 bux, overpriced, and took like two weeks to come in! What do I look like, Apple?? Ain't nobody got time to order expensive, specialty parts for hobby electronics...

Anyway, here's the result:

Good-ass sounding Pokemon Emerald. Just like on the GBA. It feels so good to hear it without the noise, crackling, and signal interference. Quality-wise it's almost there, passable as a low to mid tier consumer product. It's missing the deep-ness and bass you get from a truly quality product. Take the 3ds speakers, for example. Nintendo goes balls to the wall with the 3d concept by carefully calibrating the speakers such that the sound is also 3d.

Wiring up the DAC

Overall the whole process was waaay easier than I thought it would be. But that's what you get when you pay for a nice complete package. The DAC hooks up to the Raspberry PI through an I2S interface, which is a nice and simple 3 wire thingy that is configured to be on the GPIO pins. Although I did trip up for about 2-3 hours trying to get the wiring of this down.

Here's my main fucking gripe with the whole Raspberry Pi scene. GPIO is SHIT. It's fucking confusing because there's physical pin numbers (1 to 40) that refers to the actual pin you see in real life and then they get additional logical numberings like GPIO1 or GPIO23, which are basically randomly assigned to physical pins, as far as I can tell. The pins are different depending on the generation of Raspberry Pi you have and if you search for "raspberry pi pinout" on Google, most charts don't tell you which version it's for. At least, it's somewhat easy because the older generation has 26 pins and the new one has 40, but I still think it's stupid.

And there's fanmade tool called WiringPi that uses it's own random numbering scheme. So physical pin 12, for instance, is wPi number 1, and also GPIO 18. I read somewhere that wPi numbered it 1 because it used to be GPIO 1 in the older generation but now it's 18? Or maybe that was just a fever dream because I can't find where I read that anymore so what the fuck. And as a cherry on top, it's no longer maintained but still the easiest/best way to work with GPIO on the device...

Are you still with me? Because here's where I bring it all back. Everything I described to you now is just fuel for the fire. Here's where it gets fucky. It's annoying when hobbyists and 3rd parties just throw out unlabeled numbers like you can read their goddamn minds. Say you are following instructions, like I dunnnooooo for a DAC from Adafruit, for example and they say hook a wire up to Pin #21.Well, what the fuck is PIN 21?? GPIO21? Physical pin 21??? Wiringpi 21??? Fuck me I guess.

The reason why I spent so long is because depending on the numbering scheme it was, the pins would be already in use by the LCD I hooked up. This is obviously a dealbreaker, so it lead to me researching how to move pin configurations on the LCD overlay, or learning about I2C and I2S to double check if you're really able to run both at the same time, or trying to figure out how to hook up two devices to MOSI if one of them doesn't have a chip select???

I came across this pic and I realized which numbering scheme the instructions were talking about and miraculously, the pins didn't intersect anymore (I say that, but in all seriousness, they were probably designed that way. The I2S pins are specially labeled, so I think most devices are careful not to use them unless they are sound related):

Yes, do you see this shit?? Pin #21 means GPIO21 (i.e. pin forrrtyyy). Fucking great.

But after you hook that up, hook up the speaker inputs to Lout and Rout of the DAC, and then curl a mysterious location on the internet for a script and run it without looking at it. All that's left is to reboot twice and then run the mysterious internet script again and BEHODL, the sound test comes out of the speakers like magic.

I'm paying for the convenience of this by having to find a way to fit this circuitry inside the case later on, but we'll burn that bridge when we cross it.

Up next

Time to add some muthafuckin' BUTTONS yo. I hear in the arcade scene, they have these things called "IPAC"s that are microcontrollers coupled with an array of input terminals that emulate gamepads. You use these to make your own arcade cabinets, for instance. I need to figure out if there are miniature versions or at least if I can adapt the circuitry into my own PCB.

Also I've been shopping around on and off for a final LCD solution and I've come across two promising candidates:

Pimoroni HyperPixel 4" IPS with capacitive touch screen

OSOYOO 5" TFT with capacitive touch screen

I like the size (looking for something 4-5", haven't decided which size is better) and they both are good interfacing options for Raspberry Pi's. The HyperPixel is worse, though. It goes through GPIO which is cool, but takes up all 40 pins, which is a fucking problem. The OSOYOO uses the dsi connector, which is perfect IMO but now I need to figure out if the Raspberry Pi Computer Module form factor supports that.

What I don't like is that they're both like 50 bux and what the heck that's freaking expensive. I could spend the time to build these from other components, but I'm not sure if I have the patience or skill to do that. I'd have to source a "raw" LCD and then figure out how to make a custom PCB with a DSI driver integrated circuit on it. Why is this so complicated. Sigh.

This Thought is part of Emulators

Cory tries to make the perfect handheld emulator

back to the