浏览代码

Giving chuck another try

master
Pete Shadbolt 10 年前
父节点
当前提交
46288fbaa6
共有 10 个文件被更改,包括 4 次插入282 次删除
  1. +0
    -20
      README
  2. +3
    -0
      chuck.ck
  3. +0
    -77
      delay.csd
  4. +0
    -4
      makefile
  5. +0
    -58
      osc.csd
  6. +1
    -0
      run.sh
  7. +0
    -53
      web/:q
  8. +0
    -2
      web/css.css
  9. +0
    -15
      web/index.html
  10. +0
    -53
      web/main.js

+ 0
- 20
README 查看文件

@@ -1,20 +0,0 @@
TODO:
Two or three channels

Global Sliders:
- BPM
- Input gain
- Amount of input to send to delay line
- Delay feedback amount

Global Switches:
- OSC Master/Minion

Channel Sliders:
- Gain

Channel buttons:
- Clear
- Level
- Mute/Unmute
- Pitch down

+ 3
- 0
chuck.ck 查看文件

@@ -0,0 +1,3 @@
adc => Gain g1 => dac;
0.5 => g1.gain;
1000::second => now;

+ 0
- 77
delay.csd 查看文件

@@ -1,77 +0,0 @@
<CsoundSynthesizer>
<CsOptions>
-iadc -odac -dm0
</CsOptions>

<CsInstruments>
; CSound parameters
sr = 44100 ; Sample rate
ksmps = 20 ; Number of audio samples in each control cycle
nchnls = 2 ; Number of channels (2=stereo)
0dbfs = 1 ; Maximum amplitude

; FLTK GUI interface
FLpanel "M I L C H L O D E", 500, 300, 0, 0, 0, 1
gkInputGain,ihInputGain FLslider "Input Gain", 0, 1, 0, 3, -1, 400, 20, 5, 5
gkInputMute,ihInputMute FLbutton "Mute", 0, 1, 3, 85, 25, 410, 5, 0, 1, 0, -1

; Sliders
gkdlt,ihdlt FLslider "Delay Time (sec)", .001, 5, 0, 3, -1, 490, 25, 5, 50
gkmix,ihmix FLslider "Dry/Wet Mix", 0, 1, 0, 3, -1, 490, 25, 5, 100
gkfeedamt,ihfeedamt FLslider "Feedback Ratio", 0, 1, 0, 3, -1, 490, 25, 5, 150

; Set defaults
FLsetVal_i 1, ihInputMute
FLsetVal_i .5, ihInputGain
FLsetVal_i 1, ihdlt
FLsetVal_i 0.5, ihmix
FLsetVal_i 0.95, ihfeedamt

FLpanel_end ;End of GUI
FLrun ;Run the FLTK thread

; Instr 1 is the source
instr 1

; Turn off with the switch
if gkInputMute=0 then
turnoff
endif

; Get input from mic/line
asigL, asigR ins
gasigL = asigL * gkInputGain
gasigR = asigR * gkInputGain
endin

; Instr 2 is the delay line
instr 2

adlt = gkdlt

;Left channel
abufferL delayr 5 ;Buffer
adelsigL deltap3 adlt ;Tap
delayw gasigL + (adelsigL * gkfeedamt) ;Feedback

;Right channel
abufferR delayr 5 ;Buffer
adelsigR deltap3 adlt ;Tap
delayw gasigR + (adelsigR * gkfeedamt) ;Feedback

aL ntrpol gasigL, adelsigL, gkmix
aR ntrpol gasigR, adelsigR, gkmix

gkamp = .7;
outs aL * gkamp, aR * gkamp ; Mix wet/dry
clear gasigL, gasigR ; Clear global audio sends
endin

</CsInstruments>

<CsScore>
i 2 0 -1 ;Instrument 2 plays a held note
f 0 3600 ;Keep performance going
</CsScore>

</CsoundSynthesizer>

+ 0
- 4
makefile 查看文件

@@ -1,4 +0,0 @@
all: run

run:
csound delay.csd

+ 0
- 58
osc.csd 查看文件

@@ -1,58 +0,0 @@
<CsoundSynthesizer>
<CsOptions>
-o dac
</CsOptions>
<CsInstruments>
sr = 48000
ksmps = 32
nchnls = 2
0dbfs = 1

; localhost means communication on the same machine, otherwise you need
; an IP adress
#define IPADDRESS # "localhost" #
#define S_PORT # 47120 #
#define R_PORT # 47120 #

turnon 1000 ; starts instrument 1000 immediately
turnon 1001 ; starts instrument 1001 immediately

instr 1000 ; this instrument sends OSC-values
kValue1 randomh 0, 0.8, 4
kNum randomh 0, 8, 8
kMidiKey tab (int(kNum)), 2
kOctave randomh 0, 7, 4
kValue2 = cpsmidinn (kMidiKey*kOctave+33)
kValue3 randomh 0.4, 1, 4
;Stext sprintf "%i", $S_PORT
OSCsend kValue1+kValue2, $IPADDRESS, $S_PORT, "/QuteCsound",
"fff", kValue1, kValue2, kValue3
endin


