Old 03-30-2020, 04:00 PM   #1
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Location: Kiel
Posts: 974
Default *.wav replaced by *.musicxml

Hi scripter
Is it possible to write a script that replaces the wav files in the project with * .musicxml files of the same name? I want to use it to create a score that is to be played by our little orchestra.
Thanks a lot
Dragonetti

Last edited by Dragonetti; 04-02-2020 at 01:16 AM.
Dragonetti is offline   Reply With Quote
Old 03-30-2020, 09:26 PM   #2
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Try this. Not sure whether it could help.

1. Place the MusicXML file to the same path of the wav file
2. Select the item that you wanna replace
3. Make sure you have installed SWS

Code:
reaper.Undo_BeginBlock()
local it=reaper.GetSelectedMediaItem(0, 0)
local tk=reaper.GetActiveTake(it)
local _, chunk=reaper.GetItemStateChunk(it, '', 1)
local path=chunk:match('FILE \"([^\"]+)\"')
local fn_noext=path:match(".+[/\\](.+)%.%w+$")
local fn_new=fn_noext..'.musicxml'
reaper.BR_SetTakeSourceFromFile(tk, fn_new, true)
reaper.Main_OnCommand(40441, 0)
reaper.UpdateArrange()
reaper.Undo_EndBlock('MusicXML', -1)

Last edited by dsyrock; 03-31-2020 at 03:36 AM.
dsyrock is offline   Reply With Quote
Old 03-31-2020, 02:15 AM   #3
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Location: Kiel
Posts: 974
Default

Thanks but didn`t match

at first the error message was something with "::".
Then I took away a ":".
Now the error message
error
wav2musicxml.lua:8: attempt to call a nil value (field 'BR_SetTakeSourceFromFile')

best wishes
dragonetti
Dragonetti is offline   Reply With Quote
Old 03-31-2020, 03:36 AM   #4
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by Dragonetti View Post
Thanks but didn`t match

at first the error message was something with "::".
Then I took away a ":".
Now the error message
error
wav2musicxml.lua:8: attempt to call a nil value (field 'BR_SetTakeSourceFromFile')

best wishes
dragonetti
Yep, it should be
Code:
local fn_noext=path:match(".+[/\\](.+)%.%w+$")
And base on your error message, I think you need to install SWS first.
dsyrock is offline   Reply With Quote
Old 03-31-2020, 03:54 AM   #5
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Location: Kiel
Posts: 974
Default

sws is installed.
There is no error message but it still does not work.
A "building peaks" window appears very briefly, but the musixml file is not loaded.
When I manually load a musicxml file, the message "Midi File import" always comes up and it asks me to import midi tempo map.
Can you check that again?
Thanks
Dragonetti is offline   Reply With Quote
Old 03-31-2020, 03:57 AM   #6
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by Dragonetti View Post
sws is installed.
There is no error message but it still does not work.
A "building peaks" window appears very briefly, but the musixml file is not loaded.
When I manually load a musicxml file, the message "Midi File import" always comes up and it asks me to import midi tempo map.
Can you check that again?
Thanks
Can you upload the xml file?
dsyrock is offline   Reply With Quote
Old 03-31-2020, 05:21 AM   #7
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Location: Kiel
Posts: 974
Default

https://stash.reaper.fm/38713/bas007.musicxml
Dragonetti is offline   Reply With Quote
Old 03-31-2020, 06:43 AM   #8
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Location: Kiel
Posts: 974
Default

Hi dsyrock
It is better to generate a new miditrack first. Don't throw the audio file away. That will happen later.
The two files (bas007.wav and bas007.musicxml) still have to be matched to their temporary length.
For example: bas007.wav has been shortened by a quarter, then this should also be done with the bas007.musicxml.
Dragonetti is offline   Reply With Quote
Old 04-02-2020, 01:15 AM   #9
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Location: Kiel
Posts: 974
Default

bump bump
Dragonetti is offline   Reply With Quote
Old 04-16-2020, 03:01 AM   #10
Dragonetti
Human being with feelings
 
Join Date: Feb 2017
Location: Kiel
Posts: 974
Default

https://forum.cockos.com/showthread.php?t=235283

Last edited by Dragonetti; 04-30-2020 at 03:24 AM.
Dragonetti 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:18 AM.


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