Showing posts with label Pi. Show all posts
Showing posts with label Pi. Show all posts

Thursday, May 18, 2017

Kanan in D

The Kanan Jarrus (otherwise known as the Caleb Dume) prototype is built. So far everything works -- in fact, the parts line up better than I had any expectation they would.



Well, actually...since the outer edge is opaque, I could maybe work out a way to open the center to where it really should be (essentially this style of holocron looks like six corner pieces just touching. Which is hard to do and have any structure, and harder yet when I'm trying to hide the overlap of the inner acrylic pieces.) But I've committed to working with the material this way, the designs are already tested and approved and the first six shipped out to customers.


I also had time to re-do the "temple" shell design for the new USB and other tweaks I've made over the development of the "stolen" shells. Cut one out already and will glue it up and see how it works.


(I need to run off a set of "Guardian" diffusion, and maybe a new set of "Gallifrey" cutout pieces as well, to properly make a new "Temple" prototype. I'm also temped to paint it silver and use green for the internal layers).




So I'm one step closer to finishing off the Holocron project and moving on to the next. And apropos of next projects, I made a discovery that might get my keyboard back up and running faster than expected:

SamplerBox

It's a software sampler wrapped in a custom-patched Raspberry Pi install. It's designed as exactly what I need from it; a no-frills Pi that simply boots up into a stand-alone sampler. Although...most people add an external DAC as the built-in one on the Pi is a bit noisy, and one enterprising programmer managed to get Freeverb running as well.

But the really unexpected and lovely thing was: I downloaded the disk image, threw it onto a microSD with the freeware utility program Etcher, and.....it ran. Right out of the box, first time, no tinkering.

For an acid test, I threw my Behringer controller and a pair of USB headphones at it, and it adapted without hesitation. Playing with low noise and latency and plenty of polyphony, too.

Wednesday, April 5, 2017

How Strange the Change...

It is so nice not to have a show to work twice a week and two shows on weekends. I feel so relaxed -- even with putting holocrons in boxes (I spent five hours last night at the laser, getting home too late to even eat diner) I feel relaxed.  I feel like I can finally finish some of these dangling chores and clear the work table a little.

So, of course, I'm yanked off in a new direction. Started this morning. See, I've been bringing my
violin to work to practice during my break time.

Which is coming along well. Messed with the theme from the 1978 Battlestar Galactica (fingering is straight-forward enough I could almost play through on the first attempt) and the "usual snippet" from Polovtsian Dances (rather less so). By ear, that is. I've got my music stand back and I'm a member at MuseScore now but my sight-reading still needs a lot of work.

Anyhow, carrying an instrument on your back as you approach the time clock will start a conversation here and there. One of my co-workers is buying a keyboard soon, another is trying to spend more time with his (a familiar problem).

I don't spend a lot of time with my keyboard partly because it is a Behringer controller; no internal sounds, no external speakers. To run it I have to connect it to the laptop, boot up Reaper, then stretch a headphone cord across the room. Every now and then I think I should throw a speaker and some kind of synth module in a box so I just have to throw a single switch and the piano is playable. Right now the only impulse instrument I have is a ukulele I keep on a hook by my chair.

So today I opened my Maker's Notebook and scribbled ideas for a simpler keyboard setup. I still have
a couple rack-mount synths, but 19" is large for the "box with a speaker" I was envisioning.  I do have a Korg P3, but there's a lot to be said for having other than a basic piano sound. An even smaller box would fit a Kurtzweil micropiano, which has some of the best keyboard sounds in a book-sized synth (and really nice piano). But the things are still $200 American on the used market. Hrm. Keep scribbling.

Plus the Behringer keyboard requires external power when using a MIDI cable, so that's more wires to play with. A USB box would be just one cable...  Say; a Raspberry Pi can handle software synthesis and even be trained to handle MIDI-over-USB. So could throw that in a box and...

But by now I'm thinking of the sounds I spent so many years practicing keyboard with. The sounds of the Yamaha DX21 (a cut-down version of the DX7; no velocity, only four operators instead of six...and that's all Geek to you, right?)

So I hunted and yes there is a free multi-platform FM synthesizer pre-loaded with those great old
DX7 patches. Called DEXED and you can find it with a short Google. By this time, as you can gather, I'm pretty far from my original starting point. (Incidentally, the pi-in-a-box is totally doable but requires some hairy programming steps to boot into musicality without having to hassle around with passwords and so forth every time).

But by this time I was off-track. Found myself listening to samples of DEXED on YouTube, then DX7 samples, then reproductions and homages of some of the synth-heavy 80's hits. And that leads me to some clever videos explaining the chord sequences used by many Hollywood composers (as well as the familiar discussions of orchestration and so forth that somehow never seem to show up on my YouTube "you may also like" page no matter how many I watch.)

And, yeah, this seems completely out in the woods now, but one of the things I was intending with the violin was to get back into composing a little. And that instrument is now close to the point where I can actually make use of it.

And probably I'll just prop a rack module and powered monitor under the Behringer and gaff-tape a power strip to the keyboard stand. The perfect is the enemy of the good, and a fancy box with a Pi-based FM synth and a scratch-built speaker system at some point in the indeterminable future must fall to the utility of having a keyboard I can go to now when I hear a musical motif in my head and want to try it out.


Sunday, November 1, 2015

There's trouble at the mill

import troup.members as vikings

def main():
    while(eggs == True || bacon == True):
         spam



Can you tell which language I'm struggling with now?


Just trying to get the GPIO buttons on my Raspberry Pi assigned to automatically boot the GUI on the PiTFT display for easier stand-alone list.

I found my old Adafruit minty-boost kit, by the way. And it does power the Pi! Dunno about handling the full load of video, though.

Friday, October 30, 2015

Open the Pod-Play Door, HAL

More than once I've been disparaging about something I consider too trendy and popular but basically useless. I remember thinking Cliff Bars were a bad-for-you sweet confection sold to fitness wanna-be's with a stupid cartoon of a rock climber on the wrapper. Well, that was before I started climbing, found out the company was started by climbers, and found out it was low-sugar, very solid food -- like good old-fashioned trail mix in a compressed form. Like Dwarvish iron rations only somewhat better tasting. And the cartoon of the climber is technically accurate, too.

I've never had a strong need to surround myself with music while working. In fact, I often prefer silence when I'm trying to concentrate. But then came a spell when I was working near the main assembly floor, and being driven to distraction by the incessant and loud radio station played over the PA -- the auto-tune vocalists (as far as I can tell, there's only two; one male, one female. Otherwise they all sound identical) are tolerable, but the marathon sessions of happy-idiot banter from the hosts is hair-tearing.

So I started to bring in earphones as self defense (oddly enough, a good half of the people on the shop floor seem to have a similar problem with the piped-in music.) I have a couple basic mp3 players I picked up surplus for a buck or two each to use for sound effects in a prop. But I keep all my sound files, imported CDs, and so forth in 44.1 uncompressed; the only mp3's I had lying around I could throw on to the player in the hurried minutes of a work morning were game soundtracks.

I listened to a lot of Tomb Raider (1 through Underworld, minus #2 which I haven't gotten around to downloading yet). Also Portal2, Black Mesa, and Mass Effect.

And that was getting old. I figured out how to batch-process in Audacity and flipped some Chopin piano in there as well, plus the entire three-something hours of "How the West Was Won." But this approach had a basic problem; there's no indexing on my bare-bones mp3 player, and if I found out in the middle of a long session of stripping wires that I was cued up for Tomb Raider Legends once again, I'd be faced with trying to hit the "track advance button" 96 times in a row to find whatever folder might be next.

So, right, I'm facing exactly the reason the iPod came along (and the same functionality in smart phones and, today, smart-enough phones). But I can't quite muster the strength to purchase one, along with the not-plastic water bottle and the polo shirt with the alligator on it. And as it happens, I'd just picked up a Raspberry Pi.

So, great! I can learn how to work in the Pi environment and make a geeky, balky, conversation-piece playback machine that is suitable enough for my modest needs.

Except, as work went on and I found myself listening to music even when the shop radio wasn't blasting cocaine-freak morning-person inanities at me, I suddenly realized that the kind of mindless work I was doing could share CPU space with more engaging audio fare.

In a word, podcasts. Brush up (more like, learn the basics of!) a little history while I broke up old pallets and rolled black paint on plywood.

So, yes. Podcasting is not the useless gen-x endeavor I might have characterized it as. Well, maybe a lot of them are, after all. But there's some pretty good free history and science stuff out there.

And at fifteen to thirty minutes a 'cast, the indexing problem I mentioned earlier no longer applies.

Sunday, October 25, 2015

I'm not even sure I like programming

Of course, what I'm doing is somewhere between "scripting" and "magic incantations" -- I'm using beginner-friendly tools and I'm copy-pasting lots of code blocks I barely (or don't at all) understand. What little I do understand, I am applying with equal measures of kludge and brute force and ignorance. A Bubble Sort would be an improvement on most of my algorithms!

Anyhow.

A friend just called wanting to see if I had a suggestion to spit out a MIDI event from a detected physical event on stage (the pedal of an otherwise gutted prop piano being depressed). Yes, I do. I've built the circuit in the past. I keep meaning to put it in a nice box (and even make it available in kit form for others) but I keep getting distracted both by Feeping Creaturism, Creeping Elegance, and the uncomfortable realization that 99 times out of 100 a technological solution (even one that is available out of the box and has already been well-tested in practice) will be passed over in preference for a Stage Manager squinting at the stage and calling out "Sound Cue Go!" on headset to someone else who presses the play button.

Such is theater. We're more conservative than aerospace. If it works, we don't like to mess with it.

So anyhow, I have the guts of one of my old button-press-to-MIDI boxes on the desk and all it would take is about an hour to figure out which pins I chose to wire up or otherwise reconstruct the original code for it. It seems sturdy enough and it is well-tested -- been through at least three stage productions that I remember, being used to fire off intercom buzzer sounds for "Moonlight and Magnolias" and a baby's cry for "Into the Woods" and... some show I've already forgotten.


It isn't of course elegant. 

So I've spent the morning going back again through the perennial problem of getting no-driver MIDI to happen over USB. And, yes, the least elegant method is the most robust; buy a $40 MIDI adaptor from Guitar Center, hack it up, wire it to the Arduino's serial port and stick it in a project box with the Arduino. Once the lid is closed, no-one will know the difference.

The newest solution on the block is that the Arduino Leonardo (and some others that come after it) use a chip that speaks USB natively and it is now trivial to turn one into MIDI or HID (aka emulate a keyboard or mouse.) This is completely class-compliant and requires no special drivers or client-side software; just plug it in and most modern computers will recognize it.

I don't happen to have a Leo. I don't think RadioShack carries one and this is a project I want done this week -- Tuesday if possible.

So the most plausible option seems to be using an ATmega32u breakout board I just happen to have, and trying to get either the LUFA framework or the more complete-and-friendly Teensy working on it. And although this might be approached at least at first through the Arduino IDE, it looks probable that once the USB port thinks it is a class-compliant MIDI device I'll have to resort to going through my AVR programmer -- and quite possibly having to delve down into make and avr.gcc and other things I've nearly forgotten.


And of course I'm right in the middle of learning Raspberry Pi now. So C or the Arduino macros or, worse, the avrdude toolchain aren't on the tip of my programming "tongue" right now. Instead I've got bits of Python and lots of Linux commands filling up my brain.

I'm getting a little more comfortable on the Linux command line. That's one of the major things I hope to accomplish playing with the Pi, anyhow. I mentioned before that the GUI (I'm mostly using X, when I use it) is like a coat of paint. A thin coat of paint. It isn't uncommon within X to find yourself presented with a command line in the middle of a drop-down menu or otherwise innocuous selection box, and it is often transparent what command line, err, commands you are issuing even when you make a radio-button selection in that GUI.

So I've got "sudo apt-get" and "cd /dev/pi" and "pkill x" and "nano /dev/config.txt" and so forth all clogging up my brain.

(Among the other amusements, command-key sequences become alt-key sequences on the current Raspi keyboard, except for within the nano editor, where I have to remember to use the "window" key instead).

I'm making progress. Tried out OSMC and OpenElec (different wrappers for Kodi, basically) but neither was friendly towards further hacking; no terminal, difficult to exit X, difficult to SSH into even (I managed to confuse my MacBook into thinking someone was attempting a man-in-the-middle attack and for a while it refused to even connect with the Pi anymore. Say, who is all this security for? You trying to protect me, the owner of the computer, from taking risks I think are justified? Did or did not I pay for the thing?)

So back again (at least twice now by my count) to the Debian clone, Raspbian. This time I hand-installed the Adafruit patches and nano'd the additional lines and config files necessary (err...I said I wasn't going to try to explain Raspberry Pi processes in detail. nano is the default text editor, a utility almost as old as but far less venerated than "ed.")

So now it doesn't force X to go to the PiTFT (Adafruit 2.8" full-color backlit LCD touch-screen). I can chose to throw the GUI, images, or movies to the device of my choice. Can play mkv, mp4, mp3, aiff...but not all with the same application. Each requires different phrasing to set up the options correctly, plus more options to get sound to go to the correct port to accompany a movie. So lots of typing out "sudo SDL_VIDEODRIVER=fbcon SDL_FBDEV=/dev/fb1 mplayer -vo sdl -ao alsa *.mp4" for the present.

I have a theory now why so many people asked at so many forums how to get X back to the HDMI port, and were all given the same answer that does not work by the gurus at Adafruit and elsewhere. Here's the theory; the gurus actually have HDMI monitors. The people with the problem -- like me -- are using an HDMI to DVI adaptor to drive a DVI monitor. So my bet is that when the Pi doesn't "see" the full HDMI it expects at the other end of the cable, it throws up an error and reverts to the last-used display port. Thus going back to the PiTFT instead of switching to the HDMI as requested.

And the gurus never realize this because their gear is too good; they never experience this problem. Whereas the poor noobies are left with no working answers and get frustrated and after a few more posts, leave.

Anyhow.

I have control now. And I figured out how to resize enough of the icons and otherwise reorganize X so I can sort of work with it on the tiny 2.8" display. So I have a couple of options to make transportable, battery-powered control of the Pi. My aim is to make a Headless Pi, but reality is I'll probably have to go in and tinker with stuff anyhow.

I also have some options for my eventual goal of playing mp3s off a USB stick. Unfortunately, the plug-and-play options -- aka various flavors of Kodi -- aren't easily compatible with the 2.8" display. So I'm looking now at either a lot of tinkering to get various third-party projects adapted to my particular hardware, or rolling my own. Either option is going to require a lot more time staring at the command line. And going deeper into programming for the Pi, too.


Friday, October 23, 2015

Pi-radigm

Although the boards look vaguely similar at first glance, Raspberry Pi is quite different from Arduino. The difference is not in functionality (although it has that, too); the difference is in paradigm.

Arduino is at heart an AVR chip. Imbedded micro-computer designed for physical computing; reading knobs, controlling LEDs and servos. When you work with an AVR you are working practically on the bare metal (as the old computer people would call it). Although the Arduino IDE (programming environment) offers some slight distancing, you are basically throwing together straight C code which is compiled right into the chip.

I don't know how I can express the visceral sense of this on the non-programmer. When you write "sudo apt-get install mpg123" on a Linux command line you are passing on a general idea to a host of smaller programs which check your bona-fides, look to see what is installed already, talk to yet other programs which help them get online and look for the materials they need to fulfill your request, etc. When you write "DDRA = (1 << 7);" you put -- after a trivial bit of math -- voltage on the selected pin.

The AVRs are tough. Nominally 5v (or 3.3v) devices, you can run them from under two volts to six or seven volts before they start getting buggy. You can abuse the inputs the same way, and the outputs are beefy enough to drive high-intensity LEDs. Anti-static measures are pretty much extraneous. They would like to see a nice steady clock signal as well but if your application is brute force and ignorance (like flashing a couple of LEDs) then the internal clock is close enough. Same for protecting the chip from power fluctuations or holding down unused inputs; although the Arduino does all of this, it isn't unusual to find an AVR with nothing attached to it but batteries and a load.

Raspberry Pi is a computer. That means it has a whole operating system in there, with GUI if you want it. It is generally expected to be connected to the internet, and it is fitted out with standard USB (host) ports and HDMI output and even a little headphones driver. Doing any one of these tasks will practically cripple a poor AVR.

But with that operating system comes overhead, and the pitfalls. Raspberry Pi's do crash, sometimes corrupting the OS in the process. They are sensitive to what happens at their general-purpose input/outputs. And when you program, even though you are generally working at just a coat of paint (X-windows) from the Linux core, and even though you are frequently at the command line (so much so that command line forms an integral part of the interface window for many programs), you are still at several layers of abstraction as your commands are invoking various helper programs which are accessing several libraries which are eventually calling on built-in functions within the Linux kernel.

And which means you aren't going to be seeing the same kind of documentation from me about Raspberry Pi as I've given on the AVRs. Because it is a computer, meaning every installation is subtly different and every experience becomes different. What worked for me in setting up the Adafruit PiTFT touch-screen and SSH from my MacBook may or may not work for someone else, even if they have a seemingly identical setup.


Thursday, October 22, 2015

Fruits and Nuts

I got my Raspberry Pi working. Turns out neither of the images from Adafruit boot up "instantly" but with an adaptor from RadioShack I was able to see Raspbian installing. Funny, isn't it, how computers all moved to HDMI outputs but monitors continue to be made with mostly DVI inputs. Is anyone paying attention out there?

Once I had the Pi working, I got it online via an ethernet cable and Wireless Sharing off my Powerbook; it sees my AT&T wifi, then passes it on via the ethernet cable to the Raspberry Pi. Fortunately I've got a pre "retina" Mac so it still has an Ethernet cable. What's next, Apple? Dump the USB connector and force everyone to use officially unsupported external hardware for that, too?

Anyhow. With a working connection (thank you, random blogger who explained how to dummy up a DNS addy for the Raspi to see when it tries to connect), I could go into Terminal/command line mode and patch the kernel from Adafruit's site until the 2.8" TFT touch-screen worked.

Unfortunately, the touchscreen is all but unreadable and unusable in the GUI. Just not enough screen real-estate, and too many windows don't resize (and can't be dragged so all the contents are visible). So I imaged that working OS and reconnected the HDMI.

Next thing to try was OSMC. Which looks very cool, but was just a little opaque. I watched an anime episode off a flash drive, which looked pretty decent -- the quad-core in the Pi 2 is working hard, even at a mere 700 mHz. But there doesn't seem to be a simple way to get to the command line any more, and the software threatens to auto-update anyhow, so it seems a chore to patch that kernel to use the mini display. That, and I'm not sure it can be resized to be useable, either.

I really need something simpler, anyhow. My first goal is just to be able to do a simple slide show (I want to show some pictures of recent projects to my dad, and he has no online presence, and laptop or even wall outlets are inconvenient for our usual meeting-up place.) My next goal is to make a music player that improves on my cheap-and-basic mp3 player by actually displaying track names and allowing you to chose which album to play from. Okay -- I suppose I could just go back to minidisc, but getting the albums in there isn't simple.

SSH seems to be the ticket for working up said slide and music players; set up the Raspi for the tiny display (with the same footprint as the Pi itself) and use my laptop for the full keyboard and bigger display to play with the command line and wrangle code.

So, whatever, I'm installing a fresh Raspian now and after I get SSH running so I can navigate in from my laptop, I'll patch THAT version with Adafruit's touchscreen files...




Success so far. Put in a fresh install of Raspian from NOOBS and tested omxplayer from the command line. Got SSH running -- was dead-simple to do -- and invoked omxplayer on the Raspberry Pi from the SSH terminal window on my MacBook. Oddly enough, hotkey command of omxplayer then defaults to the SSH terminal that invoked it; I can pause or skip the video from the MacBook.

What I'd like to know now is if I can send images to the tft touch-screen without having to have that the default monitor. SSH is nice but would be nice to be able to use the GUI when not running the Pi in "headless" configuration. Looks like it might be as simple as keeping the "console" in default and invoking the framebuffer image viewer to buffer #1 instead of buffer #2. But I need to back up my current install or better yet get a new SD card to try this on...

Monday, October 19, 2015

Fresh Pi

I worked the East Bay Mini Maker Faire yesterday. It seemed calmer, also smaller than the years previous. I was only supplying PA to one room this time, and I didn't have any competing gigs, so it was a very relaxed day for me. I tried not to pack too much this time; even though I did end up with extra, I didn't feel like I was making a hundred trips to the car lugging audio gear.

Basic PA was my two Jolly 5A's mounted horizontally with an ad-hoc adaption of the U-brackets I bent out of bar stock a number of years ago -- bolted them to Yamaha stand adaptors and that let them sit on top of my 6' On-Stage speaker stands. I did try to print a more elegant adaptor, but the print from the M3D Micro failed under load. I'm pretty sure the SLS (nylon) prints I've been getting at Shapeways would have held up. And I think I got better adhesion between layers with the Type A machines at TechShop, too. Not to say the Micro can't be tweaked a little and possibly get better performance...

Anyhow, ran them from my aging Mackie 1202VLZ Pro, so I could patch four different microphone options -- hand-held, hand-held wireless, lapel mic, and headset mic -- as well as a stereo feed for any audio tracks that might come with the various video presentations.

I did use all the mics. It was nice to have those options, in fact; some lecturers were comfortable with a hand-held and some wanted to go hands-free. The only failure was one very quiet speaker that went with lapel (and would have benefitted from headset mic).

I stuck compressor, Lexicon effects processor, and a Firewire interface in the rack but didn't use any of them. Basically, the rack functioned as a mixer table. If the layout had been very different, I was thinking about going Maker and using Reaper as speaker processor (and probably mixer as well). But I didn't need the various delays I was contemplating, or a graphic, or even compression (except for that one presenter. Sigh.) So I kept it simple -- simple enough I could just hand the mic over then go stroll the faire.



This time was volunteer. I wanted nothing more than ticket, lunch, and a t-shirt. Didn't get a t-shirt (that makes three years running they've forgotten!) Lunch was skimpy. So on one of my wanders I picked up a bottle of honey from some of the beekeepers. And a Rasberry Pi.

Been meaning to play with Pi sometime but the price point always made me re-think. So grabbing one on day-of-faire sale was a good way over that hurdle. I've just started looking into what I need just to get the thing up and running. I don't think I even have any spare keyboards drifting around. Bought a touchscreen, but there's a Munchausen problem here; have to get in to the Pi to program the touchscreen to be able to use it to get into the Pi.

So I'm probably dropping some more bucks at Adafruit. I'm in no hurry. I think working with the Pi is going to improve my Linux/command line skills, and I have thoughts towards building my own media player (I'm getting bored enough at work to listen to music I bring, and the only portable player I have is a no-name three-button MP3 player that doesn't give the ability to select albums or even see what you are playing. Was $2 at Allelectronics and I got two of them entirely as a possible cheap sound playback device for future props.) But other than that I have no real application for Pi.

Really, electronics speaking, I need to move ahead on the next revision of the DuckNode -- specifically, work up the Holocron fork, with an on-board LiPo management system. Gonna be a lot more surface mount in the next iteration, too. Someday I need to either build a reflow oven, or learn about Seeed Fusion (or whatever they call the thing that looks like it might be a full board fabbing service).