Skip to content

Releases: codynhanpham/python_audio_server

python_audio_server v1.1.0

Choose a tag to compare

@codynhanpham codynhanpham released this 30 Apr 17:28

Features

  • TTL modes
    • Sender (Default): Send a trigger on audio start, and optionally, another trigger on stop
    • Receiver: Listen and wait until a TTL pulse is received before playing audio

Improvements

  • The folder structure at run time is now consistent across Windows and Linux. Simply add the /audio and /playlists folders next to the executable file on both platforms.
  • Improve build stability (both UX and DX) for old Linux

python_audio_server v1.0.0

Choose a tag to compare

@codynhanpham codynhanpham released this 10 May 22:50

Version 1.0.0 Reaches!

Pretty much completed, and most likely, no more big updates will be made to this code base in the future. It worked!

Backend

TTL Triggers

On the backend, the biggest update is that we can now send out a TTL pulse when the audio starts or stops playing. This is extremely useful when you want to trigger some other system when the audio plays. The settings for the TTL pulse (target COM device, number of pulses to send, the length of the pulse, etc.) can be customized via the .env file at the project's top level. If you cannot see the .env file, try doing Ctrl + H on both Windows and Linux to show hidden files. If there is nothing, create one yourself!

To figure out the available COM port for sending the TTL pulse, a convenient command ls is available:

./audio_server/audio_server ls # Linux release

./audio_server.exe ls # Windows release

python main.py ls # Python3

The Other Things

The server can do tons of things now that I figure we can stop adding more stuff. Playing audio files, playing playlists, both sequentially or gaplessly, saving playlists as gapless audio files, generating tones and sweeps from parameters and playing them on the fly, playing random audio files, etc etc you get the point!

If there is ever a need to add new features, they will be added as minor version releases. Version 2.0 will only be released if there is any breaking change, which seems unlikely.

Frontend

Did I mention that we have a web GUI now? The root route / is now dedicated to the GUI, and the old documentation is moved to /docs. All the basic things you might be doing regularly can be accessed directly through the GUI. Everything is handwritten in plain old HTML, CSS, and JS. The GUI is tested for variable screen size and mobile compatibility and made sure to work and display properly on Chrome version 59.0+. Machines frozen in time from 2017 should be able to use this right.

Installation

To get the app installed, simply download the packaged ZIP file for your system. The code is bundled with PyInstaller and can be run directly without the need to install Python.

If you want to run the app directly with Python, simply do a git clone, then make a quick virtual environment with python -m venv venv, activate said environment, then pip install -r requirements.txt. Note that the requirement files are slightly different between Windows and Linux.

Lastly, check the .env file for any settings you might want to change, and start the app!

./audio_server/audio_server # using the packaged Linux executable

./audio_server.exe # or double-click this .exe file when using the Windows executable

python main.py # run with Python

Troubleshooting

  1. Note that the working directory (where the audio files and playlists should be added) is different for the Windows and Linux releases.
  2. If there is a permission issue on Linux, run chmod a+x -R ./audio_server to give yourself the permission.

Pre-built Docker Images

Choose a tag to compare

@codynhanpham codynhanpham released this 01 Feb 22:00

Docker images for Ubuntu 14.04 (Trusty) bundled with different versions of Python:

  • Python 3.6.3
  • Python 3.7.5
  • Python 3.9.18 (with python3-dev installed as well)

These images can be loaded into Docker with docker load -i [file]

python_audio_server v0.4.0

Choose a tag to compare

@codynhanpham codynhanpham released this 25 Jan 22:50

What's New?

MATLAB App Graphical User Interface (GUI)

While it's alright to just use the API in the browser search bar or from the command line, it's tedious and hurts the brain when things get increasingly complex. Well, no longer!

ALL of the supported routes are integrated into the GUI, with lots of quality-of-life features and customizations. This first GUI release supports all of the routes available from the last version of the API server, and more features are still coming to both the server and GUI in the future.

Installation

Download the .mlappinstall file and open it inside of MATLAB. You will be prompted to install the app to MATLAB's APPS toolbar. Install once and forget about it. Until the next time you need to use the app, it's right inside MATLAB and you can start the GUI with a single click.

