Monday 30 March 2015

Project Explained Part 3 - The Diffuser as a PJ mapping screen

So to start off this post, I have a photo of the setup I was using when I first moved into my Uni flat.


A computer, a second monitor and my Event 20/20 Studio Monitors (speakers). Unfortunately I had phone issues about 16 months ago, so this is one of the only photos I have of this time, I wasnt anticipating them being in anyways useful to me for my honours at the time!

All of this was connected to a Focusrite Sapphire 6 Soundcard, kinda an industry standard and pretty shitty piece of gear, as my audio interface. As you can see also, I had gone down the road of acoustic foam, through sheer ignorance basically. If you can imagine a rectangular room behind the camera, big enough for a double bed and a small lane down the right side of the room to walk in - not much floor space at all.

This room actually naturally sounds better than the last room I was in, but it is far smaller. It is also my bedroom, which the last one wasn't. I have found ever since I got here that it is quite a creatively prohibitive space. It's actually a lot of the reason I chose my project. Though it has evolved through the year, it has always been about either Acoustics or Audio reactivity in visuals, in particular how colour can represent sound.

So the center piece of my project is going to be an audio reactive acoustic diffuser, along with projection mapped 1.2m x 0.6m corner straddle traps, acting as screens. The diffusers block faces shall also be mapped.... But hold on, what the hell is a diffuser? I haven't talked about that yet...

So we know that we want to absorb frequencies to prevent things like Comb Filtering from early reflections, and standing waves caused by the physical shape of the room and the materials it is made from. However if we were to just use absorbtion then the space will become to dead. Taken to the extreme, the space would become what is known as an anechoic chamber. This is a space where there are no reflections and humans actually find this environment extremely disconcerting (though it is argued over). here is a video showing what an anechoic chamber is and what it does to most humans.


And here is a video arguing the point


Both have great descriptions of what the chamber is and what they are used for. So yeah, back on track. This is not what we are looking for in a music studio control room environment, so we use diffusion to actually reflect some frequencies back into the room. But I thought we were trying to avoid this !?

Well basically a diffuser is designed is such a way as to scatter frequencies back into the room at different angles and tiny timing differences. In the pro studio pictured in the previous post, you can see one type of diffusion used behind the speakers - the curved face to the grey panels behind the speakers will scatter whatever hits it evenly on the vertical plane. To demonstrate different types of diffusion, here are some pictures with a brief explanation of each.


Say what? Yep. It is known that general clutter around a room is good for breaking up sound in a room. The king of this effect in the common house is the bookcase.

Next we can have a look at some mathematically devised diffusers. I should start this by saying that the grounding for these ideas come from the BBC's research in the 50's and 60's into acoustics. Here is a link to where you can get in about that if you want. The first is the BBC's guide to acoustics in architecture.

http://downloads.bbc.co.uk/rd/pubs/archive/pdffiles/architectural-acoustics/bbc_guideacousticpractice.pdf

And then below we have the document specific to diffusion. It goes into the reasoning behind why the BBC chose the design they did, including the diffusion characteristics and materials used.

http://downloads.bbc.co.uk/rd/pubs/reports/1995-01.pdf

So this original design is what is known as a Skyline diffuser, or PRD (Primitive Root Diffuser). The idea with these is to chaotically scatter audio frequencies within a space so our ear cannot tell the direction or exact timing of the reflections of the sound in a room. Here is a screen shot from a program called acoustic calculator that I was originally going to use.


 You can see a grid of squares above, numbered from zero to four, resulting in five different lengths in the diffuser. The pattern of placement is calculated through the equation.

Here is a quote from Wolfram Mathematics.
"A primitive root of a prime p is an integer g such that g (mod p) has multiplicative order p-1 (Ribenboim 1996, p. 22). More generally, if GCD(g,n)=1 (g and n are relatively prime) and g is of multiplicative order phi(n) modulo n where phi(n) is the totient function, then g is a primitive root of n (Burton 1989, p. 187). The first definition is a special case of the second since phi(p)=p-1 for p a prime.
A primitive root of a number n (but not necessarily the smallest primitive root for composite n) can be computed in Mathematica using PrimitiveRoot[n].
If n has a primitive root, then it has exactly phi(phi(n)) of them (Burton 1989, p. 188), which means that if p is a prime number, then there are exactly phi(p-1) incongruent primitive roots of p (Burton 1989). For n=1, 2, ..., the first few values of phi(phi(n)) are 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 4, 2, 4, 2, 4, 4, 8, ... (OEIS A010554). n has a primitive root if it is of the form 2, 4, p^a, or 2p^a, where p is an odd prime and a>=1 (Burton 1989, p. 204). The first few n for which primitive roots exist are 2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 17, 18, 19, 22, ... (OEIS A033948), so the number of primitive root of order n for n=1, 2, ... are 0, 1, 1, 1, 2, 1, 2, 0, 2, 2, 4, 0, 4, ... (OEIS A046144)."

