Skip to content

Commit

Permalink
Bugfixes, updates to remove warnings, & unit test improvements (#39)
Browse files Browse the repository at this point in the history
* Update .gitignore (including spelling mistake for Manifest.toml)

* Add Revise to deps & stdlib packages to compat

* Bugfix for ccall() with FFTW.libfftw3 & FFTW.libfftw3f, tests pass now

* Clean up audio test file

* Switch to TestItemRunner for easy unit testing in VS Code

* Update for loops to remove warnings

* Update to use correct istft() call

* Add SampledSignals as dep & remove repeated code...

- AbstractSampleBuf, SampleBuf, etc. seem to have been copy/pasted from SampledSignals
- changed local variables from nframes to nframe and from nchannels to nchannel to avoid issues with exported function names

* Rename nframes() to nframes_hops() to avoid type piracy

* Add PortAudio dep & make play() robust

* Workaround attempt for alsa_plugins_jll

* Revert to using @eval import PortAudio...

does not seem like the alsa_plugins_jll issue will be solved anytime soon

* Minor update

* Update CI actions

* Update compat

* Revert "Minor update"

This reverts commit 3ea4888.

* Only half the readme examples run still

* Bugfixes so all readme examples run

* Bump major version

---------

Co-authored-by: George Datseris <[email protected]>
  • Loading branch information
gnadt and Datseris authored Apr 29, 2024
1 parent 1825e7d commit 0403faa
Show file tree
Hide file tree
Showing 14 changed files with 191 additions and 511 deletions.
24 changes: 9 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
test:
name: Tests, Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
strategy:
fail-fast: false
matrix:
Expand All @@ -23,25 +26,16 @@ jobs:
# Cancel ongoing CI test runs if pushing to branch again before the previous tests
# have finished
- name: Cancel ongoing test runs for previous commits
uses: styfle/cancel-workflow-action@0.6.0
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

# Do tests
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v2
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
*.jl.cov
*.jl.*.cov
*.jl.mem
Mainfest.toml
.DS_Store
LocalPreferences.toml
Manifest.toml
settings.json

# Build artifacts for creating documentation generated by the Documenter package
docs/build/
Expand Down
28 changes: 20 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MusicProcessing"
uuid = "32bb9398-a9ad-408c-b137-8304ef5cbed9"
repo = "https://github.com/JuliaMusic/MusicProcessing.jl.git"
version = "1.8.1"
version = "2.0.0"

[deps]
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
Expand All @@ -10,22 +10,34 @@ FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
FixedPointNumbers = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
PortAudio = "80ea8bcb-4634-5cb3-8ee8-a132660d1d2d"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
SampledSignals = "bd7594eb-a658-542f-9e75-4c4d8908c167"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[compat]
DSP = "0.6.10, 0.7"
Documenter = "0.27"
FFTW = "1.3"
Documenter = "0.27, 1"
FFTW = "1"
FixedPointNumbers = "0.8"
IntervalSets = "0.5"
Requires = "1.1"
Unitful = "1.7"
julia = "1"
IntervalSets = "0.5, 0.6, 0.7"
LinearAlgebra = "1"
PortAudio = "1"
Requires = "1"
Revise = "3"
SampledSignals = "2"
Statistics = "1"
Test = "1"
TestItemRunner = "0.2"
Unitful = "1"
julia = "1.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"

[targets]
test = ["Test"]
test = ["Test", "TestItemRunner"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ The following commands will display a graphic visualization and/or an HTML5 `<au
### Loading an audio file

```julia
julia> using MusicProcessing, MP3
julia> using MusicProcessing, FileIO, MP3
julia> audio = load("Sour_Tennessee_Red_Sting.mp3")
```

### Converting to a mono audio

```julia
julia> audio = mono(a)
julia> audio = mono(audio)
```

### Resampling in 22050 Hz
Expand Down
28 changes: 12 additions & 16 deletions src/MusicProcessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,32 @@ module MusicProcessing
using DSP
using FFTW
using FixedPointNumbers
using Requires
using Unitful
using IntervalSets
using Requires
using SampledSignals
using Statistics
using Unitful
using Unitful: ns, ms, µs, s, Hz, kHz, MHz, GHz, THz
using LinearAlgebra:mul!
using LinearAlgebra: mul!, norm
import SampledSignals: mono, nchannels, nframes

# types used for fixed-point 16-bit and 32-bit encoding
const PCM16Sample = Fixed{Int16, 15}
const PCM32Sample = Fixed{Int32, 31}

const Seconds = Unitful.Quantity{Int64, Unitful.𝐓,Unitful.FreeUnits{(s,),Unitful.𝐓,nothing}}
const Hertz = Unitful.Quantity{Int64,Unitful.𝐓^-1,Unitful.FreeUnits{(Hz,),Unitful.𝐓^-1,nothing}}
export Hz, kHz, s, ..
export PCM16Sample, PCM32Sample

include("util.jl")
include("SampleBuf.jl")

include("complex.jl")

include("audio.jl")
include("TFR.jl")

include("mel.jl")
include("constantq.jl")
include("chroma.jl")
include("complex.jl")
include("constantq.jl")
include("mel.jl")
include("TFR.jl")
include("util.jl")

export AbstractSampleBuf, SampleBuf, SpectrumBuf
export mono, resample, duration, play, pitchshift, speedup, slowdown, zero_crossing_rate, nframes, nchannels
export AbstractSampleBuf, SampleBuf, SpectrumBuf, mono, nchannels, nframes
export resample, duration, play, pitchshift, speedup, slowdown, zero_crossing_rate
export melspectrogram, mfcc
export spectrogram, stft, istft, phase_vocoder

Expand Down
Loading

0 comments on commit 0403faa

Please sign in to comment.