Neon im Donautal – Kosmische Klänge an der Donau

Neon im Donautal – Kosmische Klänge an der Donau Ein Uhr nachts, kein Sonnenrest mehr, nur das Restglühen der Stadt weit im Rücken. Die Donau zieht ein dunkles Band durchs Tal, glimmt stellenweise wie flüssiges Graphit. Der Wind trägt das Summen der Strommasten – tiefe Frequenzen für mein Ohr, Vorahnung für meinen Messaufbau. Ich schultere den Rucksack, stolpere den steilen Pfad zum Aussichtspunkt hinab. Der Boden knirscht frostig, doch die Luft hält noch Sommerwärme. Alles […]

https://donau2space.de/neon-im-donautal-kosmische-klaenge-an-der-donau/

Biofeedback Butterfly Beats With A Pulse

Biofeedback is the idea of making one conscious of a biological process or feature, and then using this to try and exert control over the very same. [Mariia Hruntes] demonstrates this ably with a f…

Hackaday
Biofeedback Butterfly Beats With A Pulse

Biofeedback is the idea of making one conscious of a biological process or feature, and then using this to try and exert control over the very same. [Mariia Hruntes] demonstrates this ably with a f…

Hackaday

Bu fotoğrafları tekrar paylaşmak istiyorum.
Bu benim iki Arduino UNO R3'üm. Birinin üzerinde 2.8 Dokunmatik Ekran takılı!

Artık Arduino'yu Qualcomm satın aldı ve ikonik Arduino UNO'nun sonuna yeni sahibini işaret eden "Q" harfini ekleyip Debian Linux çalıştıran bir tek kart bilgisayara dönüştürdüler!

Henüz dönüşüm aşaması tamamlanmadı ve ben de tüm Arduino severler gibi sonucu bekliyorum!

Eğer iyi olduğuna inanırsam 8GB RAM olanı çıkınca alabilirim.

Eğer inanırsam!

#Arduino #ArduinoUNO

KernelUNO, An OS For The Arduino Uno

If you were to point to a single device responsible for much of Hackaday’s early success, it might be the Arduino Uno. The little board from an Italian university with its easy to use dev env…

Hackaday
KernelUNO, An OS For The Arduino Uno

If you were to point to a single device responsible for much of Hackaday’s early success, it might be the Arduino Uno. The little board from an Italian university with its easy to use dev env…

Hackaday

Minimalist Lo-Fi Minimalism – Part 2

Last year I programmed up an Arduino with my Pi Day MIDI Sequencer to play a short extract from Philip Glass’ Einstein on the Beach. You can read all about that here: Minimalist Lo-Fi Minimalism.

Having spent a fair bit of the time since then playing around with an Arduino and SP0256A-AL2 and finally getting it hooked up to MIDI, I parked an idle though that it might be interesting to get it “singing” part of Einstein on the Beach. This post comes back to that idea.

https://makertube.net/w/4upxhBNemynPiFKfdzzea2

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

These are the key Arduino tutorials for the main concepts used in this project:

If you are new to Arduino, see the Getting Started pages.

Parts list

The Circuit

I did wonder about combining both the Pi Day sequencer and SP0256A-AL2 shield into a single device, but then decided it would be simpler to treat them as two separate devices and use MIDI to pass control between them.

Consequently I’ve ended up as follows:

  • Pi Sequencer -> MIDI TRS -> SL0256A-AL2 -> MIDI TRS -> synth

Where the Pi sequencer is running the code for Minimalist Lo-Fi Minimalism with a small update to send additional MIDI messages to be interpreted by the SL0256A-AL2. All other MIDI is passed through the SL0256A onto a MIDI synth as before.

The Code

Having decided on the basic architecture, the next decision was how to encode the information destined for the speech synthesizer. I need to be able to tell it a pitch and a number to be “sung”. I toyed with the following ideas:

  • MIDI NoteOn with pitch, but using note velocity to encode the number to sing.
  • MIDI Program Control to select the number, then MIDI pitch and velocity as normal.
  • Use the MIDI channel for the number, and pitch and velocity as normal.

