Reply To: New Firmware for NS1 Nanosynth

Home Forums Products NS1nanosynth New Firmware for NS1 Nanosynth Reply To: New Firmware for NS1 Nanosynth

#1528

liamfpower
Participant

Hi Rssutcliffe,
Alright, here is a link to what I have so far on the Ardcore Code conversion for the NS1.
Keep in mind these are all pretty roughly translated for the Nanosynth. Here is a guide on how to convert them for yourself if you find a patch that needs to the be converted.

Basically most of the trigger/gate based patches should work perfectly for the Nanosynth without any modifications.
If you find a patch which takes a clock in, you need to change
attachInterrupt(0, isr, RISING); to attachInterrupt(2, isr, RISING);

you also need to change the DAC output routine, so first you put this line of code at the top.
#include <SPI.h> // Remember this line!
#include <DAC_MCP49xx.h>
DAC_MCP49xx dac(DAC_MCP49xx::MCP4922, 4, -1);

then, in setup, you delete this:
for (int i=0; i<8; i++) {
pinMode(dacOffset + i, OUTPUT);
digitalWrite(dacOffset + i, LOW);
}
and add this:
dac.setGain(2);

then you find any code which says dacOutput(number) — ardcore dac output routine
and change it to: dac.outputA(number <<4) — Nanosynth dac output
This is because the Ardcore outputs an 8 bit value, and we want a 12 bit value for the Nanosynth DAC, so we bitshift it 4 bits the right. You following?
Then delete:
void dacOutput(byte v)
{
PORTB = (PORTB & B11100000) | (v >> 3);
PORTD = (PORTD & B00011111) | ((v & B00000111) << 5);
}
from the bottom of the code, so that it doesn’t mess with pin 4, which your DAC needs.

What you have done is changed the clock pin to pin 2, initialised the nanosynth DAC, told it what gain to output at, and changed the DAC output by four bits to match the scaling of the Nanosynth.

My favourite patches with the nano so far are the Quantizer, the shaped LFO, the envelope generator, the shift register, and the 101 sequencer. Some of them might need tweaking to work if you feel you are up to it. If in doubt take a look at the Nanosynth code on the soundmachines github and make sure you have all the DAC related code right.
Let me know how it goes!
Thanks
Liam

  • This reply was modified 1 year, 3 months ago by  liamfpower.