Understand? Yeah, me neither. What is important is that it works and looks amazing. Though mine isnt fully constructed yet, this isn't dissimilar to how mine will look. If you can imagine this with the LED strip round the side of the base plate, you can imagine how my project will look. The second aspect is using audio reactive projection mapping as I have talked about. Each face of the diffusers posts will be mapped as an individual screen, will a specially devised colour organ that I have made using Resolume and FFGL plugins.

The main difference between this one and mine, is the maths. I have known for ages that there are two types of acoustic diffuser - Primitive Root/Skyline and QRD. The second is a different mathematical equation, designed again to scatter sound, but this time in a more orderly fashion. It stands for Quadratic Residue Diffuser and it scatters sound on a 1 dimensional plane. Or so I thought... Here is an image of a room employing a few of them :P.


I kid obviously, this room is completely covered in them. This room is obviously being used for live sound recording. Unlike a studio environment, where we are looking to kill reverberation times (RT60), when recording live acoustic instruments, people normally look for a  bigger space with it's own acoustic character.

In the case of the image above, we see a relatively small room for this purpose, so the goal of using so much diffusion is to actually exaggerate the feeling of space within the room. As I said before, when you scatter sound in a room, the ear cannot detect the direction or the timings of the first reflections. When you do it to the extreme, a room will "appear" to sound a lot bigger than it actually is.

The QRD's with upward facing slats you see above are scattering sound horizontally, where as the ones slatted sideways are scattering vertically. You can know visualize the scatter orientation for the QRD's on the roof too - they on the plane 90 degrees to that of its orientation.

I love symmetry nice nice shape, so naturally this for of diffuser was more appealing to me than the PRD Skyline. My thinking was I could maps each cell division and turn it into a spectrum analyser with projection mapping.

The calculator I showed you before actually has a tab for QRD calculation, however during research I actually found one called QRDude, which is specifically for building QRD's obviously. So I DL'd the program. Here is a screen grab of the 1D QRD diffuser that I designed in the beginning.


But I hadn't really explored the program. You might notice "2D" in the tabs of the window. This is a way to turn the maths that result in a 1D diffuser. It is the ideal solution for my project as it has the visual effect of the Skyline, creating multiple screens, but it also has the symmetrical dispersion and look which ís far more appealing to me. Here is a screen grab of the 2D I designed using this calculator.


Keeping with the idea of symmetry, the circle you see is a phase diagram of the dispersion. In the first design, you can see that it is offset to the right. This is because it has 11 wells. In designs with 11 or less, there is always a phase offset. It is always offset by an exact amount though, so you can reverse the panel and put two side by side, thereby regaining the symmetry.



In my final design, you can see the well number is set at 13 and the phase wheel is symmetrical. This is the smallest panel number we can use for this effect. When you click the 2D tab, you get your new design.


So this is the image of the finalised diffuser I have nearly finished building. And just to bore you, a copy of the calculated guide for the build!

QRDude report for 2D QRD diffuser
===================================

STANDARD PANEL is based on a modulated series of STANDARD 1D QRD panels
Panel does NOT have fins

Panel order =  13
Design frequency  662 Hz
Number of wells =  169
Panel is shifted 7 wells to the left and pulled 7 rows towards the front

One depth unit is equivalent to 20 mm
Build depth is 240 mm

Panel width (no fins) is 572 mm

Period width is larger than design wavelength - good!

Block details
=============
Block width 44 mm

Number of empty wells 12
12 blocks of height 1 depth units, or 20 mm
12 blocks of height 2 depth units, or 40 mm
12 blocks of height 3 depth units, or 60 mm
12 blocks of height 4 depth units, or 80 mm
12 blocks of height 5 depth units, or 100 mm
12 blocks of height 6 depth units, or 120 mm
12 blocks of height 7 depth units, or 140 mm
12 blocks of height 8 depth units, or 160 mm
12 blocks of height 9 depth units, or 180 mm
12 blocks of height 10 depth units, or 200 mm
12 blocks of height 11 depth units, or 220 mm
25 blocks of height 12 depth units, or 240 mm
----------------------------------------
Total block length 21.84 metres