I opted for the last option, treating each number as a different instrument on a different MIDI channel. This is a bit wasteful but was a lot easier for testing than attempting to get a specific velocity or having to send MIDI PC messages to keep reselecting the “voice” before each note.

As described previously in Minimalist Lo-Fi Minimalism MIDI channels 1,2 and 3 are already used for the bass and two voice lines, so I’m using MIDI channels 4 through to 13 for the numbers one to ten.

The code for the Glass already has pitch and which number encoded into the data structures. To trigger the “singing” via the speech synthesizer I’m using the Soprano voice pitches, but an octave lower, so it is a relatively simple matter of adding in an additional MIDI send as follows:

MIDI.sendNoteOn(sop[i], 64, MIDI_CHANNEL_SOP); // Original code
MIDI.sendNoteOn(sop[i]-12, 64, MIDI_CHANNEL_NUM-1+num[i]); // New code
lastsop = sop[i]; // Original code

It is using the “NUM” MIDI channel – 1 as I’m encoding the numbers 1 to 10 which are stored in the num[] array. As the speech synthesis is essentially running at a fixed duration for each utterance, I’m not even bothering with a Note Off message.

On the speech synth side, again essentially all of the code is the same as for the Arduino and SP0256A-AL2 – Part 6 MIDI code, but instead of singing “do, re, mi”, etc linked to pitch, I need to take the word from the MIDI channel. To do this, I’ve expanded the speak() function to include the number and call it as follows from the NoteOn callback:

speak(channel-MIDI_CH2NUM, pitch);

This will result in a number from 1 to 10 and a MIDI pitch which can then be used to select the playback frequency as before and then say the allophones corresponding to the received number.

void speak (uint8_t num, uint8_t note) {
midi2clock (note);
switch(num){
case 1: // One
spAllo(WW1);
spAllo(AX1);
spAllo(NN1);
break;

case 2: // Two
spAllo(TT2);
spAllo(UW2);
break;

}
spAllo(PA3);
}

The SP0256A-AL2 datasheet lists the allophones to use for the basic numbers.

I’ve used, in a few cases, slightly shortened versions of the numbers from one to ten. In particular I’ve removed the duplicate allophones for six and seven to make them a little shorter to playback.

The allophones for “One” includes the use of “SX” but I can find no other mention of that in the datasheet, so I’ve ignored it.

One final change was to tweak the timings of the original playback. I’ve had to slow it down a lot to give the SP0256A-AL2 time to say each number, and I’ve also introduced a small delay between sending the MIDI messages and updating the numbers on the display to allow them to sync up a little better.

If the MIDI went to the synth directly from the Pi Day sequencer then a delay would probably be required there too, but as it has to go through the SP0256A-AL2 and get sent back out using the “software THRU” of the Arduino MIDI library, it has a natural slight delay already and isn’t too noticeably out of sync.

Closing Thoughts

I always knew there would be a few limitations, not least of which due to the time it takes to play back the allophones, but in essence I believe this works. I’d rather it was a little more up tempo, but sometimes one just has to work with what is available.

I think it is certainly keeping within the spirit of attempting an extract of the original opera on 8-bit microcontrollers, so it’s not doing too badly.

Kevin

#arduinoUno #midi #Minimalism #PhilipGlass #piday #sp0256aal2

SP0256A-AL2 Sings the Twelve Days of Christmas

Partly prompted by a programming challenge by Futzle on Mastodon, I thought it might be interesting to try to get my Arduino and SP0256A-AL2 to sing the Twelve Days of Christmas.

https://makertube.net/w/diBkzrhkh3tekAPBhGzrVj

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

These are the key Arduino tutorials for the main concepts used in this project:

If you are new to Arduino, see the Getting Started pages.

Parts list

The Code

I wasn’t aiming for a clever code solution, as can be seen submitted to the programming competition already, but I was hoping to get the computer to do at least some of the work for me.

The first issue is getting a useful range for the song. My original MIDI SP0256 project managed around an octave and a half. Well it so happens that the 12 Days of Christmas is just over 1 octave, so if I can position that to the top end of the range, I should be ok.

This is the most compact notation of the tune that I know of. This is from the “Christmas Praise” Brass Band carol book, which seems to be one of the most common references for any band out caroling at this time of year.

Ignoring the introduction, I’m going to transpose this into concert Bb (i.e. up a minor third) which gives me a note range from F2 through to G3. This allows me to use a sensible range of the SP0256A without it getting too slow down at the bottom end of things.

The main text/lyric structure will be set up in a series of functions as follows:

intro() - "on the nth day of Christmas my true love gave to me"
nth() - "first", "second", etc.
one() - "a partridge in a pear tree"
two() - "two turtle doves"
...
twelve() - "twelve drummers drumming"

Some variations are required as follows:

  • intro() – needs to be able to switch to “and a partridge” for all verses apart from verse 1.
  • two(), three(), four() – have a different melody from verse 5 onwards.
  • five() – ideally this should get slower and more drawn out with each repetition.
  • one() – ideally this would slow down on the last time through.

In order to capture the variations and repeats for each verse, I’ve opted to use an increasing bitmask for each time through to trigger the various phrases. Bit 0 always indicates one() must be called. Bit 1 indicates two(), and so on. It starts with the value 1 but will keep adding another bit as the verses change, so will have the values 1, 3, 7, 15, 31, 63, etc. thus allowing me to build up the verses with one bit per verse.

one() takes bool parameters to indicate first time and last time through. two(), three(), four() take a bool parameter to indicate if it is a “post five gold rings” verse. Using the bitmask this is pretty easy as it just means any of the bits 0x0FF0 will be set for verses 5+.

Here is the main code loop.

uint16_t phrase=1;
for (int verse=1; verse<=12 ; verse++) {
intro(verse);
delay(200);
if (phrase & 0x0800) twelve();
if (phrase & 0x0400) eleven();
if (phrase & 0x0200) ten();
if (phrase & 0x0100) nine();
if (phrase & 0x0080) eight();
if (phrase & 0x0040) seven();
if (phrase & 0x0020) six();
if (phrase & 0x0010) five(verse);
if (phrase & 0x0008) four(phrase & 0x0FF0);
if (phrase & 0x0004) three(phrase & 0x0FF0);
if (phrase & 0x0002) two(phrase & 0x0FF0);
if (phrase & 0x0001) one(phrase == 1, verse == 12);
phrase = (phrase<<1) + 1;
delay(1000);
}

The timings were really quite tricky as I have several variables to work to:

  • Each allophone takes a different time to be said.
  • Each allophone also has a recommended delay time (this might be to account for the time to say them – I’m not sure).
  • When I change the frequency, the time to say any specific allophone also changes, with lower frequencies significantly slower than higher ones.
  • I naturally need to account for the musical rhythm changes too.

In principle I could probably work out the slowest interval and work back from there to get some accurate timings, but I just did a bit of trial and error on each phrase until it was close enough. The unevenness remaining was because I didn’t want to slow the whole thing down to the slowest phrases being “sung”. It is slow enough already!

Also, as it doesn’t look much, I’ve added an LED to light up at the start of an allophone and to go off whenever a pause is encountered.

Find it on GitHub here.

Closing Thoughts

I’m actually really pleased with this. It is a good balance of close enough to show the principle without me undertaking complex timing and endless fiddling.

I could probably get a bit cleverer with the code, but that wasn’t really the point for me. I’ve used an algorithm where it mattered to me, and was quite happy to spell out the allophones, frequencies, and timings by hand as I went.

