Saturday, July 07, 2012

Flash / EEPROM Music: 29F010 Sample Playback

Video Example: Manipulating Address Lines for Audio Effects





Overview
I am interested in exploring the 29F010 flash chip as a means of audio sample storage and manipulation. This post will describe a basic setup whereby a sample is stored in the 29F010 memory, and is recalled in a loop continuously.

The basic idea is this: A square wave is generated, which in turn generates a set of address bits, which in turn are sent to the 29F010, which recalls each sample located at that address, which is then presented at the digital data outputs of the 29F010, which in turn are sent through a resistor to resistor ladder, which acts as a digital to analog converter.




Preparing Sample Data
The first stage in the process is to prepare the audio sample data. the 29F010 has 128KB of memory, which is 131072 bytes. At a sampling rate of 44.1KHz, 131072 bytes of memory would hold 131072 / 131072 = 2.97215419501134 seconds. At a rate of 161.15 beats per minute, eight beats equals 2.972 seconds.

Once a standard, uncompressed audio file has been created, it's a matter of converting that data to hexadecimal data so that it can be stored as a binary file. I used my audio2bits hex Max patch to do this task. 


Copy and paste the output of the audio 2 bits hex converter to a new binary file. I used Hexfiend for this task.


Next, simply program the 29F010 chip using your E/EPROM/FLASH programmer. 






How the Hardware Works
The three chips that are used in this post are the 74HC14, the 4040 and the 29F010. 

74HC14


4040



 
29F010


A square wave is generated by a 74HC14 hex inverter using a RC type oscillator. This is a very simple oscillator circuit, whereby an inverted feedback signal is used in conjunction with a capacitor and a variable resistor (potentiometer) to generate a square wave. 

This square wave is responsible for the timing of the circuit - in other words, it control the sampling rate of the playback of the audio sample.

This output is sent to the first of two 4040 binary ripple counters. This is a chip that takes a square wave signal, and outputs up to 12 squarewaves, each of which is half of the frequency of the previous. 

The 4040 is a binary counter / divider. Although this may sound daunting, what it actually does is very simple. It has a single input. If a square wave is applied to this input, the outputs (called Q1 to Q12) each oscillate at a rate related to the input freqeuncy. Q1 oscillates at a frequency that is half of the input frequency. Q1 at one quarter. Q3 at one eighth and so on.

If the output frequencies are within the human hearing range, they will sound one octave apart - with Q1 being the highest and Q12 being the lowest (eleven octaves below Q1).
 
This relationship can be represented as a timing diagram, shown below:

CK -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

Q1 --__--__--__--__--__--__--__--__--__--__--__--__--__--__--__--__

Q2 ----____----____----____----____----____----____----____----____

Q3 --------________--------________--------________--------________

Q4 ----------------________________----------------________________

Q5 --------------------------------________________________________

and so on


The first eight outputs of the first 4040 are connected to the eight first address inputs of the 29F010. The eighth output of the first 4040 is also connected to the input pin of the second 4040, chaining them together. The first nine outputs of the second 4040 are connected to address inputs nine to sixteen of the 29F010.

If we consider each square wave that is coming out of each 4040 to represent a single bit, whereby 0V is zero and 5V is one, then by combining the two 4040 chips together we can count through the entire address range of the 29F010 - i.e. from 0 (or 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 in binary) to 131071 (or 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 in binary).

In the timing diagram example above, we can count from o (or 0 0 0 0 0) to 31 (or 1 1 1 1 1) - it's simply a matter of extending the number of square wave bits so that we can cover the whole address range!

The output of the 29F010 (i.e. each sample byte) is sent through an eight bit resistor to resistor ladder. This ladder converts each sample into a comparable voltage, thereby acting as a digital to analog converter.



Schematic






Breadboard

3 comments:

  1. Great to see you venture back into the hardware side of music generation.

    I would love to see you build this out into a more substantial (maybe even live ready) instrument. Multi timbral? Maybe a multi tracked beatbox of sorts?

    Cheers from Holland!
    -Devjock

    ReplyDelete
  2. super interested in doing something like this... would it be ok to use a 29f040 instead? its something like 4 Mbit. its just whats handy though :P

    ReplyDelete
  3. Nice nail color, Sebastian! :P

    ReplyDelete