Fall 2004

  • Phys Comp

Fall 2005

  • Advanced Tech
  • The Creative Act
  • Video for New Media

Spring 2005

  • Conceptual Design
  • Networked Objects
  • Video Art

Spring 2006

  • User Centered Design

Post-ITP

Links

  • robseward.com
  • Generative Theory Of Tonal Music Software

Recent Entries

  • Slowly
  • More
  • Light studies continued
  • Continued
  • Library Light Study Continued
  • Library light study
  • Final Project
  • Kitchen Inventory System User Scenario
  • 10 (approx.) Ideas
  • Kitchen Observations 1-5

Archives

  • February 2007
  • May 2006
  • April 2006
  • February 2006
  • January 2006
  • December 2005
  • November 2005
  • October 2005
  • September 2005
  • August 2005
  • May 2005
  • March 2005
  • February 2005
  • January 2005
  • November 2004
  • October 2004
  • September 2004

« Serial Communication Lab--Using Pots to change RGB | Main | DC Motor Lab: A Solar-Sensitive Window Blind Operator »

November 03, 2004

Midi Lab

I got the midi-out up and working. I overcame a problem with the code from the lab web-site, and I modified the picBasic random number generation to work with my application--a sequence generator.



------


I got the midi-out up and working. I ran into a problem in that the code from the lab did not work with my setup. This code:

DEFINE OSC 20
DEFINE HSER_RCSTA 90h ' enable the receive register
DEFINE HSER_TXSTA 20h ' enable the transmit register
DEFINE SER_BAUD 31250 ' set the baud rate

needed to be changed to:

'setup hardware serial port:
define HSER_RXSTA 90h
define HSER_TXSTA 20h
define HSER_BAUD 31250 'midi data rate

Once I got that working I thought of an application. In 20th-century music theory a la Schoenberg, a sequence of unique pitches can be used to create serial music. I thought I would create a device that could generate a 7-note sequence and, at the push of some buttons, play it in retrograde, inversion, and transpose it. However, due to time constraints I only got as far as generating a random 7-note sequence.

Overcoming lousy random number generation:

For my application, I had a button that triggered a function that put random numbers in a 7-element array. This array was then converted to pitch so a 7-note sequence would play. Pressing the button would produce a new sequence. However, the RANDOM function produces the same random number ever time the chip is turned on. Every time I turned on the chip I would get the same sequence. To overcome this, I enabled a counter that would increment with each iteration of main. I then added this counter to the newly generated random number. To convert this to a pitch I did modulo 12 on the random number. There is the possibility that the random variable with the addition of the counter could exceed the memory allocation of its data type. Does anyone know what happens when that occurs?

Here's the code.

Posted by rus200 at November 3, 2004 01:00 PM