Lastly, let me wish you the compliments of the season, to you and yours.

Kevin

#arduinoUno #sp0256aAl2

Atari Synth Cart Controller

This project uses my Atari 2600 Controller Shield PCB in reverse, to allow the Arduino to act as an Atari keypad controller and thus allow it to control the Atari Synth Cart.

https://makertube.net/w/ryCciwFyQQpcs1Q4Wwy52x

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

These are the key Arduino tutorials for the main concepts used in this project:

If you are new to Arduino, see the Getting Started pages.

Parts list

The Circuit

In this use of my Atari 2600 Controller Shield PCB the 9-pin d-type connectors are directly connected to the Atari console.

There is one issue however. Which device should provide 5V? The Atari pinout has 5V present on pin 7 and this is hooked up to the Arduino 5V line.

It may be possible to run the Arduino off the Atari 5V line, which would be really convenient if so. But I’ve not found a definitive statement of the maximum current draw through the 5V pin of the d-type connector from an Atari 2600.

From the schematics for the 2600, it appears that the 5V comes directly from a 7805 regulator. This may or may not go via a single inductor depending on what version of the schematic I’m looking at (yes, for the schematics on Atari Age, below, no for the schematic in the field service manual).

From the BOM in the field service manual, this would appear to be a 78M05 which I believe has a maximum current output of 500mA with a suitable heatsink.

But that has to power the entire console of course. In a not particularly scientific measurement, I believe my 2600 jnr was drawing around 360mA and my “woody” perhaps around 320mA. I don’t know how this changes with different games or controllers.

According to this post, an Arduino Uno with no IO pin current draw, will pull around 50mA when powered from the 5V line directly. Curiously, a bare-bones ATMega328P can apparently drop to almost 15mA when not driving regulators, a USB chip and a power LED…

From powering up a number of Arduino projects I had lying around, most hardly registered on a simple USB current meter using 10mA units. Some with LEDs got to show 0.02A. Some with screens got up to 0.2A.

So just thinking about it in a somewhat hand-wavy kind of way, I suspect that powering an Uno would probably be ok…

If not, then the 5V line to the d-type connectors will have to be cut and the Arduino independently powered. But then the signals for the keypad will be set at the Arduino’s idea of what 5V looks like, not the Atari. They ought to be essentially the same, but it can’t be guaranteed.

Ideally to go this route, the Arduino would isolated from the Atari and be switching the Atari’s 5V line on and off for the input signals as required, but that would require a new design of the PCB.

So time for an IMPORTANT WARNING: This could well damage the Atari 2600 console as I’m essentially making it up as I go at this point.

I have a cheap Atari 2600 junior that I picked up a while back that I’m happy to experiment with. I’m not using my own, original “woody”. In the end I used the following:

Volca <– 3.5 mm jack to jack –> Arduino TRS MIDI + Atari Shield <– 9-pin to 9-pin –> 2600

Here is the full setup using a Video Touch Pad as the second controller. Note the Arduino is fully powered from the Atari at this point, but the Volca is running on batteries.

The Code

The basic principle for the Arduino is to monitor the Atari’s “row” signals via INPUT pins and when detected drive any OUTPUTs LOW to indicate keys being pressed. The basic algorithm is as follows:

rows[] = IO INPUT pins connected to D-type pins 1, 2, 3, 4
cols[] = IO OUTPUT pins connected to D-type pins 5, 6, 9

FOREACH row[]:
IF row is scanning LOW THEN
Set cols[] HIGH or LOW in turn according to required keypress

REPEAT for second controller

The keypad row/column map was shown in Arduino Atari MIDI Keypad and reproduced here:

Active (pressed) keys will show as LOW in a column when that row is scanned, so to emulate 6 being pressed, when row on pin 2 is detected as being LOW, column on pin 6 should be driven LOW and columns on pins 5 and 9 should be driven HIGH.

