Getting there
This commit is contained in:
parent
54340ef585
commit
d2ccead3f2
11
app.py
11
app.py
|
@ -15,10 +15,17 @@ def spe():
|
||||||
|
|
||||||
# Socket IO stuff
|
# Socket IO stuff
|
||||||
@socketio.on('action')
|
@socketio.on('action')
|
||||||
def hey():
|
def action():
|
||||||
print('action')
|
|
||||||
socketio.emit('all_action')
|
socketio.emit('all_action')
|
||||||
|
|
||||||
|
@socketio.on('noise')
|
||||||
|
def noise():
|
||||||
|
socketio.emit('all_noise')
|
||||||
|
|
||||||
|
@socketio.on('stop')
|
||||||
|
def stop():
|
||||||
|
socketio.emit('all_stop')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
socketio.run(
|
socketio.run(
|
||||||
app,
|
app,
|
||||||
|
|
|
@ -33,16 +33,16 @@ reverb.connect(Tone.Master)
|
||||||
instrument.connect(channel)
|
instrument.connect(channel)
|
||||||
|
|
||||||
const voice = new Tone.Player("/static/recordings/tts.mp3").connect(channel)
|
const voice = new Tone.Player("/static/recordings/tts.mp3").connect(channel)
|
||||||
voice.playbackRate = 0.75
|
voice.playbackRate = 0.65
|
||||||
voice.loop = true
|
voice.loop = true
|
||||||
voice.autostart = false
|
voice.autostart = false
|
||||||
|
|
||||||
const noise = new Tone.Noise("brown")
|
const noise = new Tone.Noise("brown")
|
||||||
noise.connect("channel")
|
|
||||||
|
|
||||||
let playloop = undefined
|
let playloop = undefined
|
||||||
|
let schedule = undefined
|
||||||
|
|
||||||
const pathway = pick([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
|
const pathway = pick([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
|
||||||
|
|
||||||
const play = () => {
|
const play = () => {
|
||||||
// Determine which of our patterns to play
|
// Determine which of our patterns to play
|
||||||
|
@ -79,7 +79,7 @@ const play = () => {
|
||||||
|
|
||||||
const interval = pick(["5m", "6m", "7m"])
|
const interval = pick(["5m", "6m", "7m"])
|
||||||
|
|
||||||
const schedule = Tone.Transport.scheduleRepeat((time) => {
|
schedule = Tone.Transport.scheduleRepeat((time) => {
|
||||||
pianoPart.stop()
|
pianoPart.stop()
|
||||||
pianoPart.start()
|
pianoPart.start()
|
||||||
}, interval, "0")
|
}, interval, "0")
|
||||||
|
@ -99,9 +99,9 @@ const play = () => {
|
||||||
break
|
break
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
playloop = new Tone.Loop((time) => {
|
playloop = new Tone.Player("/static/recordings/" + RECORDING).connect(channel)
|
||||||
instrument.triggerAttackRelease(NOTE, "16n")
|
playloop.loop = true
|
||||||
}, SPACE).start(0)
|
playloop.autostart = true
|
||||||
break
|
break
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
|
@ -112,13 +112,13 @@ const play = () => {
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
playloop = new Tone.Loop((time) => {
|
playloop = new Tone.Loop((time) => {
|
||||||
instrument.triggerAttackRelease(NOTE, "9n")
|
instrument.triggerAttackRelease(NOTE, "16n")
|
||||||
}, SPACE).start(0)
|
}, SPACE).start(0)
|
||||||
break
|
break
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
playloop = new Tone.Loop((time) => {
|
playloop = new Tone.Loop((time) => {
|
||||||
instrument.triggerAttackRelease(NOTE, "8n")
|
instrument.triggerAttackRelease(NOTE, "16n")
|
||||||
}, SPACE).start(0)
|
}, SPACE).start(0)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -130,11 +130,29 @@ const play = () => {
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
playloop = new Tone.Loop((time) => {
|
playloop = new Tone.Loop((time) => {
|
||||||
instrument.triggerAttackRelease(NOTE, "6n")
|
instrument.triggerAttackRelease(NOTE, "8n")
|
||||||
}, SPACE).start(0)
|
}, SPACE).start(0)
|
||||||
break
|
break
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
|
playloop = new Tone.Loop((time) => {
|
||||||
|
instrument.triggerAttackRelease(NOTE, "8n")
|
||||||
|
}, SPACE).start(0)
|
||||||
|
break
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
playloop = new Tone.Loop((time) => {
|
||||||
|
instrument.triggerAttackRelease(NOTE, "6n")
|
||||||
|
}, SPACE).start(0)
|
||||||
|
break
|
||||||
|
|
||||||
|
case 11:
|
||||||
|
playloop = new Tone.Loop((time) => {
|
||||||
|
instrument.triggerAttackRelease(NOTE, "6n")
|
||||||
|
}, SPACE).start(0)
|
||||||
|
break
|
||||||
|
|
||||||
|
case 12:
|
||||||
playloop = new Tone.Loop((time) => {
|
playloop = new Tone.Loop((time) => {
|
||||||
instrument.triggerAttackRelease(NOTE, "6n")
|
instrument.triggerAttackRelease(NOTE, "6n")
|
||||||
}, SPACE).start(0)
|
}, SPACE).start(0)
|
||||||
|
@ -147,18 +165,18 @@ const play = () => {
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
socket.on('all_action', () => {
|
socket.on('all_action', () => {
|
||||||
document.body.style.background = "orange"
|
|
||||||
voice.start()
|
voice.start()
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on('all_noise', () => {
|
socket.on('all_noise', () => {
|
||||||
document.body.style.background = "black"
|
|
||||||
voice.stop()
|
voice.stop()
|
||||||
|
channel.disconnect(pingpong)
|
||||||
|
noise.connect(Tone.Master)
|
||||||
noise.start()
|
noise.start()
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on('all_stop', () => {
|
socket.on('all_stop', () => {
|
||||||
|
noise.stop()
|
||||||
})
|
})
|
||||||
|
|
||||||
const flowers = ["🌼", "🌸", "💮", "🌺", "🪷", "🏵️"]
|
const flowers = ["🌼", "🌸", "💮", "🌺", "🪷", "🏵️"]
|
||||||
|
|
|
@ -6,7 +6,7 @@ export const NOTE = pick(NOTES)
|
||||||
const SPACING = ["7h", "8h", "9h", "10h"]
|
const SPACING = ["7h", "8h", "9h", "10h"]
|
||||||
export const SPACE = pick(SPACING)
|
export const SPACE = pick(SPACING)
|
||||||
|
|
||||||
const RECORDINGS = ["birds.mp3", "stairs.mp3"]
|
const RECORDINGS = ["birds.mp3", "stairs.mp3", "train.mp3"]
|
||||||
export const RECORDING = pick(RECORDINGS)
|
export const RECORDING = pick(RECORDINGS)
|
||||||
|
|
||||||
Tone.Transport.bpm.value = 60;
|
Tone.Transport.bpm.value = 60;
|
||||||
|
|
BIN
static/recordings/train.mp3
Normal file
BIN
static/recordings/train.mp3
Normal file
Binary file not shown.
Loading…
Reference in a new issue