Minor Updates and Improvements to the API Server

While this update is mainly about the GUI, some changes and improvements have been made to the server itself.

  • Added ?json=true to the /list route so you can GET the list in JSON instead of plain text.
  • Added the /restart and /shutdown routes to the server. Restart can be used to interrupt playing audio or force reload server from the client side, and shutdown can be used to... well, shut down the audio server. Since the server cannot be started from the client side, some basic "challenge" is used to make sure the client really really really really really wants to shut the server down.
  • /playlist/create with the ?no_download=true flag now also returns the new playlist file name in the JSON response.
  • /save_tone will now always use the original (requested) duration in the filename, regardless of the edge length.

Also, another change to the Windows release: ffmpeg and ffprobe are now bundled with the executable. All you need to do now is just download the .exe file and take it with you anywhere and everywhere. All at once?

python_audio_server v0.3.0

Choose a tag to compare

@codynhanpham codynhanpham released this 08 Jan 17:52

What's New?

Add the ability to include a fade-in and fade-out (edges) to the generated tone or sweep

  • Parameter: ?edge=<value>, with the value is the ramp duration in ms. The default is edge=0, no fade-in or fade-out.
  • The ramp is linear, and will always go from 0 dB to the specified amplitude value.
  • edge can either be positive or negative.
  • A positive edge value will add the edge duration to the tone (addition), which will result in a tone with the total duration of duration + (2 * edge) (in and out).
  • A negative edge value will maintain the specified duration (inclusive). The maximum negative edge value is limited to duration / 2, in which case, the amplitude will rise to the specified amplitude, and then immediately fall back down.

Sweep's edges

  • The edge value, if specified, in /sweep or /save_sweep must be negative (inclusive), as the duration of the sweep is also limited by the frequency start and end range.

python_audio_server v0.2.1

Choose a tag to compare

@codynhanpham codynhanpham released this 04 Jan 23:09

What's New?

  • Add /sweep and /save_sweep endpoints

Installations

Linux

Download the zip file for Linux and extract. The binary py_audio_server can be run directly.

Windows

Download the zip file for Windows. You will also need to install ffmpeg and add it to path. Then, the py_audio_server.exe file can be used.

From the future...

Commit c759733 fixes the scipy dependency not installed correctly on Linux with pyinstaller.

python_audio_server v0.2.0

Choose a tag to compare

@codynhanpham codynhanpham released this 28 Dec 21:56

Big Update

What's New?

  • Lots of new routes for all kinds of requests. Playlists are supported now!

  • Documentation on the / home page! Some important routes are /list, /play, /tone, /playlist, ...

  • Now work on Linux! Tested to work on Ubuntu 14.04 and up!!!

  • Bundled ffmpeg and ffprobe for Linux release. Literally just download and run ~

  • Build script for Linux included. Dockerfile to create a Trusty (Ubuntu 14.04) image with Python 3.6 installed is also available by this release commit (click to browse files)

How-to?

For Linux

Simply download the binary .zip, extract, and run with ./py_audio_server in the terminal! If you want to add playlists, create a playlists/ folder next to the executable.

If you have trouble with permission and such when trying to run the executable, try to run chmod a+x ./py_audio_server and that should fix it!

For Windows

Download the .zip file and extract it. You will also need to install ffmpeg on your machine though! The legit way is to go to https://ffmpeg.org/download.html#build-windows and download one of the releases, then put the path to that folder into your System Environment Variables (or PATH). You can also just download ffmpeg (just the exe) and put that file next to the py_audio_server.exe executable.

If you want to add playlists, create a playlists/ folder next to the executable.

python_audio_server v0.1.0

Choose a tag to compare

@codynhanpham codynhanpham released this 07 Dec 21:20

Initial Release

The first release with 3 basic endpoints:

  • ping
  • play/<audio_file_name>
  • startnewlog

Event logging is enabled by default.
See the source code README.md file for more information.


Hotfix

Commit 2d624f7:

  1. Added a default .env file.
  2. generate_bat_files.exe now only creates bat files for audio files.
  3. Included a set of default audio files. These are pure sine tones at the indicated frequency, with the duration of 100ms