Volume based on solid build using blocks (no fins)
---------------------------------------------------
Volume =  .0422 cubic metres


The next post will be dedicated to the process of that build. I have already chopped all the wood according to the guide that you can export from the program, I also have the base plate cut and ready. Just unfortunately due to the restrictions of living with other people (sigh) I can continue with that today. Plenty of photos etc ahoy though! Here is a building that has been made to look like a diffuser in the mean time.


Aaaaaand. Just because I love it, here is an image of diffusion taken to the absolute extreme, from Studio C at Blackbird studio's. It is extremely strange to see a set up like this in a control room, however it is used for 5.1 tasks. Perhaps having and exaggerated sense of space in the room helps for this kind of work. There is also a lot of absorbtion here too, its just all behind the diffusion. How cool would it be to have every one of the diffuser posts set with its own individual LED! Audio to Colour feedback.





Sunday 29 March 2015

Project Explained Part 2 - Acoustics Refresher

Ok, so before I get started about the LEDs Projections and Acoustic Treats, I should say that I was wrong about the capacitors, they are actually supposed to be separate (the 0.1uf and 0.01uf ones). It is simply that the fritzing diagram I was going by was slightly confusing, but after a bit more research I discovered that the 0.1uf is for connecting the negative from the TRS input to the Ground Pin6 and the 0.01uf capacitor sits between the positive from the TRS and the Input Pin5 on the MSGEQ7. So there is one issue troubleshot before I even got started, I guess my intuition for electronics is increasing.

So with my dissertation I am interested with how environment can effect your creativity and ability to work in what are inherently quite abnormal environments, no matter what scale of the production spectrum you are at. In my case, it is the bedroom that has been my home for the time I have been at university. A bedroom is not a creatively inspiring environment, I feel confident at this point I can say that. You can get into inspiration coming in dream states with someone else, I'm sure there are plenty who would want to! ;)

So the task is to turn it into one. How do I go about that? Well, first off is the use of coloured lights and projection mapping, as I have discussed more extensively throughout this blog. However, arguably the most important aspect of any environment that you intend to create, practice or listen to music in, are the acoustics.

In my dissertation proper there will be academic references of some of the architechtural acoustics books that are available (there are a few!), however for this project I am going to keep it pretty light on the techy physics side of acoustics. Firstly, because I am not a physician and this is not a physics degree, secondly because some of the deeper reasoning I simply don't understand at this point, but lastly and most importantly, within the bounds of this project it isn't important. I say that because there is a vast amount of easily accessible, tried and tested information on acoustics, which is what I used to guide my choices when I was building my treatments. Short of building rooms from the ground up, or rooms within rooms, there is only a limited number of choices available to someone looking to improve their rooms acoustics. Lets look at a few before I talk about what I did. Oh yeah, no fucking egg boxes allowed.



So firstly, we have the one everyone has seen, and likely owned if you are in this game, acoustic foam. There are a few reasons that this isn't ideal with the bounds of this project. firstly, below 5-600hz, they are pretty much acoustically void. Below is a data sheet from one of the main companies that supplies UK acoustic foam distributers.

This is a similar chart to any other you would see shipped with acoustic foam. It is open celled, polyurethane foam, and what companies like Vicoustic and the rest dont like to tell you is it primarily designed and used in the automotive industry. Regardless, it is used in many a bedroom studio.

When people use foam, it is because they are looking to absorb frequencies that are causing problems in their room, or for whatever noise reduction purpose is required. Foam is particularly effective above 1khz. In the automotive industry, this is good for keeping the vocal range of passangers unaffected by the noise of the engine or other vibrations.

In the sense of a room for making music however, they are less than adequate, certainly if it is just foam being used. Infact if you are just using foam it could do more harm than good in certain environments, simply because killing higend reflections dead whilst leaving anything below about 600hz unaffected can be very off putting. There are very few environments in nature which would emulate these conditions, making it very unnatural sounding. I have experience of this from the first room I called a studio, and in retrospect to what I have now, it sounded terrible! I cant find any pictures of it unfortunately, I think they were on my old laptop (which I fried the motherboard of :/).

