Last week, in Part I, we began our audio excursion. In Part II, we resume our patterns of discovery in the parallel universes of software and music.
Software contains a meaningful purpose, realized during run-time execution; likewise, music's raison d'être achieves its ultimate goal when performed and heard.
Iteration and Passacaglia
filenames = z.namelist()
filename = ''
for fname in filenames:
filename = fname
Passacaglia and Fugue in C minor, Bach
We attempt to find a specific file contained in the IPA archive with our match pattern (variable
), one file after the other, step by step, check by check. This repeated process happens blazingly fast, thanks to the advanced microcircuitry in contemporary CPUs. When a match occurs, we
out of the loop; it's done before we know it!
The repeated process in music can be presented in many different ways, with correspondingly different terms: rondo, theme and variations, canon, chaconne, passacaglia, etc.
The great conception of Bach's Passacaglia and Fugue (BWV 582) does not play itself out in a few milliseconds, like our python loop. Instead, the repeated bass line, over which continually shifting harmonic progressions are set, takes 600,000 milliseconds to complete. Admittedly, there's more going on in Bach's mind than in our simplistic iterator!
In the final analysis, I have to say that I really dig this organ piece.Is the Tempo Just Right?
WARN_PERIOD_DAYS = 14
expire_date = self.profile['ExpirationDate']
diff_date = expire_date - datetime.today()
days_until_exp = diff_date.days + 1
if days_until_exp <= WARN_PERIOD_DAYS:
self.warnings['expire_soon'] = True
Peaches en Regalia, Hot Rats, Zappa
Sometimes business rules involve time, schedules, and dates. And then you need to perform date calculations. We're not in base 10 anymore. Or base 2. We're actually in that weird place that I like to call date math
Lucky for us python provides the flexible
module. It makes solving date calculation problems almost fun. Sort of.
What does this have to do with Frank Zappa's little masterpiece, recorded way back in the previous millennium in 1969? Peaches en Regalia
has no expiration date!Recapitulation
Our python script is not yet done, insofar as this post is concerned. So please come back next week to join the conclusion of our musical journey in Part III.