Hello.
This post will be an update on how the coding part functions for my interactive sound project – Stereo Type.
The coding and everything is being done is processing at the moment. So far its entirely focused around sound and the playback of sound but as soon as sound part is dealt with I will put my entire focus on the visualisation part.
The point that I arrived with the sound coding is actually quite promising. The Minim library that’s actually integrated with the Processing is very helpful. The function of pressing a key and hearing a pre-recorded sound brought me the idea of a piano application. Since the action is essentially: you press a key and you hear a sound. I’ve found some piano applications that were created in Processing and I’ve found the open sources. That way I had an idea how to go from there.
With the help of this “approximation” I managed to code everything to maintain a successful playback for all the sound recordings I’ve made so far.
I will provide the information through screenshots and pasting the codes in the forum from now on to underline which code is representing which function.
So far this is the entire code in processing window:
import ddf.minim.*;
Minim minim;
AudioPlayer playerA;
AudioPlayer playerB;
AudioPlayer playerC;
AudioPlayer playerD;
AudioPlayer playerE;
AudioPlayer playerF;
AudioPlayer playerG;
AudioPlayer playerH;
AudioPlayer playerI;
AudioPlayer playerJ;
AudioPlayer playerK;
AudioPlayer playerL;
AudioPlayer playerM;
AudioPlayer playerN;
AudioPlayer playerO;
AudioPlayer playerP;
AudioPlayer playerQ;
AudioPlayer playerR;
AudioPlayer playerS;
AudioPlayer playerT;
AudioPlayer playerU;
AudioPlayer playerV;
AudioPlayer playerW;
AudioPlayer playerX;
AudioPlayer playerY;
AudioPlayer playerZ;
void setup() {
minim = new Minim(this);
playerA = minim.loadFile(“a.wav”);
playerB = minim.loadFile(“b.wav”);
playerC = minim.loadFile(“c.wav”);
playerD = minim.loadFile(“d.wav”);
playerE = minim.loadFile(“e.wav”);
playerF = minim.loadFile(“f.wav”);
playerG = minim.loadFile(“g.wav”);
playerH = minim.loadFile(“h.wav”);
playerI = minim.loadFile(“i.wav”);
playerJ = minim.loadFile(“j.wav”);
playerK = minim.loadFile(“k.wav”);
playerL = minim.loadFile(“l.wav”);
playerM = minim.loadFile(“m.wav”);
playerN = minim.loadFile(“n.wav”);
playerO = minim.loadFile(“o.wav”);
playerP = minim.loadFile(“p.wav”);
playerQ = minim.loadFile(“q.wav”);
playerR = minim.loadFile(“r.wav”);
playerS = minim.loadFile(“s.wav”);
playerT = minim.loadFile(“t.wav”);
playerU = minim.loadFile(“u.wav”);
playerV = minim.loadFile(“v.wav”);
playerW = minim.loadFile(“w.wav”);
playerX = minim.loadFile(“x.wav”);
playerY = minim.loadFile(“y.wav”);
playerZ = minim.loadFile(“z.wav”);
}
void draw(){
if (keyPressed) {
if (key == ‘a’ || key == ‘A’)
{
playerA.rewind();
playerA.play();
}
if (key == ‘b’ || key == ‘B’)
{
playerB.rewind();
playerB.play();
}
if (key == ‘c’ || key == ‘C’)
{
playerC.rewind();
playerC.play();
}
if (key == ‘d’ || key == ‘D’)
{
playerD.rewind();
playerD.play();
}
if (key == ‘e’ || key == ‘E’)
{
playerE.rewind();
playerE.play();
}
if (key == ‘f’ || key == ‘F’)
{
playerF.rewind();
playerF.play();
}
if (key == ‘g’ || key == ‘G’)
{
playerG.rewind();
playerG.play();
}
if (key == ‘h’ || key == ‘H’)
{
playerH.rewind();
playerH.play();
}
if (key == ‘i’ || key == ‘I’)
{
playerI.rewind();
playerI.play();
}
if (key == ‘j’ || key == ‘J’)
{
playerJ.rewind();
playerJ.play();
}
if (key == ‘k’ || key == ‘K’)
{
playerK.rewind();
playerK.play();
}
if (key == ‘l’ || key == ‘L’)
{
playerL.rewind();
playerL.play();
}
if (key == ‘m’ || key == ‘M’)
{
playerM.rewind();
playerM.play();
}
if (key == ‘n’ || key == ‘N’)
{
playerN.rewind();
playerN.play();
}
if (key == ‘o’ || key == ‘O’)
{
playerO.rewind();
playerO.play();
}
if (key == ‘p’ || key == ‘P’)
{
playerP.rewind();
playerP.play();
}
if (key == ‘q’ || key == ‘Q’)
{
playerQ.rewind();
playerQ.play();
}
if (key == ‘r’ || key == ‘R’)
{
playerR.rewind();
playerR.play();
}
if (key == ‘s’ || key == ‘S’)
{
playerS.rewind();
playerS.play();
}
if (key == ‘t’ || key == ‘T’)
{
playerT.rewind();
playerT.play();
}
if (key == ‘u’ || key == ‘U’)
{
playerU.rewind();
playerU.play();
}
if (key == ‘v’ || key == ‘V’)
{
playerV.rewind();
playerV.play();
}
if (key == ‘w’ || key == ‘W’)
{
playerW.rewind();
playerW.play();
}
if (key == ‘x’ || key == ‘X’)
{
playerX.rewind();
playerX.play();
}
if (key == ‘y’ || key == ‘Y’)
{
playerY.rewind();
playerY.play();
}
if (key == ‘z’ || key == ‘Z’)
{
playerZ.rewind();
playerZ.play();
}
}
}
This code as a whole is working without problems. One thing I was worried was to load 26 players and if Processing would allow me to do so. But it did. There’s no problems with the playback and the sounds can play on top of each other without interrupting one another. Minim is great afterall 🙂
Next update will include more finished sounds and coding of the visual parts.
What to do:
-I’m thinking of doing an animation for each letter to sort of have a karaoke sort of effect – where the playbacked letter will be highlighted as the sound plays to show which sounds represent which letter.
-I also want to show what people have typed so far. This will make it easier for them to track their input and output better.
-Hopefully, if I can finish in time, I want to upload the entire thing on the web so I can share this with more people and receive feedbacks for my work. Maybe even implement this in my portfolio website: ahmetalperworks so I can promote everything together. Too much greed? Maybe 🙂
Until then.
-Ahmet