Magnetic Resonator Guitar (MR.G)

From Lofaro Lab Wiki
Revision as of 16:55, 26 November 2014 by Wsnellbaker (Talk | contribs)

Jump to: navigation, search

Magnetic Resonator Guitar information will go here

1. Overview 2. Circuit Schematic 3. PCB design 4. Raspberry Pi setup 5. Coding 6. Initial Prototype 7. Final Report

Overview

The Magnetic Resonator Guitar (MR.G) was inspired by Drexel's Magnetic Resonator Piano. Much like the Magnetic Resonator Piano, MR.G is a hybrid acoustic-electric instrument. By that we mean that the effects are produced electronically, but the sounds the guitar produces are entirely acoustic.

Schematic

Circuit and PCB Design

PCB Design
All files are provided at the end of this article so you may have a PCB.
Parts list to populate PCB
Resistors
1K = R1,R6,R14
2.2K = R2
10K = R4,R5,R13
22K = R9,R10,R11
100K = R3,R7
220K = R12
1M = R8
Capacitors
0.1uF (Tantalum) = C2,C4
0.1uF (Mylar) = C5,C6,C10,C12
0.33uF (Tantalum) = C1,C3
1.0uF (Tantalum) = C7
10uF (Electrolytic) = C8
100uF (Electrolytic) = C9
1000uF (Electrolytic) = C11
ICs
Voltage Regulators
78M16 or 78M15 = VR1
78M12A = VR2
Amplifiers
TLC37M4CN = U1
LM1875T = U2

Raspberry Pi Setup

Code

For Audio processing on the Raspberry Pi please see AudioStatic's Low-Latency Audio on RasPi tutorial

For handling the guitar's signal we used a Python library called PYO. Shown below we have all the code we have used on for producing various effects.

Simple PYO Server

The following code will instantiate a pyo server on the Raspberry Pi and output a Sine wave. Please note that you must be using X11forwarding in order for this to function. Also, if you're running this in IDLE, you do not need to include s.gui(). However, if you're running this code from terminal you will need to append s.gui() to all of your PYO code. If s.gui() is not at the end of the code, when it is being run in terminal, the code will finish being executed before it has actually had time to send any information to your computer for processing.

 from pyo import *
 s = Server().boot()
 s.start()
 a = Sine(freq=440,phase=0,mul=0.1,add=0).out()
 s.gui()

Frequency Tracker

The following code will sample the audio input of your computer and output the corresponding frequency of the input signal, by using the Yin Algorithm [1].

 from pyo import *
 s = Server(duplex=1).boot()
 s.start()
 a = Input(0,1,0)
 fq = Yin(a,tolerance=0.2,winsize=1024,mul=1,add=0)
 wave = Sine(freq=fq,phase=0,mul=1,add=0).out()
 s.gui()

Phaser

The following code incorporates several synthesis operations and techniques. This code uses LFOs, which stand for low frequency oscillator. Basically, they are used for creating rhythm and they typically oscillate below 30Hz (more information may be found in this wiki article: [2]).

This first example uses the PYO function Noise as an input, just so you may test this out on your computer and hear how the effect sounds.

 from pyo import *
 s = Server().boot()
 s.start()
 fade = Fader(fadein=.1,mul=0.7).play()
 a = Noise(mul=.25,add=0)
 lf1 = Sine(freq=[.1,.15],mul=100,add=250)
 lf2 = Sine(freq=[.18,.15],mul=.4,add=1.5)
 b = Phaser(a,freq=lf1,spread=lf2,q=1,num=20,mul=.5).out(0)
 s.gui()

Now, to make the previous code accept the guitar input. All you have to do is change out the following line:

 a = Noise(mul=.25,add=0)

to

 a = Input(chnl=0,mul=1,add=0)

Now your code should look like this:

 from pyo import *
 s = Server().boot()
 s.start()
 fade = Fader(fadein=.1,mul=0.7).play()
 a = Input(chnl=0,mul=1,add=0)
 lf1 = Sine(freq=[.1,.15],mul=100,add=250)
 lf2 = Sine(freq=[.18,.15],mul=.4,add=1.5)
 b = Phaser(a,freq=lf1,spread=lf2,q=1,num=20,mul=.5).out(0)
 s.gui()

Sawtooth

The following code samples the input audio using the Yin algorithm and outputs to a sawtooth waveform.

 from pyo import *
 s = Server().boot()
 s.start()
 a = Input(0,1,0)
 yin = Yin(a,tolerance=0.2,minfreq=60,maxfreq=1500,cutoff=1500,winsize=1024,mul=1,add=0)
 wave = SuperSaw(freq=yin,detune=0.5,bal=0.7,mul=1,add=0).out()
 s.gui()

Prototype

Final Product