Giter VIP home page Giter VIP logo

wsl-audio-musicbox's Introduction

WSL2已经可以播放音频,无需转发。musicbox和musicfox都可以直接使用了。

Windows的WSL音频解决方案

另一个项目musicfox,使用Dart编写的命令行网易云音乐~

使用pulseaudio进行音频转发,本项目主要是为了简化WSL与Windows之间通信转发的配置

可以实现在WSL中使用musicbox播放音乐(给个Star吧~~

依赖

  • 基于WSL2,WSL1未进行测试
  • 基于ubuntu1804,其他需要修改一点代码
  • php-cli, 因为使用到PHP脚本处理文件内容

原理

使用pulseaudio软件将音频数据转发到Windows上,本项目只是将繁杂的配置进行自动化处理,并可以实现开机自启动

使用

  1. Windows下安装pulseaudio软件

  2. 下载或clone本项目,将auto、etc目录移动或覆盖到pulseaudio的根目录下

  3. 启动WSL,安装pulseaudio: sudo apt install pulseaudio,如果没有php环境,执行sudo apt install php-cli进行安装。确保/etc/wsl.conf中有配置项generateResolvConf = true(如果没有,需要添加上,并重启电脑

  4. Windows回到pulseaudio根目录,手动运行auto目录下的start.bat,出现成功表明一切顺利。(如果你在WSL中使用的不是zsh,则需要打开auto/start.bat文件,将ubuntu1804.exe run "./start.php echo ~/.zshrc && source ~/.zshrc"中的~/.zshrc修改为你正在使用的环境变量文件,例如~/.bashrc

  5. 关闭WSL并重新打开,运行paplay -p /mnt/c/Windows/Media/Alarm04.wav,如果有美妙的声音播放出来,恭喜你,音频转发成功了!!

  6. 如果你不想每次开机都手动执行一次start.bat,可以打开auto/start.vbs文件,将其中的.\start.bat替换为你电脑start.bat文件的绝对路径,并将start.vbs移动到Windows的自启动目录下(win+R运行shell:startup即可打开该目录)。重启试试看吧~

使用musicbox

只需要根据musicbox项目的Linux系统安装指引进行安装即可~~

musicbox

wsl-audio-musicbox's People

Contributors

anhoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sunwgit

wsl-audio-musicbox's Issues

win10下pulseaudio 是个麻烦,经常启动失败

windows10: 20HS
wsl: ubuntu1804

脚本确实执行了,但是pulseaudio并没有启动。

最后尝试把脚本和pulseaudiio.exe加入任务,在系统启动时执行,但是pulseaudio还是没有启动成功。

最后尝试手动点击启动pulseaudio,也是偶尔成功,并不能保证一直好用。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.