Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
sebosp authored Jul 7, 2024
2 parents 7a34061 + ba64fa8 commit 0804a07
Show file tree
Hide file tree
Showing 16 changed files with 616 additions and 87 deletions.
41 changes: 32 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
# pedales

## Intro
Algunos pedales para Figueroa Lab.

Hacer pedales de guitarra, bajo y otros instrumentos, es sencillo.
- [Imitator](https://github.com/fede2cr/pedales/tree/master/imitator)

Solo necesita aprender a soldar y a ensamblar componentes teniendo un poco de cuidado. Poco a poco iremos experimentando en cambiar compomentes en los diseños y observando la función de los diferentes transistores, capacitores y resistencias que componen estos sencillos circuitos.
Utiliza alucinación de inteligencia artificial para separar cualquier canción en voz, percusión, bajo y otros (guitarras, teclados, vientos, etc) y luego con los controles del pedal podemos realizar una mezcla en vivo, o eliminar uno o varios instrumentos.

Todos los diseños que usaremos con ejemplos clásicos de pedales, disponibles en múltiples foros en Internet y en libros especializados.
Esto le permite ser un pedal de "super-karaoke", ya que podemos eliminar la voz para usarlo como un karaoke tradicional, así como también eliminar una guitarra, o la batería o el bajo; para practicar encima de tu canción preferida

Lista de pedales:
[![Imitator demo](https://img.youtube.com/vi/_IGj-wyZRRc/default.jpg)](https://youtu.be/_IGj-wyZRRc)

- [Amplificador LM386](https://github.com/fede2cr/pedales/tree/master/ampli-lm386)
¿Como funciona? Con una librería de inteligencia artificial llamada demucs, el pedal imagina o alucina como debería sonar el instrumento original antes de ser mezclado en el estudio.

![Prototipo de Amplificador LM386](https://github.com/fede2cr/pedales/blob/master/ampli-lm386/img/prototipo%20ampli-lm386.jpg)
Se recomienda el pedal para investigadores de AI, pero también para cualquiera que quiera mostrar al mundo como toca un instrumento como si fuera parte de su grupo preferido.

- [Bazz Fuss](https://github.com/fede2cr/pedales/tree/master/bazz%20fuss)
- [Guatusa](https://github.com/fede2cr/pedales/tree/master/guatusa)

Es un pedal que funciona como teclado bluetooth, por lo que lo puedes conectar con computadoras, tabletas, teléfonos y otros dispositivos.

Con esto puedes controlar de manera sencilla aplicaciones como youtube, tu estación de audio favorita, pasar la página de una partitura en la tableta, y muchas otras funciones. Puedes agregar tus propias combinaciones de teclas de manera muy sencilla, así como enlazar varios pedales para pasar la página de la partitura para todos los músicos en escenario.

![Guatusa](/doc/img/guatusa.jpg)

- [Chicharra](https://github.com/fede2cr/pedales/tree/master/chicharra)

Un trémolo versatil, ya que puedes usar los modos predefinidos, pero también puedes agregar diferentes formas de modular tu trémolo, y hacerlo que suene como una chicharra si así lo deseas.

![Chicharra](/doc/img/chicharra-top.jpg)

## Jícaras

Los pedales no utilizan cajas de metal como el resto de pedales, sino que pensando en revitalizar técnicas artesanales indígenas y buscando maneras creativas para tener un menor impacto sobre la huella de carbono, estos pedales son construídos de manera artesanal utilizando jícaras como la base estructural de los pedales.

Todos los pedales van a incluír esta historieta que explica la relevancia de la Jícara en el libro sagrado *Popol Vuh*, y estamos en progreso de recolectar otras historias indígenas de culturas de Costa Rica para difundir esta importante pero olvidada especie.

![Ixquic y las jícaras - Extrato del Popol Vuh](/doc/Ixquic_y_las_jícaras.pdf)

## Software libre y hardware libre

Todos los pedales diseñados son software libre y hardware libre, lo que quiere decir que tanto la manera como han sido programados, así como los componentes y la forma en como se conectan, es información que acompaña a estos pedales. De forma que puedan ser reparados, mejorados y copiados; solo se solicita que los cambios también sean publicados de manera que toda la comunidad de pedales pueda avanzar al mismo tiempo.

![Prototipo de Bazz Fuss](https://github.com/fede2cr/pedales/blob/master/bazz%20fuss/img/prototipo%20bazz%20fuss.jpg)
Binary file removed ampli-lm386/img/prototipo ampli-lm386.jpg
Binary file not shown.
Binary file removed bazz fuss/img/prototipo bazz fuss.jpg
Binary file not shown.
85 changes: 85 additions & 0 deletions chicharra/pedal/code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import time
import board
import neopixel
import adafruit_ds3502
from adafruit_seesaw import neopixel, seesaw, rotaryio, digitalio
from adafruit_debouncer import Button

'''
Helper function arduino-like map(), to map the volume (1-127) to LED
intensity (0-255). The first argument is the value to convert, and it
returns the converted value.
Example:
y = _map_vol_to_color(25)
'''
def _map_vol_to_color(volume):
return int((volume - 0) * (255 - 0) / (127 - 0) + 0)

def square(pixel, speed):
TIME_CONST = 10
pixel.fill((255, 0, 0))
time.sleep(speed*TIME_CONST)
pixel.fill((0, 0, 0))
time.sleep(speed*TIME_CONST)

def saw(pixel, speed):
for volumen in range(0, 255, 5):
pixel.fill((volumen, 0, 0))
time.sleep(speed)

def saw_reverse(pixel, speed):
for volumen in range(255, 0, -5):
pixel.fill((volumen, 0, 0))
time.sleep(speed)

def triangle(pixel, speed):
saw(pixel, speed)
saw_reverse(pixel, speed)

i2c = board.STEMMA_I2C()
ds3502 = adafruit_ds3502.DS3502(i2c)
ds3502.wiper = 127

mode_ss = seesaw.Seesaw(i2c, addr=0x36)
speed_ss = seesaw.Seesaw(i2c, addr=0x37)
depth_ss = seesaw.Seesaw(i2c, addr=0x38)

mode_ss.pin_mode(24, mode_ss.INPUT_PULLUP)
mode_button = digitalio.DigitalIO(mode_ss, 24)
mode_pixel = neopixel.NeoPixel(mode_ss, 6, 1)
mode_encoder = rotaryio.IncrementalEncoder(mode_ss)

speed_ss.pin_mode(24, speed_ss.INPUT_PULLUP)
speed_button = digitalio.DigitalIO(speed_ss, 24)
speed_pixel = neopixel.NeoPixel(speed_ss, 6, 1)
speed_encoder = rotaryio.IncrementalEncoder(speed_ss)

depth_ss.pin_mode(24, depth_ss.INPUT_PULLUP)
depth_button = digitalio.DigitalIO(depth_ss, 24)
depth_pixel = neopixel.NeoPixel(depth_ss, 6, 1)
depth_encoder = rotaryio.IncrementalEncoder(depth_ss)

mode_pixel.fill((255,0,0))
speed_pixel.fill((0,255,0))
depth_pixel.fill((0,0,255))

speed = 0.05

while True:
square(mode_pixel, speed)
square(mode_pixel, speed)
square(mode_pixel, speed)
saw(mode_pixel, speed)
saw_reverse(mode_pixel, speed)
triangle(mode_pixel, speed)
mode_pixel.fill((255,0,0))
ds3502.wiper = 127
print("Wiper set to %d" % ds3502.wiper)
time.sleep(3)
ds3502.wiper = 0
print("Wiper set to %d" % ds3502.wiper)
time.sleep(3)
ds3502.wiper = 63
print("Wiper set to %d" % ds3502.wiper)
time.sleep(3)
Binary file added doc/Ixquic_y_las_jícaras.pdf
Binary file not shown.
Binary file added doc/img/chicharra-side.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/chicharra-top.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/guatusa.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions guatusa/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'''
Add your application codes here.
You add an app by creating a variable name with the name
of the app, inside in [] you define a color in rgb in format
similar to (255, 0, 0), then if the mode has to send text or
a particular keycode, with the value in a tuple. In the format:
app_name = [ (0, 255, 255), "L", Keycode.ENTER ]
The ```modes``` variable has the enabled modes.
Keycodes are documented [here](https://docs.circuitpython.org/projects/hid/en/latest/_modules/adafruit_hid/keycode.html):
'''

from adafruit_hid.keycode import Keycode

youtube = [ (255, 0, 0), "<", ">" ]
tableta = [ (0, 255, 0), Keycode.PAGE_UP, Keycode.PAGE_DOWN]
audacity = [ (0, 255, 255), "R", Keycode.SPACE ]
mpv = [ (255, 255, 0), Keycode.LEFT_ARROW, "p" ]
modes = [ youtube, tableta, audacity, mpv ]

106 changes: 106 additions & 0 deletions guatusa/code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
"""
"""
import time
import board
from digitalio import DigitalInOut, Direction, Pull
from adafruit_seesaw import seesaw, neopixel, rotaryio, digitalio
from analogio import AnalogIn
from adafruit_debouncer import Button

import adafruit_ble
from adafruit_ble.advertising import Advertisement
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.standard.hid import HIDService
from adafruit_ble.services.standard.device_info import DeviceInfoService
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode

import apps

vbat_voltage = AnalogIn(board.VOLTAGE_MONITOR)
seesaw = seesaw.Seesaw(board.I2C(), 0x36)

encoder = rotaryio.IncrementalEncoder(seesaw)
seesaw.pin_mode(24, seesaw.INPUT_PULLUP)

pixel = neopixel.NeoPixel(seesaw, 6, 1)

pedal_button_left = DigitalInOut(board.D6)
pedal_button_left.direction = Direction.INPUT
pedal_button_left.pull = Pull.UP
pedal_pressed_left = Button(pedal_button_left, long_duration_ms=500, interval=0.01)

pedal_button_right = DigitalInOut(board.D5)
pedal_button_right.direction = Direction.INPUT
pedal_button_right.pull = Pull.UP
pedal_pressed_right = Button(pedal_button_right, long_duration_ms=500, interval=0.01)

last_position = -1

hid = HIDService()

device_info = DeviceInfoService(software_revision=adafruit_ble.__version__,
manufacturer="Adafruit Industries")
advertisement = ProvideServicesAdvertisement(hid)
advertisement.appearance = 961
scan_response = Advertisement()
scan_response.complete_name = "CircuitPython HID"

ble = adafruit_ble.BLERadio()

ble.name = "guatusa"

if not ble.connected:
pixel.fill((255,255,255))
print("advertising")
ble.start_advertising(advertisement, scan_response)
else:
print("already connected")
print(ble.connections)

def pedal_button(botones):
'''
Converts the buttons to keyboard events
'''
pedal_pressed_left.update()
pedal_pressed_right.update()
if pedal_pressed_left.short_count:
print(botones)
print(type(botones[1]))
if isinstance(botones[1], str):
kl.write(botones[1])
else:
k.send(botones[1])

if pedal_pressed_right.short_count:
print(botones)
if isinstance(botones[2], str):
kl.write(botones[2])
else:
k.send(botones[2])

def get_voltage(pin):
return (pin.value * 3.6) / 65536 * 2

k = Keyboard(hid.devices)
kl = KeyboardLayoutUS(k)
while True:
while not ble.connected:
pass
print("Start typing:")

while ble.connected:
# negate the position to make clockwise rotation positive
position = -encoder.position

#position = 0
if position != last_position:
print(position)
print(apps.modes[position%len(apps.modes)])
pixel.fill(apps.modes[position%len(apps.modes)][0])
pedal_button(apps.modes[position%len(apps.modes)])

last_position = position

ble.start_advertising(advertisement)
10 changes: 6 additions & 4 deletions imitator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ It has one button to control with short presses (play/pause), four rotary encode

With this pedal you can plug it separately to a PA or speakers two have better audio quality, or directly to your amp with a pedal like [JHS Summing Amp](https://www.jhspedals.info/summing-amp) and play it straight to your amp. You can also use something like [TC Electronic Wiretap](https://www.tcelectronic.com/product.html?modelCode=P0CM1) to record only your guitar part if used after your pedal chain, or to record the complete song if used after the imitator pedal.

## Workflow

The pedal will start with a "fire" screensaver to indicate that it is ready to be used. While in this mode, you can press the pedal button to start playing, or the most left or right buttons to switch to a previous or next song.

Once it is in play mode, you can press the pedal button for pause/unpause, press the rotary encoder buttons to mute a channel, or turn their knobs to change the channel volume. Once it finish playing a song, it will get back to standby mode with the screensaver.

## Limitations

### Guitar and other instruments

The un-mix technology is provided by the free software from Facebook called [demucs](https://github.com/facebookresearch/demucs) which currently splits the audio in four channels: voice, bass, drums and **others**. This means that the guitar audio will be split combined with other instruments such as keyboards, winds, brass and others, which means that some songs that have heavy use of this sounds, will have it removed if you mute the "guitar" (called "others") channel.

There is experimental training that can be used to teach the demucs software to remove only the guitar, but it does not work as good as it does for bass, drums or vocals.

### Rotary encoders

Also, the rotary encoders can only read when they change, not where they are. So it is recommended that before starting a playing session, to turn the knobs to "12" to indicate 100% volume.
Loading

0 comments on commit 0804a07

Please sign in to comment.