I need to map these keys over onto MIDI notes. One issue is that the Atari doesn’t have a natural scale as generating the frequencies for notes is pretty limited.

Still, I’ve mapped the 12 keys, with their non-natural scale, over onto MIDI notes 60-71 – i.e. all semitones up from middle C.

I’m using PORT IO in an interrupt driven scanning routine to ensure the Arduino is as responsive as it can be to ROW scanning. I also pre-compute the actual column bit values when a MIDI note is received, meaning the scanning routine only has to write out the preset values.

The main functions that achieve this are shown below, with the PORT IO values set up for the second Atari controller connector on my Atari 2600 Controller Shield PCB.

uint8_t row[ROWS];
uint8_t colbits[COLS] = {
0x02, // C0 = A1 PORTC
0x01, // C1 = A0 PORTC
0x10 // C2 = D12 PORTB
};

void keyOn (int r, int c) {
if (r < ROWS && c < COLS) {
// Clear the bit as need active LOW
row[r] &= (~colbits[c]);
}
}

void keyOff (int r, int c) {
if (r < ROWS && c < COLS) {
// Set the bit as need active LOW
row[r] |= colbits[c];
}
}

void scanKeypad (void) {
// ROWS: D11-D8 = ROW1-ROW4
if ((PINB & 0x08) == 0) { // D11
PORTB = (PORTB & (~0x10)) | (row[0] & 0x10); // COL D12
PORTC = (PORTC & (~0x03)) | (row[0] & 0x03); // COL A0, A1
}
if ((PINB & 0x04) == 0) { // D10
PORTB = (PORTB & (~0x10)) | (row[1] & 0x10);
PORTC = (PORTC & (~0x03)) | (row[1] & 0x03);
}
if ((PINB & 0x02) == 0) { // D9
PORTB = (PORTB & (~0x10)) | (row[2] & 0x10);
PORTC = (PORTC & (~0x03)) | (row[2] & 0x03);
}
if ((PINB & 0x01) == 0) { // D8
PORTB = (PORTB & (~0x10)) | (row[3] & 0x10);
PORTC = (PORTC & (~0x03)) | (row[3] & 0x03);
}
}

As the Synth Cart notes are mostly controlled from the left controller, I’m only coding up for the Arduino to drive one controller. I’m using a genuine Video Touch Pad for the second controller.

Update: The code now includes a controller pass-through mode. If a keypad is plugged into the second socket on the Arduino, then either MIDI or the keypad can be used to drive the Synth Cart.

To achieve this, there are now two sets of row[] arrays containing the column values and when it comes to writing them out, they are combined as follows:

if ((PINB & 0x08) == 0) { // D11
PORTB = (PORTB & (~0x10)) | (row[0][0] & row[1][0] & 0x10);
PORTC = (PORTC & (~0x03)) | (row[0][0] & row[1][0] & 0x03);
}

As the signals are active LOW, the two values need to be logically ANDed together to get the correct result. I could have simply called the same noteOn/noteOff routines for the keypad, but then I’d have the situation where if both keys for a note are active, the first one released will stop the sound. By combining them in this way, the note will keep sounding until both keys are released.

Find it on GitHub here.

Closing Thoughts

I really ought to map the pitches of the Atari notes onto their respective MIDI notes, but then I’m not sure what to do for the gaps.

In principle I could wire up both controllers and then use MIDI pads on a MIDI controller just as MIDI-driving control keys rather than actual keyboard notes, but this shows the principle.

I’m still not sure about the power issues, but it seems to work. I guess it will keep working until one day it might not and I’ll be looking for a new Atari 2600 junior.

The slight stuttering in the video is when I end up touching a couple of the volca’s keys at the same time. I suspect I could do something a bit more robust in code to prevent repeat triggering, but this is all fine for now as a proof of concept.

Kevin

#arduinoUno #atari #atari2600 #midi #synthcart