Weblog

VCDO update: delay tables

Submitted by John on Mon, 06/29/2020 - 20:27

This weekend I spent quite a bit of time working on re-writing my delay table generator. 

The 8 bit VCDO generates an audio signal by spitting out each sample of a waveform, one at a time. I do not use a timer on the chip to achieve this (maybe I should have). Instead, I manually track how many processor cycles take place every time I go through the main loop. Depending on what pitch I am trying to achieve, I delay a specified number of processor cycles (fetched from a lookup table) before moving on with the loop. 

Since the VCDO has a range of 5 octaves, and the base waveform has 256 samples, as the pitch goes up, there are physically not enough processor cycles to be able to continue to do this. At this point, instead of using every single sample in the table, I start skipping one sample in the table per run through the main loop, then skipping three, four, five, six, etc. 

Today's post is focused on the delay table.

Very early on in this process (uh, back in the mists of time), I wrote a delay table generator program. Given the number of octaves, the number of sample steps, etc, it would spit out a delay table (and a step table, remember that at the right points I have to start skipping steps so I need a lookup for those as well).

Because there are only 256 possible voltages for the full 5 volts of input range, I had to do some massaging around semitones, I wanted semitones to be in tune, but the stuff inbetween was fine if it was not. Well then there's this whole mess around do you have 4 steps between semitones or 5, because 60 semitones (5 octaves, 1 volt per octave) is not a divisor of 256. The delay table generator takes all of this into account. I wrote it in a furious fit of staying up super late in an 8-9 hour binge and by the time it was done, it was quite the mess. "But there, that's settled" I thought to myself and happily moved on. 

Well now it's a decade later. My ancient version of Visual Studio no longer runs happily in Windows 10. The community version of Visual Studio refuses to load programs off of clay tablets unless I pay Microsoft some money for a full license. I am hazy on the licensing details because I started trying to modify the delay table last September, but the full story is I said "screw it" and I started porting it to Python. I made some progress but it was rather tedious because the code was rather.... unique in terms of structure and naming conventions, as one would expect if one knew that it was completed at 3;30am in quite a state of sleep deprivation. 

The Python port started back in September.

I dusted it off again in April and started poking away at it. First step was to try to figure out what the heck was going on. In September I was taking a rather literal approach to the translation, and I was still relatively new to Python. So I wasn't even trying to understand what I wrote in C#, just trying to take each line one at a time and move it over. 

Now I know a bit more about Python.  I quickly translated the rest of the C# to python, and started trying to understand what was going on. It was slow going, and it quickly this turned into debugging, because I found quite a few bugs. Based on the print statements I put in, I don't know if these are existing bugs from the beginning of time or if they are new bugs that I put in when I did the translation to Python. 

In April, I had a vague idea of what is going on. I identified many of the bugs. I wrote (but did not finish) this blog post.

Over two months later, over this past weekend, at the end of June, I looked at it again and despaired. Because I had totally forgotten about this blog post. I also didn't leave myself any documentation about where I was at with it, or what I was in the middle of doing in any way. All I could remember is I did a bunch of refactoring right before I stopped working on it.

After much peering and poking and prodding, I determined that I had indeed finished it, and fixed all known bugs. All I had left to do was take the results and iterate through them to put them in a format that I can easily input into my assembly language source file. I got that finished.

Then, I found this nearly finished post in my drafts folder! Sure would have been easier if I would have finished the post at the time and uploaded it... ah well. I did some light editing of the text above so it all hopefully makes a bit more sense, and here we are.

