Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfedosov committed Oct 13, 2024
1 parent d8fdac0 commit 40b4846
Show file tree
Hide file tree
Showing 22 changed files with 960 additions and 0 deletions.
151 changes: 151 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Created by https://www.toptal.com/developers/gitignore/api/goland,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=goland,macos

### GoLand ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
.idea

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### GoLand Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/

# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$

# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

# End of https://www.toptal.com/developers/gitignore/api/goland,macos
60 changes: 60 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Move tool

## Overview

A simple CLI for slicing long samples into Ableton Note / Ableton Move presets

## Table of Contents

- [Overview](#overview)
- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)

## Installation

1. Ensure that you have [Go 1.22](https://golang.org/dl/) installed.
2. Clone the repo:

```sh
git clone https://github.com/alexfedosov/move-tool.git
```

3. Navigate to the project directory:

```sh
cd move-tool
```

4. Install dependencies:

```sh
go mod tidy
```

## Usage

```sh
go run . slice -i <file path> -n <number of samples> -o <output directory>
```

### Example
Lets say you have prepared a long wav sample with up to 16 sounds of equal length.
To slice it up into .ablpresetbundle you need to run the tool as

```sh
go run . slice -i my-sample.wav -n 16 -o /Users/alex/Desktop
```

## Contributing

1. Fork the repository.
2. Create a new branch (`git checkout -b feature/YourFeature`).
3. Commit your changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature/YourFeature`).
5. Open a Pull Request.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
6 changes: 6 additions & 0 deletions ablmodels/audio.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package ablmodels

type AudioFile struct {
FilePath *string
Duration float64
}
22 changes: 22 additions & 0 deletions ablmodels/chain.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ablmodels

type Chain struct {
Name string `json:"name"`
Color int `json:"color"`
Devices []interface{} `json:"devices"`
Mixer Mixer `json:"mixer"`
}

func NewChain() *Chain {
return &Chain{
Name: "",
Color: 2,
Devices: make([]interface{}, 0),
Mixer: *NewMixer(),
}
}

func (c *Chain) WithDevice(device interface{}) *Chain {
c.Devices = append(c.Devices, device)
return c
}
36 changes: 36 additions & 0 deletions ablmodels/device.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package ablmodels

type Device struct {
PresetURI interface{} `json:"presetUri"`
Kind string `json:"kind"`
Name string `json:"name"`
Parameters interface{} `json:"parameters"`
Chains []interface{} `json:"chains,omitempty"`
ReturnChains []interface{} `json:"returnChains,omitempty"`
}

func NewDevice(kind string) *Device {
return &Device{
PresetURI: nil,
Kind: kind,
Name: "",
Parameters: nil,
Chains: make([]interface{}, 0),
ReturnChains: make([]interface{}, 0),
}
}

func (d *Device) AddChain(chain interface{}) *Device {
d.Chains = append(d.Chains, chain)
return d
}

func (d *Device) AddReturnChain(chain interface{}) *Device {
d.ReturnChains = append(d.ReturnChains, chain)
return d
}

func (d *Device) WithParameters(parameters interface{}) *Device {
d.Parameters = parameters
return d
}
26 changes: 26 additions & 0 deletions ablmodels/device_preset.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package ablmodels

type DevicePreset struct {
Schema string `json:"$schema"`
Device
}

const DevicePresetSchema = "http://tech.ableton.com/schema/song/1.4.4/devicePreset.json"

func NewDrumRackDevicePresetWithSamples(samples []AudioFile) *DevicePreset {
drumRack := NewDrumRack()
for i := 0; i < 16; i++ {
if i < len(samples) {
drumRack.AddSample(samples[i])
} else {
drumRack.AddSample(AudioFile{
FilePath: nil,
Duration: 0,
})
}
}
return &DevicePreset{
DevicePresetSchema,
*NewInstrumentRack().AddChain(NewChain().WithDevice(drumRack).WithDevice(NewSaturator())),
}
}
24 changes: 24 additions & 0 deletions ablmodels/drum_cell_chain.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package ablmodels

type DrumCellChain struct {
Chain
DrumZoneSettings *DrumZoneSettings `json:"drumZoneSettings"`
}

type DrumZoneSettings struct {
ReceivingNote int `json:"receivingNote"`
SendingNote int `json:"sendingNote"`
ChokeGroup interface{} `json:"chokeGroup"`
}

func NewDrumCellChain(padIndex int, sample AudioFile) *DrumCellChain {
chain := NewChain().WithDevice(NewDrumSampler().WithSample(sample))
chain.Mixer = *NewMixer().WithDefaultSend()
return &DrumCellChain{
*chain,
&DrumZoneSettings{
SendingNote: 60,
ReceivingNote: 36 + padIndex,
},
}
}
25 changes: 25 additions & 0 deletions ablmodels/drum_sampler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package ablmodels

const DrumSamplerDeviceKind = "drumCell"

type DrumSampler struct {
Device
DeviceData DeviceData `json:"deviceData"`
}

type DeviceData struct {
SampleURI *string `json:"sampleUri"`
}

func NewDrumSampler() *DrumSampler {
return &DrumSampler{
*NewDevice(DrumSamplerDeviceKind),
DeviceData{nil},
}
}

func (s *DrumSampler) WithSample(file AudioFile) *DrumSampler {
s.DeviceData.SampleURI = file.FilePath
s.Parameters = DefaultDrumSamplerParameters().WithVoiceEnvelopeHold(file.Duration).WithGateMode()
return s
}
Loading

0 comments on commit 40b4846

Please sign in to comment.