instr 1001 ; this instrument receives OSC-values
kValue1Received init 0.0
kValue2Received init 0.0
kValue3Received init 0.0
;Stext sprintf "%i", $R_PORT
ihandle OSCinit $R_PORT
kAction OSClisten ihandle, "/QuteCsound", "fff",
kValue1Received, kValue2Received, kValue3Received
if (kAction == 1) then
;printk2 kValue2Received
;printk2 kValue1Received
endif
aSine poscil3 kValue1Received, kValue2Received, 1
outs aSine, aSine
endin

</CsInstruments>
<CsScore>
f 1 0 1024 10 1
f 2 0 8 -2 0 2 4 7 9 11 0 2
e 3600
</CsScore>
</CsoundSynthesizer>
; example by Alex Hofmann (Mar. 2011)

+ 1
- 0
run.sh 查看文件

@@ -0,0 +1 @@
chuck.alsa --bufsize64 chuck.ck

+ 0
- 53
web/:q 查看文件

@@ -1,53 +0,0 @@
var context = null;

// success callback when requesting audio input stream
function gotStream(stream) {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
var ctx = new AudioContext();

// Create an AudioNode from the stream.
var micSource = ctx.createMediaStreamSource(stream);

// Connect it to the destination to hear yourself (or any other node for processing!)
micSource.connect(ctx.destination);

}

document.addEventListener('DOMContentLoaded', function() {

//if (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia)
//navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;

if (!navigator.getUserMedia) navigator.getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
var constraints = { "audio": { "mandatory": { "googEchoCancellation": "false", "googAutoGainControl": "false", "googNoiseSuppression": "false", "googHighpassFilter": "false" }}}
navigator.getUserMedia(constraints, gotStream, function(e) { alert('Error getting audio'); console.log(e); });

//var controls = $("div#sliders");

//controls.find("input[name='delayTime']").on('input', function() {
//delay.delayTime.value = $(this).val();
//});

//controls.find("input[name='feedback']").on('input', function() {
//feedback.gain.value = $(this).val();
//});

//controls.find("input[name='frequency']").on('input', function() {
//filter.frequency.value = $(this).val();
//});

//delay = ctx.createDelay();
//delay.delayTime.value = 0.5;
//feedback = ctx.createGain();
//feedback.gain.value = 0.8;
//filter = ctx.createBiquadFilter();
//filter.frequency.value = 1000;
//delay.connect(feedback);
//feedback.connect(filter);
//filter.connect(delay);
//source.connect(delay);
//source.connect(ctx.destination);
//delay.connect(ctx.destination);

});


+ 0
- 2
web/css.css 查看文件

@@ -1,2 +0,0 @@
body {font-family: monospace; font-size:12pt; background:url(rules.png) center center no-repeat;}
.player { color:white; background-color:black; width:200px; padding:5px; border-radius:5px; text-align:center; height:300px;}

+ 0
- 15
web/index.html 查看文件

@@ -1,15 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Web audio test</title>
<link rel="stylesheet" type="text/css" href="css.css">
<script type="text/javascript" src="main.js"></script>
</head>

<body>

Testing testing

</body>
</html>


+ 0
- 53
web/main.js 查看文件

@@ -1,53 +0,0 @@
var context = null;

// success callback when requesting audio input stream
function gotStream(stream) {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
var ctx = new AudioContext();

// Create an AudioNode from the stream.
var micSource = ctx.createMediaStreamSource(stream);

// Connect it to the destination to hear yourself (or any other node for processing!)
micSource.connect(ctx.destination);

}

document.addEventListener('DOMContentLoaded', function() {

//if (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia)
//navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;

if (!navigator.getUserMedia) navigator.getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
var constraints = { "audio": { "mandatory": { "googEchoCancellation": "false", "googAutoGainControl": "false", "googNoiseSuppression": "false", "googHighpassFilter": "false" }}}
navigator.getUserMedia(constraints, gotStream, function(e) { alert('Error getting audio'); console.log(e); });

//var controls = $("div#sliders");

//controls.find("input[name='delayTime']").on('input', function() {
//delay.delayTime.value = $(this).val();
//});

//controls.find("input[name='feedback']").on('input', function() {
//feedback.gain.value = $(this).val();
//});

//controls.find("input[name='frequency']").on('input', function() {
//filter.frequency.value = $(this).val();
//});

//delay = ctx.createDelay();
//delay.delayTime.value = 0.5;
//feedback = ctx.createGain();
//feedback.gain.value = 0.8;
//filter = ctx.createBiquadFilter();
//filter.frequency.value = 1000;
//delay.connect(feedback);
//feedback.connect(filter);
//filter.connect(delay);
//source.connect(delay);
//source.connect(ctx.destination);
//delay.connect(ctx.destination);

});


正在加载...
取消
保存