Above is a picture of one of the first page images from Google with the search Bedroom Studio (one of the neater examples). I you excuse the panorama image, then you can still tell it is an odd shaped room, with half of it taken up with a bed, a cluttered desk with assorted gear, and a mac (OF COURSE). There is a distinct lack of monitor speakers, no acoustic treatments and not much of anything else come to think of it. At least it is clean. Which I have found definitely improves concentration.


The problem is, that no matter which way you cut it, this room would never be as inspiring to work in as this one.


I genuinely have dreams of one day working in a space like this. It looks very beautiful in my opinion. When comparing the two, one thing hat may hit you straight away is the difference in symmetry. Not only does this ease the eye to the look of the room, it effects the acoustic map of this room greatly. For me, this is a great example of form following function and still looking beautiful, much like a Formula One car or a Beautiful animal. The beauty is intrinsic to the design and the design is intrinsic to how they work.

It is slightly unusual to have mirrored side walls, however by the look of this room there is a lot of absorbtion. Basically everything that you see covered in Grey material in this image will be absorbing frequencies. They are known as Broadband absorbers; they will absorb frequencies across the whole audio spectrum far more evenly.

The reason this is important in terms of listening accuracy is to prevent as much as possible something called Comb Filtering. In small to medium rooms, you get very strong Early reflections. These are the very first reflections of the walls that your ears pick up after the original sound wave. Here is a good image to demonstrate what I am talking about.

