Old 04-04-2019, 09:41 AM   #1
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 41
Default Optimal way to play sound from Lua Script?

Hi, guys!

What is the optimal way to play sound from Lua Script? Just for auditioning samples, like in browser. I know that Reaper's Lua is not for realtime work with sound, but... I think there are at least several methods.

For example - you can Load Sample to RS5k(using Lua), make track record and MIDI enabled and and send some notes to track with RS5k. But... It seems too complicated (((

Can you help me to find more suitable way?

Last edited by kartalex; 04-04-2019 at 02:46 PM.
kartalex is offline   Reply With Quote
Old 04-04-2019, 01:07 PM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

I don't recall there is any straight-forward way to do it from plain ReaScript.

You could suggest to Julian Sader, the developer of the js_ReaScriptAPI extension plugin, to add something for that. I might also myself look if there's some sensible way to add something into that plugin to allow that. Reaper does have a mechanism available for C++ extension plugins to play a PCM_source object (read, "audio file") into the main audio hardware output.

edit : I already got the playback working. But as usual, stopping (properly) is more complicated than anticipated...
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 04-04-2019 at 01:49 PM.
Xenakios is offline   Reply With Quote
Old 04-04-2019, 03:51 PM   #3
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 41
Default

Quote:
Originally Posted by Xenakios View Post
I don't recall there is any straight-forward way to do it from plain ReaScript.

You could suggest to Julian Sader, the developer of the js_ReaScriptAPI extension plugin, to add something for that. I might also myself look if there's some sensible way to add something into that plugin to allow that. Reaper does have a mechanism available for C++ extension plugins to play a PCM_source object (read, "audio file") into the main audio hardware output.

edit : I already got the playback working. But as usual, stopping (properly) is more complicated than anticipated...
Cool, Xenakios!
I've posted the same question in Julian's thread, thank you!
kartalex is offline   Reply With Quote
Old 04-05-2019, 05:21 AM   #4
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 2,136
Default

Quote:
Originally Posted by Xenakios View Post
I don't recall there is any straight-forward way to do it from plain ReaScript.

You could suggest to Julian Sader, the developer of the js_ReaScriptAPI extension plugin, to add something for that. I might also myself look if there's some sensible way to add something into that plugin to allow that. Reaper does have a mechanism available for C++ extension plugins to play a PCM_source object (read, "audio file") into the main audio hardware output.

edit : I already got the playback working. But as usual, stopping (properly) is more complicated than anticipated...
Oh Boy..this would be awesome

We are in desperate need of such a function at Ultraschall
__________________
Use she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1294 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you want
mespotine is offline   Reply With Quote
Old 04-10-2019, 05:24 AM   #5
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

After doing some fixes in the extension code, it looks like cleaning up the playback objects might now be working, but I need to do some additional tests.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 04-10-2019, 02:16 PM   #6
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 41
Default

Quote:
Originally Posted by Xenakios View Post
After doing some fixes in the extension code, it looks like cleaning up the playback objects might now be working, but I need to do some additional tests.
Great news! Can't wait for it
kartalex is offline   Reply With Quote
Old 09-15-2020, 06:53 PM   #7
Nostrap
Human being with feelings
 
Join Date: Dec 2017
Posts: 163
Default

Anyone ever figure out how to play a sound from reascript?
Nostrap is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:34 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.