# Receiving float numbers using OSC

**URL:** <https://in-thread.sonic-pi.net/t/receiving-float-numbers-using-osc/2146>\
**Category:** \[P\] Patreon Support\
**Created:** [March 21, 2019, 10:59am UTC](https://in-thread.sonic-pi.net/t/receiving-float-numbers-using-osc/2146 "2019-03-21T10:59:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![keys](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@keys](https://in-thread.sonic-pi.net/u/keys)\
**Post date:** [March 21, 2019, 10:59am UTC](https://in-thread.sonic-pi.net/t/receiving-float-numbers-using-osc/2146/1 "2019-03-21T10:59:09Z")

</div>

Hi, I am trying to send a float to SP using OSC but I run into a few issues. It works fine with integers. I have tried to round at the senders end but still have issues. Any suggestions please?

 ![ScreenHunter%2051](https://europe1.discourse-cdn.com/flex017/uploads/sonic_pi/original/1X/80406a5d5ac9e48f22f25757c53542b93cb4d7ea.jpeg)

---

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [March 21, 2019, 11:16am UTC](https://in-thread.sonic-pi.net/t/receiving-float-numbers-using-osc/2146/2 "2019-03-21T11:16:39Z")

</div>

Hi @keys.

It’s a bit hard to tell what the exact problem is with the error message half cut off there in the screenshot, but I suspect that you need to place a space between `start:` and `start`. At the moment I think Sonic Pi is having trouble telling the difference between the opt `start:` and the value you are giving it (`start`) .

---

<div class="post-metadata">

**Author:** ![samaaron](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/samaaron/32/7_2.png) [@samaaron](https://in-thread.sonic-pi.net/u/samaaron)\
**Post date:** [March 21, 2019, 11:28am UTC](https://in-thread.sonic-pi.net/t/receiving-float-numbers-using-osc/2146/3 "2019-03-21T11:28:13Z")

</div>

What’s likely happening here is that there’s an issue in this line:

```ruby
start = sync "/osc/test"

```

The result from `sync` is always a list. In this case, it’s a list with one element (a float around 0.1-0.4) so the value of `start` will be something like `[0.4000000059604645]`.

If you want to get at that value you need to look inside the list:

```ruby
start[0]

```

Alternatively, you can use the fancy destructuring assignment mechanism to get the value on assignment:

```ruby
start, _ = sync "/osc/test"

```

This asks for the first element to be assigned to `start` and the second to be assigned to `_`. We use `_` as a means of telling readers of the code that we’re not interested in the value. In this case it will be `nil` as there is no second value.

Sorry about this - this is a confusing edge case which is actually just standard behaviour in Ruby. Perhaps a future version of Sonic Pi which moves away from Ruby might make this slightly less confusing.

---

<div class="post-metadata">

**Author:** ![keys](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@keys](https://in-thread.sonic-pi.net/u/keys)\
**Post date:** [March 21, 2019, 11:31am UTC](https://in-thread.sonic-pi.net/t/receiving-float-numbers-using-osc/2146/4 "2019-03-21T11:31:53Z")

</div>

Ah thanks! I wrongly assumed that there was something wrong with the float number. Thanks for explaining how the list should be handled - It all makes sense and works perfectly now 😀👍

---

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [March 21, 2019, 11:41am UTC](https://in-thread.sonic-pi.net/t/receiving-float-numbers-using-osc/2146/5 "2019-03-21T11:41:22Z")

</div>

hahaha. I stand corrected 🙂  
That’s what I get for never having used sync in that way 😂
