Skip to content

Commit

Permalink
Merge pull request #9 from oguzhan-yilmaz/dev
Browse files Browse the repository at this point in the history
add dockerfile and cli
  • Loading branch information
oguzhan-yilmaz authored Dec 8, 2024
2 parents 2bb51f4 + 8640127 commit 5c2b652
Show file tree
Hide file tree
Showing 20 changed files with 2,018 additions and 115 deletions.
42 changes: 42 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# pyCrossfade runs on python3.7
# and only debian buster supports it
FROM debian:buster

ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /app

# install essentia dependencies: https://essentia.upf.edu/installing.html
RUN apt-get update -y \
&& apt-get install -y build-essential libeigen3-dev libyaml-dev libfftw3-dev libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libsamplerate0-dev libtag1-dev libchromaprint-dev \
&& apt-get autoremove -y

RUN apt-get install -y python3.7-dev
RUN apt-get install -y python3-pip

# install pyCrossfade dependencies
RUN apt-get install -y libsndfile1 rubberband-cli ffmpeg \
&& apt-get install -y libffi6 libffi-dev \
&& apt-get autoremove -y


# i know this is ugly but its the only configuration that works
RUN pip3 install Cython==0.29.36 setuptools==50.1.0
RUN pip3 install numpy==1.19.0
RUN pip3 install pyrubberband
RUN pip3 install essentia
RUN pip3 install yodel
RUN pip3 install typer
RUN pip3 install mido
RUN pip3 install scipy==1.6.3
RUN pip3 install madmom --no-dependencies


# Copy the current directory contents into the container at /app
# COPY pycrossfade/ pycrossfade/

# Run pycrossfade/cli.py when the container launches
# ENTRYPOINT ["python", "pycrossfade/cli.py"]


CMD ["sleep", "infinity"]
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
50 changes: 50 additions & 0 deletions .github/workloads/docker-build-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Build and publish a pyCrossfade Docker image to ghcr.io
on:
# publish on releases, e.g. v2.1.13 (image tagged as "2.1.13" - "v" prefix is removed)
release:
types: [ published ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: pycrossfade

jobs:
build-and-push-balcony-docker-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
*.pyc
pycrossfade_annotations/
.vscode/
Dockerfile
docker-compose.yml
main.py
multiple_song_mix.wav
output_multiple.wav
*.mp3
*.wav
audios/
music-extractor--*.json
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# pyCrossfade runs on python3.7
# and only debian buster supports it
FROM debian:buster

ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /app

# install essentia dependencies: https://essentia.upf.edu/installing.html
RUN apt-get update -y \
&& apt-get install -y build-essential libeigen3-dev libyaml-dev libfftw3-dev libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libsamplerate0-dev libtag1-dev libchromaprint-dev \
&& apt-get autoremove -y

RUN apt-get install -y python3.7-dev
RUN apt-get install -y python3-pip

# install pyCrossfade dependencies
RUN apt-get install -y libsndfile1 rubberband-cli ffmpeg \
&& apt-get install -y libffi6 libffi-dev \
&& apt-get autoremove -y


# i know this is ugly but its the only configuration that works
RUN pip3 install Cython==0.29.36 setuptools==50.1.0
RUN pip3 install numpy==1.19.0
RUN pip3 install pyrubberband==0.4.0
RUN pip3 install essentia==2.1b6.dev374
RUN pip3 install yodel==0.3.0
RUN pip3 install typer==0.14.0
RUN pip3 install mido==1.3.3
RUN pip3 install scipy==1.6.3
RUN pip3 install madmom==0.16.1 --no-dependencies


# Copy the current directory contents into the container at /app
COPY pycrossfade/ pycrossfade/

# Run pycrossfade/cli.py when the container launches
ENTRYPOINT ["python3", "pycrossfade/cli.py"]


# CMD ["sleep", "infinity"]
34 changes: 11 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,24 @@ pyCrossfade is born out of a personal effort to create a customizable and beat-m

This project requires *libsndfile*, *rubberband-cli*, *ffmpeg* to be installed on the system to work.

### Linux

```bash
apt-get update && apt-get install -y libsndfile1 rubberband-cli ffmpeg
```

### OSX


##### libsndfile
```bash
brew install libsndfile
```
##### ffmpeg
```bash
brew install ffmpeg
brew install libsndfile ffmpeg rubberband
```

##### rubberband
```bash
brew install rubberband
```
-----

### Python Dependencies

#### Python Version

`madmom` package supports up to python 3.8, it's recommended to is this version.


#### Installation

To install the projects dependencies run:
Expand All @@ -60,11 +52,11 @@ Installing `madmom` package alone, if `Cython` package is not installed before h

----
## Example Usage

#### Transitioning Between Two Songs

```python
from pycrossfade.song import Song
from pycrossfade.transition import crossfade
from pycrossfade.utils import save_audio
from pycrossfade import Song, crossfade, save_audio
# creating master and slave songs
master_song = Song('/path/to/master_song.mp3')
slave_song = Song('/path/to/slave_song.mp3')
Expand All @@ -77,9 +69,7 @@ save_audio(output_audio, '/path/to/save/mix.wav')
#### Transitioning Between Multiple Songs

```python
from pycrossfade.song import Song
from pycrossfade.transition import crossfade_multiple
from pycrossfade.utils import save_audio
from pycrossfade import Song, crossfade_multiple, save_audio
# creating songs
song_list = [
Song('/path/to/song_one.mp3'),
Expand All @@ -95,9 +85,7 @@ save_audio(output_audio, '/path/to/save/mix_multiple.wav')
#### Transitioning Between Songs On Specific Bars

```python
from pycrossfade.song import Song
from pycrossfade.transition import crossfade_multiple, crop_audio_and_dbeats
from pycrossfade.utils import save_audio
from pycrossfade import Song, crossfade_multiple, crop_audio_and_dbeats, import save_audio
# creating songs
song_one = Song('/path/to/song_one.mp3')
song_two = Song('/path/to/song_two.mp3')
Expand Down
14 changes: 14 additions & 0 deletions docker.README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# pyCrossfade on Docker

```bash
git config --global user.name "Oguzhan Yilmaz"
git config --global user.email "[email protected]"
```


```bash



```

Loading

0 comments on commit 5c2b652

Please sign in to comment.