04-09-2020 11:47 AM
Hi everyone. Just a quick question.
Is there a way to reproduce an audio file (let's say an mp3 or equivalent) directly from script, without opening it in View?
Thanks a lot!
04-17-2020 05:21 PM
Hi Marco,
By "reproduce" do you mean play the sound through the computer speakers, or do you mean create a new audio file on the hard drive, or do you mean create a graph of the sound as a picture file?
Brad Turpin
Senior Technical Support Engineer
National Instruments
04-19-2020 11:46 AM
Hi Brad.
I mean playing it onto the speakers.
Marco
04-20-2020 06:11 PM
Hi Marco,
You can interactively select a waveform in the Data Portal, and as long as it has "s" for the X axis unit, it will play over the speakers, but I don't know of a way to make that happen from a script. I think your only option is to secretly create a VIEW tab and control the waveform there, ideally without showing VIEW, then delete the VIEW tab afterwards.
Brad Turpin
Senior Technical Support Engineer
National Instruments
04-21-2020 02:03 AM
Hi again Brad,
That's the solution i came up with too. Thanks a lot!
Regards and have a nice day!
Marco
04-21-2020 02:55 AM
Hi Marco,
You can also try this here:
Load the example dataset and run this script commands
Portal.Structure.Activate
Portal.Structure.Selection.RemoveAll
Portal.Structure.Selection.Add(Data.Root.ChannelGroups(2).Channels(2))
Portal.ChannelPreview.Expand(true)
Portal.ChannelPreview.SoundState(TRUE)
Greetings
Walter
04-21-2020 04:17 PM
Hi Walter,
Thank you for finding this code! That's what I was looking for, and I guess I must have given up too easily. I see it now in the object tree.
This should be way better than manipulating VIEW.
Brad Turpin
Senior Technical Support Engineer
National Instruments