Disco Board Project
To bring back the funk.
The intent of the Disco Board Project is to construct a device that will synchronize the flashing of lights with peaks in certain frequency ranges in a waveform; namely, components of the beat in songs. This will be accomplished using a real-time processing component of MATLAB coupled to a series of relay switches. The MATLAB component (specifically, the audio processing toolkit in SimuLink) will read input from a computer port (most likely a microphone in or line in). It will apply a series of bandpass filters to the input data; the frequency ranges that are "passed" will be chosen such that they encapsulate the relevant parts of the input. In the case of a song, these would be frequency ranges corresponding to the kick drum, snare drum and hi-hat. The output of the bandpass filters will then be evaluated as an absolute value (giving the magnitude of the signal) and then smoothed with a low-pass filter. An IF statement will then determine if the magnitude of the signal has exceeded a prescribed value; when it does, the program will send a signal to a relay and a light will flash. If all components work as described above, the user should be able to notice a clear correlation between the beats of their song and the flash-pattern of the lights, and will have some pretty bitchin' lighting for their next party.
4 - 120v AC Relays - available from Ed Jaoudi
4 - Female 120v AC sockets, grounded, surface-mountable
4 - 470Ω resistors
4 - 2v LEDs
1 - Terminal block, 16- to 22-ga. wire
1 - Male 120v AC extension cord, grounded
Contingent on method of interface between computer and relays:
- Method of interface - must be able to accept data from USB or serial, send 3.7 to 32v DC
- Appropriate wiring to connect interface to relays
Week of 11/17: Preliminary Planning
Week of 11/24: Have basic skeleton of program completed
- Audio input set up
- Bandpass & lowpass filters understood & configured
- Preliminary testing - non-real time, use signal generator if necessary
Week of 12/1: Convert to Real-time Processing, Construct Relay Board
- Figure out method of running Relay Board
Weekend of 12/6: Test & debug until day of presentation
The Disco Board Project successfully completed its intended goals, managing to read an audio input, extract the beats from the song, display the beat pulses as flashing lights and generally bring back the funk.
Currently, the Simulink model DLP.mdl reads audio at roughly 11,000 samples per second, passes it through 4 separate channels each containing a bandpass filter, an absolute value evaluator, a lowpass filter and an IF logic gate, and outputs the resulting Boolean values to a PC's printer port. Within this model, the coefficients of the bandpass filter (in this case, created with a discrete transfer function block)and the value that the audio signal is compared to at the IF gate are taken from the MATLAB workspace, and are generated in a GUI written by the excellent Mr. Taylor Chen.
Once the data has left the printer port, it is sent to a series of relays; these take the small voltage (+5vDC) given by the printer port and use that to turn on and off a 120vAC circuit. A total of four separate devices can be independently run with the current configuration; more than enough for most musical applications.
The Disco Board Project does have a number of shortcomings, which fall largely into 2 categories; inherent shortcomings and time-created shortcomings.
- The inherent shortcomings are mostly focused around the inherent inaccuracy of the Disco Board Project's waveform analysis method and input method. Audio decomposition is a hugely complex problem which has yet to be satisfactoraly solved; using bandpass filters to extract components of a song is an extremely primitive way of doing this. The bandpass filter does not listen for single instruments but general frequency ranges; as most instruments span almost the entire frequency spectrum, looking at a specific frequency range makes it very difficult to isolate spikes in a single instrument's amplitude. Furthermore, the method of input (plugging one computer into another computer's line-in jack) produces numerous opportunities to alter the audio signal before it reaches the Simulink code - in the first computer's preamplifier, in the first computer's headphone or line-out level and in the second computer's line-in level. Finally, the inherent pokiness of Simulink causes the program to lag a fraction of a second behind the audio signal in terms of flash-beat synchronization. A possible fix for this may be as simple as lowering the sample rate of Simulink, but there may be no way around this obstacle short of compiling the code as C code or a .EXE.
- The time-created shortcomings are focused around the overall usability of the project, and are caused by the narrow time window of the project and its creators' overwhelming mass of other time commitments. The Disco Board Project is in many senses extremely practical - beat-synchronized lights are an asset to any party, and only more so on a college campus. However, for the project to be truly useful, it must be easily deployed and used by a wide range of users on a wide range of machines. Ideally, this would mean the DLP.mdl code running in real-time as a .EXE, with a fully-fledged GUI (complete with level indicators for each channel)covering the entire project. Filter coefficients would update in real-time, and the output would not be through the largely obsolete printer port but through a more common port such as USB. Unfortunately, the time window given for the project was too narrow to allow such further developments. In hopes that others may be inspired to continue the Disco Board Project's development, all Simulink models, GUI files, M-Files and assorted other errata associated with the project have been posted to this webpage. If anyone would like to test their code with the Disco Board Project's relay board, please contact Taylor, Ozan or Julian.
Please use all project files respectfully.
Code, Simulink Model & GUI:Disco Board Project Files.zip
- Included in the above file are the GUI's .fig and .m files, the DLP.mdl Simulink model and the .m files used to calculate the bandpass and lowpass filter coefficients. Please note that use of DLP.mdl requires that the Data Acquisition Toolbox be installed on your computer.
Schematic for relay board: Instructables.com