Saturday, 17 December 2016

Kyoto Station, Japan

Breathtaking. This is the second largest station in Japan (after Nagoya Station) and is one of the country's largest buildings.

I think it's a futuristic masterpiece and should be on your "to do" list when you visit Kyoto, even if you're not into modern architecture.
Opened in 1997 to commemorate Kyoto's 1,200th anniversary, it is 70 meters high and 470 meters from east to west.

The architect was Hiroshi Hara.
He was a professor at the University of Tokyo until 1997, and has held an emeritus position since that time.
Hara's other buildings include the Yamato International Building in Tokyo 
and the Umeda Sky in Osaka.
Back to the train station:
The interior is a cathedral of glass and steel. Which reminds me a bit of the Musee D'orsay in Paris.
Both are train stations ...beautiful, though separated by a century.




Take the escalator from the 7th floor on the east side of the building up to the 11th-floor glass corridor, Skyway (open 10am to 10pm).
The Skyway is open 10am to 10pm. It runs high above the main concourse of the station.
Panorama of the Kyoto Tower and surrounds from the train station. 

 ------------------------------------------------------------------------------------------
Click here for more travel postcards

Timer Interrupts and clocks - Part 2 - CTC Mode

 There are a few ways to do interrupts.
The last post was a basic intro on Timer Interrupts
in Arduino. It used the TimerOne Library
 
Another common way uses "Clear Timer on Compare Match" or CTC Mode.
The Uno has three timers called timer0, timer1, and timer2.  
Each of the timers has a counter that increases with each tick of the timer's clock. 
 
These interrupts are a good way of clocking events in Arduinos. 

CTC interrupts are triggered when the counter reaches a specific value.
This value is stored in the "Compare Match Register".
On reaching this value, the counter resets to zero.
You can set this specific counter value and you can also set the speed of the timer.
This allows you to control the frequency of the timer interrupts.
 
So the two important things to set when making your clock are:
1. speed of the timer
2. value of the counter reset

Speed.
The fastest speed of the Arduino clock is 16Mhz.
We can divide this speed , thus slowing things down using a "prescaler".
The formula for working out the speed is:
 
(timer speed (Hz)) = (Arduino clock speed (16MHz)) / prescaler
 
 
Counter Reset
Timer0 and timer2 are 8 bit timers. Thus they can store a max counter value of 255. 
Timer1 is a 16 bit timer. Thus it can store a max counter value of 65535.  
 
// --------------------------------------------------
 
Timer setup code is mostly done in the setup(){} function in an Arduino sketch.
We need to do things like turning on the CTC mode, setting the prescaler
 
Below is a example of some code:
 
//*********************
 