Next step is a source code audit for the whole synth engine to ensure that the cycle counts are accurate. This is 98 percent complete, in terms of lines, and 75 percent complete, in terms of difficulty. (That is to say, the pieces remaining are not straightforward and there are many branches. If I can trim a few cycles off this one bit, I may be able to trim a few cycles off the main loop, which will be nice. (The fewer cycles the main loop runs at, the smoother it is in the upper registers.)

Once I have accurate cycle counts for the whole shebang, I can plug those into the delay table generator so I have accurate delay information. Then finally, I can do an end-to-end test, where I plug in the delay table, and then test the waveforms coming out of the synthesizer engine to verify that they are accurate and I didn't mess anything up.

Tags

Justice for George Floyd

Submitted by John on Tue, 06/02/2020 - 20:38

A few things on my mind.

The first is, all of this is hard to talk about. Because, I mean, who am I, right? Just some white guy. Do I really have anything to say?

I used to live in the Longfellow neighborhood and would drive by the third precinct a few times a week. But I feel like my connection to the neighborhood was more of a geographical connection, than a connection with the community. I made friends with some of my neighbors, of course, but none of the friends that I made when I lived in Longfellow were part of the black community. (I regret that, and maybe I can tell that story of how my racism has impacted my life (and made it poorer) some other time.)

Also, hello friends. I should have started with the greeting, my apologies. I hope you are doing... as well as possible under the circumstances.

I don't know what you are thinking right now. But yes I have seen the video. I've seen that video too. And the other one, and those five that were posted yesterday evening. The video of George Floyd. Videos of protestors getting beaten by cops. Videos of cops getting bricks thrown at them.

And not just the videos, but the photos. And not just the photos, but the memes. (There's a lot of it out there, maybe you've noticed.)

Again, I keep coming back to, what do I have to say? What am I bringing to the table?

Most of you know but my wife is expecting a baby, literally any day now. We are officially in overtime. So I haven't been down to Lake Street since any of this happened. As much as my heart longs to go, my truck is kinda acting up and all through the weekend my wife was having light contractions, so, no. I haven't made it to Lake Street. I haven't made it over to Cup Foods. (I haven't even made it to Cub Foods because they boarded up my Cub here in Roseville.)

But I have so many friends, acquaintances, and coworkers impacted by this. I realized earlier this evening that I have friends who live just off Lake Street. I have friends who own, and who work in businesses along Lake Street. I have friends who are protesting. I have friends who are current police officers (and former police officers). I have friends in the National Guard.

And when I am looking at all of the memes and tweets and videos the only thing I can say is...

I gotta work on me. I gotta work on ME.

I see a video of a police officer shooting a canister of tear gas directly in the face of a journalist. I am not a police officer. I do not have a tear gas cannon.

I see a video of someone setting a fire or throwing some rocks through some windows. I am not going to pick up a rock and throw it through a window. I am not going to light a fire.

So what am I doing?

I'm getting down to basics, and going through a series of YouTube videos about structural racism. I hear people talking about structural (or systemic) racism. I don't understand it.

So far the only things I think I know about structural racism, I have gleaned from watching clips of talking heads and a handful of memes. This is not enough. So I am trying to learn, and I'm specifically trying to learn from college classes streamed online. I'm trying to learn from the folks defining the terms, because I think if I'm going to be part of the conversation I need to understand the words that are being used in context.

I'm also getting down to basics. I'm seeking out sermons and articles and books by Dr. Martin Luther King Jr. I see a lot of memes of MLK, and images of MLK, and quotes from MLK. But when I started getting interested in Dr. Martin Luther King Jr. about a decade ago, I primarily listened to his sermons. And they impacted me and my faith in a way that I am grateful for. So I am working on opening up my heart and learning from one of the greats.

I'm getting down to basics. I want to do something. I'd love to drive down and help out somehow but, you know, the baby (and the other six kids) make that difficult to figure out how to make that happen. I have a friend on Twitter, every day he goes out with his two kids and some brooms and helps sweep up the glass, and I'm kind of envious and wish I lived closer, so it would be easier to leave my home and help in a concrete way. But alas. So I am doing some research into charities, local charities and national ones. And I'm going to give, as I am able, without any expectations. 

I see in my head a vision for what it means for a police officer to have peace with the community he is policing in. From where we stand here today? That peace, that peace seems so hard, so far away, it feels like it is almost going to have to be a peace that comes from God, that surpasses all understanding.

But that's the direction we gotta keep moving toward. Thanks for sticking with me and reading this whole thing.

The classics never get old

Submitted by John on Sat, 04/18/2020 - 16:13

Scene: It's a brisk spring day and I go outside to grab my cup out of the yard where I left it earlier.  Two children were playing basketball a few moments earlier, but now the younger child is crying.

"Daaaad! James kicked me in the face!"

I look at the older child. I see the look in his eyes; I know what he is thinking. After a pause, he replies.

"Well, yah, that's because his face was too close to my foot!"

Tags

Good Friday

Submitted by John on Sun, 04/12/2020 - 21:33

Last Sunday (the Sunday before Easter) our pastor mentioned something about communion "next week". Since we're doing church over Zoom, he said to make sure we have some bread and juice at the ready.

Friday (Good Friday), I had forgotten about the service, so suddenly I looked up at the clock and it's 7:15 oh no run upstairs, start the Zoom, okay, we're listening to a prayer, great.

The pastor says okay now get out your bread.

Oh no. I assumed we'd be doing communion on Sunday. Our church always does the communion on Sunday. I had bread and juice coming via delivery on Saturday, so I thought I was good to go. But I had forgotten that in the actual narrative of The Last Supper, that's when the communion is done, and of course it is on Good Friday.

