# Lovely app : a sonic pi challenge code?

**URL:** <https://in-thread.sonic-pi.net/t/lovely-app-a-sonic-pi-challenge-code/3655>\
**Category:** Creations & Ideas\
**Created:** [April 16, 2020, 6:25pm UTC](https://in-thread.sonic-pi.net/t/lovely-app-a-sonic-pi-challenge-code/3655 "2020-04-16T18:25:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [April 16, 2020, 6:25pm UTC](https://in-thread.sonic-pi.net/t/lovely-app-a-sonic-pi-challenge-code/3655/1 "2020-04-16T18:25:16Z")

</div>

HI everybody,

i discover this little web app [https://arp.jake.fun/](https://arp.jake.fun/)

it’s quite interesting and can give some ideas to be developped with sonic pi.

Hope you like it !

---

<div class="post-metadata">

**Author:** ![hitsware](https://avatars.discourse-cdn.com/v4/letter/h/a9adbd/32.png) [@hitsware](https://in-thread.sonic-pi.net/u/hitsware)\
**Post date:** [April 17, 2020, 2:23pm UTC](https://in-thread.sonic-pi.net/t/lovely-app-a-sonic-pi-challenge-code/3655/2 "2020-04-17T14:23:18Z")

</div>

Good One 🙂  
Reminds me of this  
[http://ctford.github.io/klangmeister/](http://ctford.github.io/klangmeister/)

---

<div class="post-metadata">

**Author:** ![perpetual\_monday](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/perpetual_monday/32/955_2.png) [@perpetual\_monday](https://in-thread.sonic-pi.net/u/perpetual_monday)\
**Post date:** [April 17, 2020, 3:14pm UTC](https://in-thread.sonic-pi.net/t/lovely-app-a-sonic-pi-challenge-code/3655/3 "2020-04-17T15:14:17Z")

</div>

Neat, reminds of [https://codepen.io/jakealbaugh/full/qNrZyw](https://codepen.io/jakealbaugh/full/qNrZyw)

It would be great if there could a set of little apps with Sonic Pi as the backend, both for learners and creators. For example, taking this as an inspiration: [https://codepen.io/jakealbaugh/full/qNrZyw](https://codepen.io/jakealbaugh/full/qNrZyw)

---

<div class="post-metadata">

**Author:** ![hitsware](https://avatars.discourse-cdn.com/v4/letter/h/a9adbd/32.png) [@hitsware](https://in-thread.sonic-pi.net/u/hitsware)\
**Post date:** [April 17, 2020, 4:02pm UTC](https://in-thread.sonic-pi.net/t/lovely-app-a-sonic-pi-challenge-code/3655/4 "2020-04-17T16:02:33Z")

</div>

I don’t know if Ruby lends itself to such ?  
I know I have not found a way to make it  
respond to the keyboard. Ended up using  
Python … I.E.

```ruby
ptch=["Grand Piano","Bright Grand","Electric Grand","Honky Tonk",
      "Rhodes","Chorus Piano","Harpsichord","Clavichord",
      "Celesta","Glockenspiel","Music Box","Vibraphone",
      "Marimba","Xylophone","Tubular Bells","Dulcimer",
      "Hammond Organ","Percussion Organ","Rock Organ",
      "Church Organ","Reed Organ","Accordian","Harmonica",
      "Tango Accordian","Acoustic Nylon Guitar",
      "Acoustic Steel Guitar","Electric Jazz Guitar",
      "Electric Clean Guitar","Electric Mute Guitar",
      "Overdrive Guitar","Distorted Guitar","Guitar Harmonic",
      "Acoustic Bass","Electric Bass Finger","Electric Bass Pick",
      "Fretless Bass","Slap Bass One","Slap Bass Two",
      "Synth Bass One","Synth Bass Two","Violin","Viola","Cello",
      "Contrabass","Tremolo Strings","Pizzicato Strings",
      "Orchestra Harp","Timpani","String Ensemble One",
      "String Ensemble Two","Synth Strings One","Synth Strings Two",
      "Choir Ahhs","Voice Oohs","Synth Voice","Orchestra Hit",
      "Trumpet","Trombone","Tuba","Mute Trumpet","French Horn",
      "Brass Section","Synth Brass One","Synth Brass Two",
      "Soprano Sax","Alto Sax","Tenor Sax","Baritone Sax","Oboe",
      "English Horn","Bassoon","Clarinet","Piccolo","Flute",
      "Recorder","Pan Flute","Bottle Blow","Shakuhachi","Whistle",
      "Ocarina","Square Wave","Sawtooth","Calliope","Chiff Lead",
      "Charang","Solo Synth VX","Brite Saw","Brass and Lead",
      "Fantasia Pad","Warm Pad","Poly Synth Pad","Space Vox Pad",
      "Bowed Glass Pad","Metal Pad","Halo Pad","Sweep Pad",
      "Ice Rain","Sound Track","Crystal","Atmosphere","Brightness",
      "Goblin","Echo Drops","Star Theme","Sitar","Banjo","Shamisen",
      "Koto","Kalimba","Bagpipe","Fiddle","Shanai",
      "Tinkle Bell","Agogo","Steel Drums","Wood Block","Taiko Drum",
      "Melodic Tom","Synth Drum","Rev Cymbal",
      "Guitar Fret Noise","Breath Noise","Sea Shore","Bird Tweet"] 

import pygame; pygame.init()
pygame.display.set_mode([1,1])
fo=open("/dev/snd/midiC1D0","wb",0)
note=60; patch=0
print("Any arrow key to start")
while True:
  for event in pygame.event.get():
    if event.type == pygame.KEYDOWN:
      if event.key == pygame.K_UP:
        note=note+7
      if event.key == pygame.K_DOWN:
        note=note-7
      if event.key== pygame.K_RIGHT:
        patch=patch+1
      if event.key==pygame.K_LEFT:
        patch=patch-1
      for off in range(note-2,note+2): 
        mmsg=[144,off,0];fo.write(bytes(mmsg))    
      mmsg=[192,patch];fo.write(bytes(mmsg))  
      mmsg=[144,note,127];fo.write(bytes(mmsg))   
      print()
      print()
      print(" Up - Down arrows for note =", note)
      print("Left - Right arrows for patch =", patch, ptch[patch])
      print(" Frequency ~", round(2**((note-69)/12)*440),"Hz")        

```

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [April 17, 2020, 4:24pm UTC](https://in-thread.sonic-pi.net/t/lovely-app-a-sonic-pi-challenge-code/3655/5 "2020-04-17T16:24:23Z")

</div>

Good example ! [https://codepen.io/jakealbaugh/full/qNrZyw](https://codepen.io/jakealbaugh/full/qNrZyw)

@robin.newman has made some apps using touchOSC and Sonic Pi. @Martin developped a app using open-stage-control and sonic pi.

i try myself to develop a little app but time and talent are missing 🙂 but one day i hope.

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [April 17, 2020, 4:33pm UTC](https://in-thread.sonic-pi.net/t/lovely-app-a-sonic-pi-challenge-code/3655/6 "2020-04-17T16:33:47Z")

</div>

we have to use a “compagnon”  
something into a browser (Brtoher ! ): [https://jsfiddle.net/KeithMcMillenInstruments/upae79bu](https://jsfiddle.net/KeithMcMillenInstruments/upae79bu)  
or a software like open-stage-control : you can add widget reacting to keyboard.

this software can be used to detect keyboard computer

> **[Virtual MIDI Piano Keyboard](https://sourceforge.net/projects/vmpk/)**
>
> Download Virtual MIDI Piano Keyboard for free. Virtual MIDI controller for Linux, Windows and OSX. VMPK is a virtual MIDI piano keyboard for Linux, Windows and OSX. Based on Qt and Drumstick the program is a MIDI event generator using the computer's...