void setup(){

cli();//stop interrupts

//set timer0 interrupt at 2kHz
  TCCR0A = 0;// set entire TCCR0A register to 0
  TCCR0B = 0;// same for TCCR0B
  TCNT0  = 0;//initialize counter value to 0
 // set compare match register for 2khz increments
  OCR0A = 124;// = (16*10^6) / (2000*64) - 1 (must be <256)
// OCRnA/B is the output compare register 
 // turn on CTC mode
  TCCR0A |= (1 << WGM01);
  // Set CS01 and CS00 bits for 64 prescaler
  TCCR0B |= (1 << CS01) | (1 << CS00);   
  // enable timer compare interrupt
  TIMSK0 |= (1 << OCIE0A);
sei();//allow interrupts

}//end setup 
void loop() {
// put your main code here, to run repeatedly:

ISR(TIMER0_COMPA_vect){  //change the 0 to 1 for timer1 and 2 for timer2
   //interrupt commands here
// ******************** 
 
It all looks very confusing, but if you look at any CTC code, you will see these similar
lines of code:
 // turn on CTC mode
  TCCR0A |= (1 << WGM01);
It turns on the CTC mode 
The 3 Different timers will use slightly different code.
TCCR0A |= (1 << WGM01);//for timer0
TCCR1B |= (1 << WGM12);//for timer1
TCCR2A |= (1 << WGM21);//for timer2
----------------------------------- 
TCCR#A/B - this stands for "Timer/Counter Control Register".
This register holds the main control bits of the timer.
After TCCR there is a number and a letter A or B   
-------------------- 
The next bit of code involves setting the prescaler
// Set CS01 and CS00 bits for 64 prescaler
  TCCR0B |= (1 << CS01) | (1 << CS00);  
Each of the 3 timers uses a slightly different bit of code.
 TCCR2B |= (1 << CS22);  // Set CS#2 bit for 64 prescaler for timer 2
TCCR1B |= (1 << CS11);  // Set CS#1 bit for 8 prescaler for timer 1
TCCR0B |= (1 << CS02) | (1 << CS00);  
// Set CS#2 and CS#0 bits for 1024 prescaler for timer 0
 ---------------------
Next we have the Timer/Counter Register (TCNTn).
   TCNT0  = 0;//initialize counter value to 0
This register controls the counter value and is needed to set a preloader value.
Here, the preloader value is zero. 

The formula for the preloader value, for a required time (in seconds) is:

TCNTn = 65535 – (16x1010xTime in sec / Prescaler Value)

To calculate the preloader value for timer1 for a time of 2 Secs is:

TCNT1 = 65535 – (16x1010x2 / 1024) = 34285

 
 
------------------------------------------------- 
 These commands need to be placed outside the void setup() and void loop()
functions
 // ======================================================
ISR(TIMER0_COMPA_vect){  
   //this is for timer0
   //change the 0 to 1 for timer1 and 2 for timer2 
 // you would place all your timer commands here.
}
// =============================================== 
ISR stands for Interrupt Service Routine. 
TIMER1_COMPA_vect - this is your TIMER1/compare match interrupt.
When the TIMER1 matches the OCR1A, (ie: compare match interrupt == OCR1A)
an interrupt is generated. 
If we were using timer1 the commands would looks like this:
 ISR(TIMER1_COMPA_vect){


//this is for timer1 // you would place all your timer commands here. 
}
For the record there are three types of interrupts.
1. Compare Match interrupt (TIMER1_COMPA)
   These are good if you wish to toggle a pin or read from a sensor at precise
   regular intervals 
2. Overflow interrupt (TIMER1_OVF)
   Here, the timer clocks over 65535 ticks for timer1 and 255 ticks for timer 0&2 .  
3. Input capture interrupt (TIMER1_CAPT) 
   If a logic level change occurs on a specific pin , an input capture interrupt
   is generated. These are great if you want to measure the time between pulses
   or measure the frequency of an unknown signal.
// ================================================== 
 Below is an example of code using timer interrupts.
This uses timers 0,1 & 2. It works on the Arduino Uno.
// =========================================== 
 //timer interrupts
//by Amanda Ghassaei
//June 2012


/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
*/



//this code will enable all three arduino timer interrupts.
//timer0 will interrupt at 2kHz
//timer1 will interrupt at 1Hz
//timer2 will interrupt at 8kHz

//storage variables
// these are used in the timer command section at the end of the code
boolean toggle0 = 0;
boolean toggle1 = 0;
boolean toggle2 = 0;

void setup(){
  
  //set pins as outputs
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(13, OUTPUT);

cli();//stop interrupts

//set timer0 interrupt at 2kHz
  TCCR0A = 0;// set entire TCCR2A register to 0
  TCCR0B = 0;// same for TCCR2B
  TCNT0  = 0;//initialize counter value to 0
  // set compare match register for 2khz increments
  OCR0A = 124;// = (16*10^6) / (2000*64) - 1 (must be <256)
  // turn on CTC mode
  TCCR0A |= (1 << WGM01);
  // Set CS01 and CS00 bits for 64 prescaler
  TCCR0B |= (1 << CS01) | (1 << CS00);   
  // enable timer compare interrupt
  TIMSK0 |= (1 << OCIE0A);

//set timer1 interrupt at 1Hz
  TCCR1A = 0;// set entire TCCR1A register to 0
  TCCR1B = 0;// same for TCCR1B
  TCNT1  = 0;//initialize counter value to 0
  // set compare match register for 1hz increments
  OCR1A = 15624;// = (16*10^6) / (1*1024) - 1 (must be <65536)
  // turn on CTC mode
  TCCR1B |= (1 << WGM12);
  // Set CS12 and CS10 bits for 1024 prescaler
  TCCR1B |= (1 << CS12) | (1 << CS10);  
  // enable timer compare interrupt
  TIMSK1 |= (1 << OCIE1A);

//set timer2 interrupt at 8kHz
  TCCR2A = 0;// set entire TCCR2A register to 0
  TCCR2B = 0;// same for TCCR2B
  TCNT2  = 0;//initialize counter value to 0
  // set compare match register for 8khz increments
  OCR2A = 249;// = (16*10^6) / (8000*8) - 1 (must be <256)
  // turn on CTC mode
  TCCR2A |= (1 << WGM21);
  // Set CS21 bit for 8 prescaler
  TCCR2B |= (1 << CS21);   
  // enable timer compare interrupt
  TIMSK2 |= (1 << OCIE2A);


sei();//allow interrupts

}//end setup

ISR(TIMER0_COMPA_vect){//timer0 interrupt 2kHz toggles pin 8
//generates pulse wave of frequency 2kHz/2 = 1kHz 
//(takes two cycles for full wave- toggle high then toggle low)
 if (toggle0){
    digitalWrite(8,HIGH);
    toggle0 = 0;
  }
  else{
    digitalWrite(8,LOW);
    toggle0 = 1;
  }
}

ISR(TIMER1_COMPA_vect){//timer1 interrupt 1Hz toggles pin 13 (LED)
//generates pulse wave of frequency 1Hz/2 = 0.5kHz 
//(takes two cycles for full wave- toggle high then toggle low)
 if (toggle1){
    digitalWrite(13,HIGH);
    toggle1 = 0;
  }
  else{
    digitalWrite(13,LOW);
    toggle1 = 1;
  }
}
  
ISR(TIMER2_COMPA_vect){//timer1 interrupt 8kHz toggles pin 9
//generates pulse wave of frequency 8kHz/2 = 4kHz 
//(takes two cycles for full wave- toggle high then toggle low)
 if (toggle2){
    digitalWrite(9,HIGH);
    toggle2 = 0;
  }
  else{
    digitalWrite(9,LOW);
    toggle2 = 1;
  }
}


void loop(){
  //do other things here
}
// ============================================================== 
Links
+ https://circuitdigest.com/microcontroller-projects/arduino-timer-tutorial
+ https://www.youtube.com/watch?v=2kr5A350H7E 
 

Thursday, 15 December 2016

El Jadida - Morocco

El Jadida or al-Jadida




Its a port city on the Atlantic coast of Morocco, located 100 km south of the city of Casablanca,




somewhat of an off-the-beaten-track destination 




Take a stroll through the old Portuguese City



 churches and synagogues sit close to mosques,


 the UNESCO-listed Fortress of Mazagan is one of the country’s best-preserved coastal fortresses, 

Wednesday, 14 December 2016

Filters - Korg Electribe 2

I love the electribe 2
Its a wonderful and underrated synth for very easily creating your own sounds.
You can model your own unique drum and synth sounds really easily.
 
The filters are one of your best tools for doing this.
There are 3 basic types:
LP, HP, BP
They are virtual analog.
 
You can cycle through each sub group by pressing the LPF/HPF/BPF buttons repeatedly
 -------------------------
 
LPF
electribe LPF  
MS20 LPF
MG LPF (moog)
P5 LPF (prophet 5)
OB LPF  (oberheim)
Acid LP  (TB303)
 
 
HPF 
electribe HPF
MS20 HPF
P5 HPF (prophet 5)
OB HPF (oberheim)
Acid HPF
 
BPF 
electribe BPF
MS20 BPF
P5 BPF
OB BPF
Acid BPF
 
 
A good live performance trick is to cycle through some of the filters. 
 
There's  filter automation available so you can program in filter sweeps quickly and easily.
Press the record button, and then move the cutoff freq knob.
You will notice the record button starting to blink.
 
Experiment with the EG int (intensity) knob in the filter section.
Increase the EGint to let the Amp EG modulate the filter.

 
When building a baseline, I usually use the LP filter to cut out higher frequencies.
However, a cool live performance trick is to load identical copies of  your bassline
into parts 1, 2 & 3 , and give each a different filter. The mute/unmute each part
and tweak your cutoff freq, Q and EG int during the performance.
You can even automate some of the parts.
 
Remember you can also input external audio through the electribes filters.
 

Monday, 12 December 2016

Mutable Instruments - Clouds - drones - chords

Clouds is a great module to use for creating drones & chords.
 
 
Use Granular synthesis mode
First mode. 
You need to input a steady note, and then it's just a very quick sequence that transposes the pitch of the grains
 
Used the quantized output of the a sequencer.... a Rene for example.
program on each row four notes that form a chord.
Limit it to a C major scale, for example.
You can then turn the knobs freely on the sequencer and create chords on the fly. 
My Clouds tracks quite well 1v/Oct.
 
Links

Tuesday, 6 December 2016

Sauce of Unce - NLC - Build notes

This is a Eurorack module based upon the Buchla 265 Source of Uncertanity module.
The 265 is the first in a long string of modules bearing the name "Source of Uncertainity" which I
think is poetic and apt for such a module.


The Buchla 265 is one of  the greatest modules Don ever built.
However, the original 265 uses lots of rare and expensive parts and needs +24V to operate so is out of reach of most people.

The Nonlinearcircuit module though not a complete clone is very close.
The noise source uses a TL074 (quad op-amp). The 265 used four uA741s (single Op-amp).
The 0.05-50 Hz VCO is op amp based (again TL074).
The Sample & Hold sections are changed to use the hi-Z input of TL074 op amps (ie not uA741s). 
The 265 used an uA741 at the S/H output.

I've often wondered where did the name "unce" come from?
Maybe as it's the written form of the sound heard in most club music, Andrew named it from there? You have probably heard the sound unce,unce,unce,unce, etc coming from a club.


Andrew's build notes are here:
http://www.sdiy.org/pinky/data/Sauce%20of%20Unce%20build%20notes.pdf

NLC Blog descriptions:
http://nonlinearcircuits.blogspot.com.au/2014/04/sauce-of-unce.html
and
http://nonlinearcircuits.blogspot.com.au/2014/07/sauce-of-unce-in-eurorack.html

I'll be building two versions: one for the Buchla system & one for the Euro.

First the Eurorack one.
This is what the virgin boards look like.
There are four surface mount TL074 op-amps and some passive resistors in SMD format.
The rest of the build is through the hole.

There are two sides to this PCB

I like to get the SMD op amps onto the board first. Be careful there are no shorts.
Then the rest of the passive SMD stuff. The spacing is for 1206 SMDs.
I'm using 0805 SMDs. 
The 47K resistor  next to the 4u7 cap (marked in yellow) should be added last.
It sets the level of the noise output and determines the behaviour of the entire circuit.
It's value can range from 47K to as low as 12K if you have noisy transistors.
read Andrew's build notes for more info.

T1, T2 & T3 are test points.
T1: should just be noise like the three noise outputs
T2: a noisy approx 100Hz tri wave
T3: turn up the random pot to max, depending on your vactrol you should hear approx 30Hz +/-10V signal .
T3 is the output of the VCO that controls the S&H on the 'random' output, 

The orange & blue circles mark resistors that should be left out or changed. These set the output voltages.
Euro require voltages in the 0-5V range.
Buchla require a 0-10V or 0-15V range.

The blue circle marks the 12K resistor which I'm changing to 6.8k to give a Euro voltage output (0-5V).
The Orange circle marks the 10K & 33K which I'm changing to just a link (on the 10K) to again give out Euro voltages.



I'm using a J112 for the FET.
 Caps next.
 I'm using 68uf ceramics for the decoupling caps.

I used a 10uf 50V non polarized electro here.
The remaining 10uf Electros were 35V
 Vactrol time.
Using a VTL 5C3/2 for the dual vactrol.
It's what I had on hand at the time.
Probably a VTL 5C2/2 would be better ??
The VTL 5C2/2 has slower attack and decay response times.

For the single vactrol I used a NSL 32.

Almost there.
Pots, LEDs & jacks now.
I used 510 Ohm SM resistors for the LEDs.
Before setting the noise levels with the resistor marked "47K" I had a listen with just headphones.
Yup !!! lovely noise.

I measured an average of 0.175V at pin 1 of the TL074.
It fluctuated  quite a bit.
So the resistor value was 62K
11000/0.175 = 62.857



I blew the 10 ohm resistor in the lower right corner of the pic. It's now replaced with a SMD 10Ohm.
The culprit was I think a short  between the dual vactrol and the resistor (now covered with plastic shrink).



 -----------------------------
For the Buchla module:
To get approx 0-10V, install the 10k and 33k resistors as described. To get it up to 15V, replace the 10k resistor. Use 0805 smd (which will fit nicely), so you can easily remove them, try 22k for starters.

Similarly, on the smooth output you can change the 10k resistor to increase the output voltage.  
The build guide I suggests using 6k8 to 8k2 instead of the 12k. "The output still gets pretty hot but very rarely clips, this depends a lot upon your dual vactrol, so some experimentation is needed. I (Andrew F) used a rare dual Silonex. "Best to use 0805 resistors which can be easily installed and removed".

Another way is to use 6k8-8k2 as suggested to keep signal levels at comfortable (for the op amp) levels and then adjust the '10k*' resistor at op amp C1 to get the range you want, higher resistance = higher voltage.

 
 ------------------------

Links:
Muffs- 265sou

-----------------------------------------------------------------------------------
You can find more NLC builds here.
---------------------------------------------------------------------------------------

sAFI - Morocco

Safi is a port city on Morocco’s Atlantic coast. 




Ksar El Bahr, a 16th-century fortress built by Portuguese colonizers, is on the waterfront. In the old town





These pics were taken in 2004




safi is famous for pottery.
This is a kilm


Lovely, lovely place.