I know there is no bread in the house but I rush to the kitchen. No bread, but we had Dominos delivered earlier today. I grab a pizza crust. The body of Jesus, broken for you.

I know there is no juice. Or milk. Or anything that is not water, but I opened the fridge door, and there is a little bit of Gatorade. The blood of Jesus, shed for the remission of your sins.

Forgive me Father.

I broke the bread, and passed the cup among my family. And that's how Good Friday went this year.

Ya, we probably got coronavirus

Submitted by John on Wed, 04/08/2020 - 21:08

Phew. It's been a ride. I don't really want to talk about it because I've been talking about it, with friends, and family, and coworkers, and it's been quite the rollercoaster for the past two weeks. Also, it makes me nervous saying "oh, yeah, I had it and blah blah blah," when I have not gotten a test, and I cannot even get a test in my state.

Whatever sort of mystery virus I had, it was horrible (and still is horrible.) The weakness and sudden onset of symptoms was as fast as 15, sometimes even 5 minutes, no warning, just BAM suddenly I can't get out of bed. Or I went for a whole two days feeling like I was breathing through glass.

Here are the things that helped me:

  • Spending a minimal amount of time laying on my back. I didn't know this at first, and discovered (after a friend suggested spending time on my stomach) that spending time resting on my back was aggravating my symptoms.
  • Aggressively rest. My best days were the days when I rested when I was feeling well, and rested when I was feeling the slightest bit out of sorts, and resting all the time. No running. No heavy lifting. No going up and down stairs.
  • Doing deep breathing exercises. I avoided these because they hurt so much. As a friend put it "If you break your ankle, and have to go do physical therapy, it's going to hurt. Do the PT anyway. These deep breathing exercises are like physical therapy for your lungs."
  • Melatonin in the evening to help me sleep, Zinc and Vitamin C in the day.

 

None of the above is medical advice! Unfortunately, the medical establishment has been quite unhelpful when it comes to helping folks with mild to moderate coronavirus infections, riding it out at home. I tried to contact my doctor and it was impossible. I got a telemedicine thing going with the hospital system, and, after they lost my first attempt at telemedicine entirely, they said, "stay home, you probably have it, go to the hospital if you can't breathe" which was what I was doing anyway.

Unfortunately, when I rested aggressively, this meant that I was feeling the best when I was feeling most useless. I'd be laying in bed thinking, is this really it? Is this really the coronavirus? I am SO BORED. I should be GETTING THINGS DONE. But then some days I would feel absolutely fine in bed but if I got up, dizzy and weak.

Then, after I had a couple good days and I was feeling mostly back to normal, I got up, I did a mildly active day, and at the end of the day I just crashed, crashed hard, in 15 minutes or less, and just kept crashing and crashing no matter how much I rested.

I crashed like that twice, about a week apart, the second time was very bad, and in the middle of one night I came to the realization that if I didn't stop this downward trajectory I was on, I was going to have to go to the hospital immediately. Or die. Dying felt like a real option, and I was more annoyed that I had a lot of stuff I wanted to do first and I wasn't going to get to it.

In fact, its hard to explain the state of mind that I was in, because I found that when I was crashing hard, my whole brain didn't work right. In a way that is not easy to quantify. I have a lot of "missing hours" or even, I'd say, whole missing days where I don't even remember what happened when.

Anyway, this is where I'm at right now, I'm trying to take it moderately easy. Still avoiding any hard physical activity. I'm back to work, and sleeping on my stomach.

Not sure what to post about but I guess it’s going to be the Coronavirus

Submitted by John on Mon, 03/09/2020 - 23:56

I’ve wanted to post for a while now but all I’m reading about is the Coronavirus. The Coronavirus is a boring subject for me to write about because the facts are simple, yet the outlook is very uncertain and I have little control over the final outcome.

This is everything I know about the Coronavirus:

  • it’s a bat virus that has made its way to humans. So we have no natural immunity to it
  • very transmissible between humans
  • people are contagious for days before they show symptoms
  • this tells me that we’re all going to get it sooner, rather than later
  • some percentage of people will die from an associated respiratory syndrome, COVID-19
  • we (in the United States) do not have nearly enough hospital beds or ventilators to treat the likely victims all at once
  • so our best bet is to self quarantine and reduce social contact so we can prolong how long it takes for the infection to work it’s way through the population, thereby reducing the impact on the medical system over time
  • currently the number of known cases is doubling every three days. If that trend doesn’t stop soon it will be too late to manage this thing.

