Prezzodaman / pymod

POSTPONED - Python program that plays/renders ProTracker modules using PyAudio (available on PyPI as "pymod-amiga")
https://verycheapwebsite.rf.gd/pymod
GNU General Public License v3.0
11 stars 1 forks source link

Module improvements and unit tests #9

Closed DidierMalenfant closed 4 months ago

DidierMalenfant commented 4 months ago

Main new additions for this is a new cleaner interface for the pymod module when imported into a python project:

import pymod

module = pymod.Module(<path_to_mod_file>)

if module is not None:
    module.play()

or

import pymod

module = pymod.Module(<path_to_mod_file>)

if module is not None:
    module.render_to(<path_to_wav_file_to_render_to>, <optional flag to render channels separatly>)

This also contains unit tests that work with pytest. Reference WAV files were generated using commit 8f8264c6.

They can be regenerated by cd-ing into a cloned repo of the project, launching python in interactive mode and typing:

import sys
import os
sys.path.insert(0, os.getcwd())
import pymod
pymod.Module._generateTestFiles()

The bulk of the code for the player is still untouched but changes/improvements can be made to it now while being able to make sure via unit testing that those don't break anything.

Prezzodaman commented 4 months ago

Incredible work! I managed to get the test waves rendered, and I also got unit testing to work successfully (for future reference: run pytest in the "tests" folder)

I'm glad that Pymod is now in a good state where I can begin working on it as before, and there's already a few things that need to be fixed (problems in my own code!) so I'll spend some time looking into those before finally publishing it to PyPI.

DidierMalenfant commented 4 months ago

mmm... you shouldn't need to run pytest in the tests folder. I probably messed something up.

What error do you get when you run it from the root of the repo?

Prezzodaman commented 4 months ago

Sorry, I was just figuring things out, it runs fine from the root as well! Apologies for any confusion!