Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/existentialaudio/swiftosc
SwiftOSC is an Open Sound Control client and server framework written in Swift.
https://github.com/existentialaudio/swiftosc
opensoundcontrol osc swift
Last synced: 4 days ago
JSON representation
SwiftOSC is an Open Sound Control client and server framework written in Swift.
- Host: GitHub
- URL: https://github.com/existentialaudio/swiftosc
- Owner: ExistentialAudio
- License: mit
- Created: 2016-07-15T05:33:32.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-08-29T12:12:11.000Z (about 2 years ago)
- Last Synced: 2024-10-14T01:07:17.105Z (about 1 month ago)
- Topics: opensoundcontrol, osc, swift
- Language: Swift
- Homepage:
- Size: 423 KB
- Stars: 267
- Watchers: 15
- Forks: 51
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# SwiftOSC v1.4
[![Version](https://img.shields.io/cocoapods/v/SwiftOSC.svg?style=flat)](http://cocoapods.org/pods/SwiftOSC)
[![License](https://img.shields.io/cocoapods/l/SwiftOSC.svg?style=flat)](https://github.com/devinroth/SwiftOSC/blob/master/LICENSE)
[![Platform](https://img.shields.io/cocoapods/p/SwiftOSC.svg?style=flat)](http://cocoapods.org/pods/SwiftOSC)SwiftOSC is a Swift Open Sound Control (OSC) 1.1 client and server framework.
*If you are using SwiftOSC in a project, let me know. I would love to make a list of projects using SwiftOSC.*
## Table of Contents
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Projects Using SwiftOSC](#projects-using-swiftosc)## Installation
```
pod 'SwiftOSC', '~> 1.4'
```OR
### Step 1
Clone or download repository from Github.
### Step 2
Open SwiftOSC.xcworkspace and build SwiftOSC frameworks.
### Step 3
Embed SwiftOSC into project.
## Quick Start
### OSC Server
#### Step 1
Import SwiftOSC framework into your project
```swift
import SwiftOSC
```
#### Step 2
Create Server
```swift
var server = OSCServer(address: "", port: 8080)
```
#### Step 3
Start server
```
server.start()
```#### Step 4
Setup server delegate to handle incoming OSC Data
```swift
class OSCHandler: OSCServerDelegate {
func didReceive(_ message: OSCMessage){
if let integer = message.arguments[0] as? Int {
print("Received int \(integer)")
} else {
print(message)
}
}
}
server.delegate = OSCHandler()
```
### OSC Client
#### Step 1
Import SwiftOSC framework into your project
```swift
import SwiftOSC
```
#### Step 2
Create client
```swift
var client = OSCClient(address: "localhost", port: 8080)
```
#### Step 3
Create a message
```swift
var message = OSCMessage(
OSCAddressPattern("/"),
100,
5.0,
"Hello World",
Blob(),
true,
false,
nil,
impulse,
Timetag(1)
)
```
Create a bundle
```swift
var bundle = OSCBundle(Timetag(secondsSinceNow: 5.0), message)
```#### Step 4
Send message
```swift
client.send(message)
```
Send bundle
```swift
// If the server fully supports timetags, like SwiftOSC, the bundle will be delivered at the correct time.
client.send(bundle)
```## Projects Using SwiftOSC
For additional information on Open Sound Control visit http://opensoundcontrol.org/.