Amazingly, some folks dispute all of these facts, and they are dismissive of the whole situation. This boggles my brain.

The reason I am most bored, however, is that you, dear reader, already know more about the ending of this story than I do. Should I panic? I’ve done plenty of that. Sit back and relax until this whole thing blows over? I’ve thought of that too.

Happy Hand Washing!

Fixed a few things

Submitted by John on Thu, 03/05/2020 - 23:46

A few things have been bothering me, mostly related to the D8 migration, so I dug in and fixed them recently.

  • I now have a favicon. I plan on updating the favicon from time to time, unless I forget, in which case I won't.
  • I fixed the tags on the weblog posts. I can now create new tags whenever I am entering a new weblog entry, instead of having to navigate all the way over to the taxonomy page.
  • I restricted the Stella Amp menu to the Stella Amp pages (and got rid of the defunct "Buy it!" menu item.)
  • I changed the title of the weblog in the RSS feed, so RSS subscribers will now see the correct title for the feed (Hello RSS subscribers!)
  • I removed some extra "display titles" on various parts of the site

 

It's much cleaner, but now I want to fix:

  • CSS of menus and the top nav bar, on desktop but especially mobile
  • I'd like some other form of sidebar, not sure what, not sure why, not sure how, but it needs some sort of vertical design element.

Tags

The TSA responds with guidance on flying with large format sheet film

Submitted by John on Sat, 02/01/2020 - 11:39

A few days ago, I posted an article about some new CT scanners that are showing up in airports. These new scanners have more powerful X-rays and are more damaging to analog film.

The article mentioned roll film, but I was curious about sheet film.

So I reached out to the TSA and asked them for guidance about flying with sheet film. I don't have my list of original questions handy (I'll post it later when I come across it) but I did get a response back from the TSA. Here are the latest guidelines on traveling with large format sheet film, as of February 2020:


Thank you for contacting the Transportation Security Administration (TSA) Contact Center.

Most x-ray machines used to screen carry-on bags should not damage undeveloped film under ASA\ISO 800.  There are a limited number of screening checkpoints that use x-ray equipment that may damage undeveloped film.  These airports will have signage in front of the x-ray stating that the x-ray may damage undeveloped film.

If you are traveling with the following types of film, please pack it in a clear plastic bag, remove it from your carry-on bag at the checkpoint, and ask for a hand inspection:

  • Film with an ASA\ISO 800 or higher
  • Highly sensitive x-ray or scientific films
  • Film that is or will be underexposed
  • Film that you intend to “push process”
  • Sheet film
  • Large format film
  • Medical film
  • Scientific film
  • Motion picture film
  • Professional grade film 
  • Film of any speed that is subjected to x-ray screening more than five times

In most cases, the x-ray equipment used for screening checked baggage will damage undeveloped film; therefore, please place undeveloped film in carry-on bags.


 

Don't send your analog film through the carry on baggage scanners!

Submitted by John on Thu, 01/30/2020 - 12:34

Kodak wants you to know that the TSA has some new CT scanners for screening carry on luggage that appear to be more destructive to analog film than the earlier X-ray based scanners were. This new article from dpreview has the details:

Kodak describes the results as 'not good,' saying: 'Just 1 scan shows significant film fogging, leading to smoky blacks and loss of shadow detail. This will be more significant for higher speed films. Although it’s possible that a roll of 100 speed film would show less degradation, we strongly recommend against putting any unexposed or exposed but unprocessed film through a CT Scanner.'

 

In order to avoid this, Kodak tells photographers to keep their film products in a carry-on bag and to request that TSA agents hand-check the film rather than sending it through the CT scanner. The TSA confirmed to Kodak that its agents are trained in hand-checking movie film, roll film and single-use film cameras.

So, I read this and thought, the TSA has trained their agents to hand check roll film, great. But what about sheet film!

First I tried to look up and find anything on the TSA website itself. Nothing. Then I did a google search or two and still didn't find much. There is a post on Michael E. Gordon's blog about flying with large format sheet film that has a horror story and some advice about what Michael does when he flys with the TSA. But that article was from 2012 so it doesn't deal with the new scanners. Also some of the resources he links to in that article are missing from the TSA site.

So I reached out to the TSA today to see if they have any recent guidance on traveling with sheet film. I'll let you know when/if I get a response. (UPDATE: They responded!)

(If you are curious about Kodak's previous research on flying with film and the effects of airport baggage scanners on film, both print film and movie film, check out their 2003 Technical Information Bulletin Baggage X-ray Scanning Effects on Film)