DAWpy 2026.2.20.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ # Allow manual triggering
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ deploy:
12
+ runs-on: ubuntu-latest
13
+ environment: pypi
14
+
15
+ permissions:
16
+ # This permission is required for OIDC authentication with PyPI
17
+ id-token: write
18
+
19
+ steps:
20
+ - uses: actions/checkout@v3
21
+
22
+ - name: Set up Python
23
+ uses: actions/setup-python@v4
24
+ with:
25
+ python-version: '3.12'
26
+
27
+ - name: Install dependencies
28
+ run: |
29
+ python -m pip install --upgrade pip
30
+ pip install build
31
+
32
+ - name: Build package
33
+ run: python -m build
34
+
35
+ - name: Publish package
36
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,7 @@
1
+ Copyright 2026 MITHRAN MOHANRAJ
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.4
2
+ Name: DAWpy
3
+ Version: 2026.2.20.0
4
+ Summary: A Digital Audio Workstation in your CLI.
5
+ Author-email: Mithran Mohanraj <mithran.mohanraj@gmail.com>
6
+ Maintainer-email: Mithran Mohanraj <mithran.mohanraj@gmail.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Requires-Python: >=3.12
10
+ Requires-Dist: numpy>2.4.2
11
+ Description-Content-Type: text/markdown
12
+
13
+ # DAWpy
14
+
15
+ Surprisingly nobody took the name DAWpy and I took this as a golden opportunity to finally learn to compose music.
16
+
17
+ I tried many of the popular Digital Audio Workstation software and none of them made sense to me, so I decided to write this package to see if I can finally make some music.
@@ -0,0 +1,5 @@
1
+ # DAWpy
2
+
3
+ Surprisingly nobody took the name DAWpy and I took this as a golden opportunity to finally learn to compose music.
4
+
5
+ I tried many of the popular Digital Audio Workstation software and none of them made sense to me, so I decided to write this package to see if I can finally make some music.
@@ -0,0 +1,19 @@
1
+ # examples/basic_beat.py
2
+
3
+ import sys
4
+ import os
5
+ # Hack to import dawpy without installing it yet
6
+ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../src')))
7
+
8
+ from dawpy.timeline import Project, Time
9
+
10
+ # 120 BPM means 1 beat = 0.5 seconds
11
+ song = Project(bpm=120)
12
+
13
+ # Let's test the grid
14
+ positions =
15
+
16
+ for pos in positions:
17
+ sec = song.time_to_seconds(pos)
18
+ samples = song.seconds_to_samples(sec)
19
+ print(f"{pos} -> {sec:.2f} seconds -> sample index {samples}")
@@ -0,0 +1,21 @@
1
+ [build-system]
2
+ requires = ["hatchling >= 1.26"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "DAWpy"
7
+ version = "2026.2.20.0"
8
+ dependencies = [
9
+ "numpy>2.4.2"
10
+ ]
11
+ requires-python = ">=3.12"
12
+ authors = [
13
+ {name = "Mithran Mohanraj", email = "mithran.mohanraj@gmail.com"}
14
+ ]
15
+ maintainers = [
16
+ {name = "Mithran Mohanraj", email = "mithran.mohanraj@gmail.com"}
17
+ ]
18
+ description = "A Digital Audio Workstation in your CLI."
19
+ readme = "README.md"
20
+ license = "MIT"
21
+ license-files = ["LICENSE"]
File without changes
@@ -0,0 +1,41 @@
1
+ # src/dawpy/timeline.py
2
+
3
+ class Time:
4
+ """
5
+ Represents a musical position or duration.
6
+ Assumes standard 4/4 time signature for now (4 beats per bar).
7
+ """
8
+ def __init__(self, bar=1, beat=1.0):
9
+ # DAWs traditionally start counting at Bar 1, Beat 1
10
+ self.bar = bar
11
+ self.beat = beat
12
+
13
+ @property
14
+ def total_beats(self) -> float:
15
+ """Converts the Bar/Beat position into a raw beat count from zero."""
16
+ # Bar 1, Beat 1 = 0.0 total beats
17
+ # Bar 2, Beat 1 = 4.0 total beats
18
+ bars_zero_indexed = self.bar - 1
19
+ beats_zero_indexed = self.beat - 1.0
20
+ return (bars_zero_indexed * 4.0) + beats_zero_indexed
21
+
22
+ def __repr__(self):
23
+ return f"Time(bar={self.bar}, beat={self.beat})"
24
+
25
+
26
+ class Project:
27
+ """
28
+ The root container for a song. Holds the master BPM and tracks.
29
+ """
30
+ def __init__(self, bpm: float = 120.0):
31
+ self.bpm = bpm
32
+ self.tracks =[]
33
+
34
+ def time_to_seconds(self, t: Time) -> float:
35
+ """Converts a Musical Time object into Absolute Time (seconds)."""
36
+ beats_per_second = self.bpm / 60.0
37
+ return t.total_beats / beats_per_second
38
+
39
+ def seconds_to_samples(self, seconds: float, sample_rate: int = 44100) -> int:
40
+ """Converts Absolute Time into Discrete Time (array index)."""
41
+ return int(seconds * sample_rate)