This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html class="sl-root decks export loaded ua-phantomjs reveal-viewport theme-font-montserrat theme-color-white-blue"> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>Liberté d'apprendre et logiciels libres: Slides</title> | |
<meta name="description" content="Slides"> | |
<style>@import url("https://s3.amazonaws.com/static.slid.es/fonts/montserrat/montserrat.css");@import url("https://s3.amazonaws.com/static.slid.es/fonts/opensans/opensans.css");@import url("https://s3.amazonaws.com/static.slid.es/fonts/lato/lato.css");@import url("https://s3.amazonaws.com/static.slid.es/fonts/asul/asul.css");@import url("https://s3.amazonaws.com/static.slid.es/fonts/josefinsans/josefinsans.css");@import url("https://s3.amazonaws.com/static.slid.es/fonts/league/league_gothic.css");@import url("https://s3.amazonaws.com/static.slid.es/fonts/merriweathersans/merriweathersans.css");@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def play_lick(lick,root, scale, time) | |
spark lick | |
lick.each{|note| play((degree note, root, scale)) ; sleep time } | |
end | |
lix=(ring | |
[1, 9, 4, 9, 2, 9, 3, 9, 5, 9, 6, 9], | |
# ▄▁▆▁▅▁▅▁▆▁▇▁ | |
[1, 4, 9, 9, 2, 9, 3, 5, 9, 9, 6, 9], | |
# ▄▆▁▁▅▁▅▆▁▁▇▁ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sonic Pi script to play with licks (short melodies notated in scale degrees). The function to convert degrees to notes is cobbled together from the built-in `resolve_degree` and `resolve_degree_index` methods. | |
# Defining two new functions. Once defined, they don’t need to be included in other scripts. | |
# Lick player | |
def play_lick(lick, root, scale, time) # A “lick” is a list of scale degree numbers, with a set timing (i.e. “isorhythmic”). | |
spark lick # Show the lick as a text-based graph | |
lick.each{|note| play((degree_to_note note, root, scale)) ; sleep time } # Convert each degree number into a note and play it for the set amount of time. This function doesn’t use all the other `play` arguments such as `release:`and `amp:`. Could be useful in a future version, especially for timing. | |
end | |
DEGREES = {:i => 0, # Thought these were defined by default. They’re necessary for the degree conversion. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# “Rranding Ring Chains” | |
# Coded by Alex Enkerli, March 24, 2016 | |
# Playing with ring chains in Sonic Pi, using a previously-built script to play with “licks”. https://gist.github.com/Enkerli/0687533338c5e40516fc | |
# In several cases, the basic “lick” using degrees 3, 5, 1, and 4 of a given scale makes for intriguing combinations, once shuffled and cut apart. | |
def play_lick(lick, root, scale, time) | |
spark lick | |
lick.each{|note| play((degree_to_note note, root, scale)) ; sleep time } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Intro | |
# https://rbnrpi.wordpress.com/2015/04/06/musical-fireworks-with-sonic-pi-and-minecraft/ | |
# Ex 1: Notes | |
## # Ex 1a: Play | |
play 60 | |
## # Ex 1b: Play 2 | |
play 60 | |
play 56 | |
## # Ex 1c: Sleep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'drb/drb' | |
DRB_URI="drbunix:/var/tmp/sonic-pi-midiconnector" | |
@midi = DRbObject.new_with_uri(DRB_URI) | |
use_bpm 240 | |
use_synth :dtri | |
note_node=play 60, release: 100, attack: 1 | |
live_loop :ctl do | |
control note_node, amp: @midi.k2/127.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre> | |
<font color="#00979c">void</font> <font color="#5e6d03">setup</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#000000">{</font> | |
<b><font color="#d35400">Serial</font></b><font color="#434f54">.</font><font color="#d35400">begin</font><font color="#000000">(</font><font color="#000000">9600</font><font color="#000000">)</font><font color="#000000">;</font> | |
<font color="#000000">}</font> | |
<font color="#00979c">void</font> <font color="#5e6d03">loop</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#000000">{</font> | |
<font color="#00979c">int</font> <font color="#000000">readTime</font> <font color="#434f54">=</font> <font color="#000000">20</font><font color="#000000">;</font> | |
<font color="#434f54">// read the input on analog pin 0:</font> | |
<font color="#00979c">int</font> <font color="#000000">sensorValue</font> <font color="#434f54">=</font> <font color="#d35400">analogRead</font><font color="#000000">(</ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#N canvas 431 139 708 570 10; | |
#N canvas 553 258 450 300 soundload 0; | |
#X obj 100 157 openpanel; | |
#X obj 100 100 bng 45 250 50 0 empty empty Load 11 22 0 10 -261682 | |
-33289 -33289; | |
#X msg 100 182 read -resize \$1 soundfile1; | |
#X obj 100 209 soundfiler; | |
#X floatatom 100 233 10 0 0 0 - - -; | |
#X obj 100 256 s filelength; | |
#X obj 254 238 samplerate~; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO #import the GPIO library | |
import time #import the time library | |
from gpiozero import DistanceSensor | |
class Buzzer(object): | |
def __init__(self): | |
GPIO.setmode(GPIO.BCM) | |
self.buzzer_pin = 22 #set to GPIO pin 22 | |
GPIO.setup(self.buzzer_pin, GPIO.IN) | |
GPIO.setup(self.buzzer_pin, GPIO.OUT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gpiozero import * | |
from time import sleep | |
sensor = DistanceSensor(24, 23) | |
n = 0 | |
bz = PWMOutputDevice(18, initial_value=0.4) | |
bz.pulse(fade_in_time=0.3) | |
while True: | |
print('Distance to nearest object is', sensor.distance, 'm') |