# Reproducing note\_slide with midi

**URL:** <https://in-thread.sonic-pi.net/t/reproducing-note-slide-with-midi/1570>\
**Category:** Support, Help & Resources\
**Created:** [October 13, 2018, 10:46am UTC](https://in-thread.sonic-pi.net/t/reproducing-note-slide-with-midi/1570 "2018-10-13T10:46:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amiika](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/amiika/32/2401_2.png) [@amiika](https://in-thread.sonic-pi.net/u/amiika)\
**Post date:** [October 13, 2018, 10:46am UTC](https://in-thread.sonic-pi.net/t/reproducing-note-slide-with-midi/1570/1 "2018-10-13T10:46:41Z")

</div>

Hi,

I’v been trying to recreate note\_slide using midi without much success. Any help is much appreciated. I want to recreate:

```
c = play 60, note_slide: 1
control c, note: 70

```

… using midi. I’v been trying to recreate the sound with [portamento setting for Yamaha XG midi bank](http://www.studio4all.de/htmle/main91.html#xgprgsystem02c) like:

```
use_midi_defaults port: "loopmidi", channel: 1
use_real_time

# Not working

midi_cc 65, 127
midi_cc 5, 50

midi 60, sustain: 2
sleep 0.5
midi_cc 84, 70

sleep 3

# Or between on&off ?
# Not working

midi_note_on 60
sleep 0.5
midi_cc 84, 65
sleep 0.5
midi_cc 84, 70
sleep 1
midi_note_off 60

```

But it just plays one note. I got pitch bend working but sliding is limited to next few notes:

```
# This is working

midi 60, sustain: 2.0

in_thread do
  sleep 1
  100.times do |i|
    sleep 0.005
    midi_pitch_bend i.to_f/100
  end
  midi_pitch_bend 0.5
end
```

---

<div class="post-metadata">

**Author:** ![amiika](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/amiika/32/2401_2.png) [@amiika](https://in-thread.sonic-pi.net/u/amiika)\
**Post date:** [October 15, 2018, 9:19pm UTC](https://in-thread.sonic-pi.net/t/reproducing-note-slide-with-midi/1570/2 "2018-10-15T21:19:10Z")

</div>

Help newbie out here. As i understand portamento should slide between two currently playing notes. So something like this should work … but im missing something:

```
use_midi_defaults port: "loopmid", channel: 1
use_real_time

midi_cc 65, 127
midi_cc 5, 90

midi_note_on 50

midi_cc 84, 50 # Portamento Control is transmitted specifying the Note On Key of the currently-sounding note

# When a Portmento Control message is received, the currently sounding pitch will change with a Portamento Time of 0 to the next Key On key on the same channel

sleep 1
midi_note_on 65
sleep 1
midi_note_off 65
sleep 1
midi_note_on 60
sleep 1
midi_note_off 60

midi_note_off 50
```