The microphone is your ear in this case. the above image shows how sound acts in a room. The image on the bottom shows the effect on the recording in such a situation (see why it's called comb filtering?) This is cause by phase cancellations that are made by the timing difference in when the reflection arrives at the mic (or ear) when compared to the original source. The way to minimise this effect is to absorb all early reflections.

So when comparing these two rooms, we can see that one is going to be massively reflective with lots of comb filtering, and one should not have these issues (I have not been in the room, I bet it doesnt though hahah). We also know why that is bad - Comb filtering will remove frequencies that we want to hear. It will also exaggerate the frequencies that we can.

In terms of Environment effecting creativity, if you cant know what you are listening to is going to sound good in other places, there is an element of doubt that will floating in your mind the whole time you are working. This is speaking from personal experience. So when I was wanting to look at environment effecting my creativity, it couldn't just be visual effects I was trying to use as inspiration. I feel that having professional acoustic treatment not only looks visually inspiring in itself, they can be used as awesome screens for projecting and also for back lighting with audio reactive LEDs.

The next post will be details of how I have used acoustics knowledge to build a range of treatments for my room, and how they are combined with light and colour.




Saturday 28 March 2015

Project Explained Part 1 - Arduino, MSGEQ7 and Audio to Colour Theory and Practice

I have had tons of stuff going on recently with the project, so today is going to be a catch us on the written side of it all.

First off I feel like I should give you an update on some of the difficulties that I had been having with the LED side of the project. Firstly, once again I am no electrician and this is all new to me, I have done a lot of reading trying to get my head around electronics and I think I have a stronger idea, but to say I fully understand it would be an exaggeration.

Also, without the code and guidance from a man named Russell, who has been helping via online chat through Blogger and Youtube, I certainly wouldn't have achieved this. He will be credited as such in my dissertation.

I have also had difficulty in getting parts. Well, more the time scales that they come. I completely underestimated how long it would take for some things to arrive, my longer breadboard took 5 weeks!!

I am now nearly there though, all I need to get my hands on is a female TRS Jack input for the audio in, and a 10K resistor, though I may just be able to use one of the 220k ones I already have for that purpose. I also need to soldier the button I got into place, as it is not very Breadboard friendly.

Also my ignorance in implementing the code into the Arduino was also holding me back. I have since figured out what it was that I was doing wrong, so now the Arduino is loaded with the code it needs. By the end of this coming week I should have a working audio-reactive acoustic diffuser. I think it may be the first one in the world! Wouldn't that be exciting. The next post today after this shall be dedicated to the Diffuser build and where that is at, but for now its all LED.

So first off, here is an overview of what is going on. Compared to my last post about Arduino control of LED's, you can see the Breadboard that I waited five weeks for is in place. Damn I wish China wasn't so far away. And amazong was more obvious where you were buying from :( Aaaaanyway.

 

So rather than using the power brick plugged into the Arduino, I am just using the stripped ends of the 12v power brick that came with the LED strip. Hopefully Russell can confirm wether this will work or not, if not then I know how to connect it up his way too, that's fine.


Next we have the potentiometer circuit. Once the board is fully equip with the button, this circuit will allow the user to cycle through the 8 states contained within the code. One button click cycles through these states, where the potentiometer controls the intensity of each program.


 The next circuit is doing the hard graft. Above the middle of the Breadboard, you can see 3 capcitors - 33pf, 0.1uf and 0.01uf (Left to Right). You may have already noticed that the two on the right are twisted together. I shall get some clarification exactly why that is, but I think it is to with stepping the signal down from the audio input, which will be connected this week.



Sticking with the image above, I shall explain what the little black box straddling the middle of the breadboard is. It is called the MSGEQ7 and it is really the brains of the operation here. It is a seven band audio splitter - it splits incoming audio into 7 separate frequency bands from Low to High frequencies.
Below is a small snippet of the Datasheet for the MSGEQ7. It shows the most important signal flow diagrams though. You can also see the specific band passed frequencies it outputs information for.

 
So here you can see a physical diagram and block electrical diagram of the chip (Top Right). If you imagine twisting that diagram round 90 degrees to the left, you have the orientation of the chip on the breadboard. So as I said before, the audio signal comes in through the top right pin, Pin5 (in that orientation). One left, we have the Ground Pin6, nothing to interesting. Next, Pin7 resets the multiplexer operation, on the board this is connected . Pin8 controls the chips onboard oscillator, which is responsible for selecting the frequency of the multiplexor, or how fast the strobe cycles through the audio frequency bands. When the input of Pin8 is high, the multiplexor is reset. When the signal goes low again it enables the Strobe Pin4, which is on the lower side of the chip. Pin3 is the Output, which is the Multiplexed signal. This is connected to the fourth analogue input on the arduino (A3) which unfortunately I forgot to wire up for the picture, but is now in place. Pin1 and Pin2 are the positive and negative power inputs for the chip, the power for which is controlled by the second 0.1uf capacitor.

Next we have the third stage of the Board, which is controlling the LED's. So trying to keep it basic, as I said before the MSGEQ7 spits out a multiplexed output, which means a stream of repeating data. That stream of data contains the volume information for each of the 7 frequency bands that the MSGEQ7 split the audio into.

What we need to do then is convert that data into RGB data which can be turned into coloured light that represents frequency via the LED strip. This is the part of the process that the Arduino takes care of.

If you have read my earlier work on this project, you will know that light and sound are inherently tied together, and one octave of the musical scale (F# through to F#, 370hz - 740hz) can be exactly converted to the octave of the visible light spectrum (Deep Magenta/Red through to Dark Blue/Purple, 406.8ghz - 813.6ghz). To get the exact colour to tone, you multiply the audio frequency by 2 to the power 40. Now we have some context for what I say next.

There are (very basically) three levels of colour. These are known as the Primary, Secondary and Tertiary Colours. The primary colours are out basic building blocks - with them, we can make Secondary and the Tertiary colours. Our primary colours are RGB, Red, Green and Blue. When we combine these together, we can (just about) make any colour in the rainbow. For example, if I wanted to create the colour Yellow from light, I would mix together equal amounts of Red and Green light. It is vastly more complex than this, but an easy way to think of it is how beat frequencies work, it's a form of frequency modulation.You can demonstrate this to yourself by use of some simple maths, though some of you have no doubt got it by now... If you take average between any to colour frequencies, you will get another colour.








Basically, if send varying R,G&B voltage amounts to the LED strip, then we will get a colour representation of the full audio frequency spectrum. Bass shall be represented by pure red, the Mids by green and the Highs by Blue. This can obviously be changed quite easily in the code, but for now it shall be remaining the same as I want to test this as a metering source. The three black things you see sticking out the breadboad are N-Channel Mosfets. They are special resistors that you can think of as Envelope Followers and are what control the flow of Red Green and Blue signal to each channel of the LED strip. It smoothing basically.

In the picture below I am holding that yellow cable for the benefit of Russell, hopefully he can tell me whether or not I can get away with powering the LED strip this way. You can see from earlier pictures that the Power Brick was plugged into the top rail of the Breadboard. I think this way I can avoid having to get a power brick with a proper connection, as I chopped the last one off for the last arduino project.



 Finally we have a picture of it all together. The code is on the Arduino, so hopefully once I have the TRS and button attached I should be plain sailing! The next post is going to be in a while after I have had a break. Once it is composed, I might just leave till tomo morn to post as I will most likely be very tired!