Oi, this website is currently on the move to https://turboflip.de - party on there!

Kuschelsoundddds ////BENDING_TEXTILE_SYNTH -Kristof

Entwurfsskizzen für eine Kuscheldecke die intensives Kuscheln belohnt. Je mehr sich der „User“ in die Decke einmummelt, desto mehr Feedback kommt von der Anwendung (z.B. in Form von Licht oder meditativen Sounds)

Velostat oder drucksensoren in der Decke? Kupferband….

Unity-Synthesizer Prototyp:


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SecondSynth : MonoBehaviour
{
public double frequency = 440.0;
private double increment;
private double phase;
private double sampling_frequency = 48000.0;

public float gain;
public float volume = 0.1f;

public float[] frequencies;
public int thisFreq;

public double mousepos;

public float mapped_pos;

public double iMin = 0f;
public double iMax = 1920f;
public double oMin = 440f;
public double oMax = 880f;
public double v;

 

 

void Start()
{
frequencies = new float[8];
frequencies[0] = 440;
frequencies[1] = 494;
frequencies[2] = 554;
frequencies[3] = 587;
frequencies[4] = 659;
frequencies[5] = 740;
frequencies[6] = 831;
frequencies[7] = 880;
}

void Update()
{
Vector3 mouse_position = Input.mousePosition;

mousepos = mouse_position.x;

mapped_pos = (mousepos - 0f) * 1f / (1920f - 0f);

v = mousepos;

float Remap(float iMin, float iMax, float oMin, float oMax, float v)
{
float t = InvLerp(iMin, iMax, v);
return Lerp(oMin, oMax, t);
}

Debug.Log(Remap);

 

//frequency = mouse_position.x;

 

 

if (Input.GetKeyDown(KeyCode.Mouse0))
{
gain = volume;

//frequency = frequencies[thisFreq];
//thisFreq += 1;
//thisFreq = thisFreq % frequencies.Length;
}

if (Input.GetKeyUp(KeyCode.Mouse0))
{
gain = 0;
}

 

}





void OnAudioFilterRead(float[] data, int channels)
{
increment = frequency * 2.0 * Mathf.PI / sampling_frequency;

for (int i = 0; i < data.Length; i += channels)
{
phase += increment;
data[i] = (float)(gain * Mathf.Sin((float)phase));

if(channels == 2)
{
data[i + 1] = data[i];
}

if(phase > (Mathf.PI * 2))
{
phase = 0.0;
}
}
}
}