frgnca / AudioDeviceCmdlets

AudioDeviceCmdlets is a suite of PowerShell Cmdlets to control audio devices on Windows
MIT License
781 stars 93 forks source link

Write-AudioDevice should be able to adjust -[Timespan]SampleInterval and return floats #66

Open StartAutomating opened 2 years ago

StartAutomating commented 2 years ago

Cool set of cmdlets! I've been looking for something like this for quite some time.

Write-AudioDevice hard codes a sleep of 100 milliseconds between samples. This is good enough for many purposes, but not great for analyzing the currently playing audio, thus

  1. [ ] Write-AudioDevice should have a [Timespan]SampleInterval parameter, defaulting to 100 milliseconds.

Additionally, it looks like Write-AudioDevice is converting the float value into a 0-100 range. Again, this is fine for a lot of cases, but it looses a lot of precision. Thus:

  1. [ ] Write-AudioDevice -PlaybackStream should be able to return floats

It might be nice to be able to get the entire sample buffer as well.

I'm happy to take this particular work item on, as both parts of it should be fairly straightforward.

cdhunt commented 2 years ago

Hey James, Write-AudioDevice was something I threw together for a hackathon years ago and since then I've handed the project over to @frgnca. Out of curiosity, what are you looking to do that requires the additional precision?

StartAutomating commented 2 years ago

@cdhunt @frgnca there are two major musical scenarios I'd like to put together with Write-AudioDevice:

  1. Integration with LightScript.

I've been building out a lot of smart lighting controlling code over the years. By being able to analyze playing audio in close to realtime, I should be able to make a music mode for lights that would work across multiple devices.

  1. Gameification.

Long story made short, with some details withheld, I'm looking at creating a new batch of games in PowerShell, and I want some of them to use synchronization with music to affect score (a la Rock Band / Guitar Hero / a million and one games since).

By the way, I haven't had any luck getting this code to build just yet. Does anyone have a .csproj for the repo?

cdhunt commented 1 year ago

Here's the sln and csproj from back in the day before @frgnca reorganized the project.