Audioplayer

0 views
Skip to first unread message

Lupita Calvi

unread,
Aug 3, 2024, 5:29:16 PM8/3/24
to enoreran

Use an audioplayer object to play audio data. The audioplayer object contains properties that enable additional flexibility during playback. For example, you can pause, resume, or define callbacks using the audioplayer object functions.

Function to execute repeatedly during playback, specified as a character vector containing the name of the function, or a function handle. To specify time intervals for the repetitions, use the TimerPeriod property.

To reduce the likelihood of unwanted applications using your microphone, turn off automatic access to your audio device. You can change these settings at any time. After granting permission to a website once, your browser may be able to access your microphone automatically for that site on future visits. Use the browser settings for Google Chrome to revoke access for specific sites after you have initially allowed access.

You can also access the MATLAB Online website or MATLAB Web App Server using the private browsing mode in Google Chrome. When you do this, Chrome automatically asks you for permission every time it tries to access your microphone, regardless of your browser settings.

When i open one of my usd-files, that have been used before, audioplayer does not exist/is not loaded as everything else.
When I add one, and press play, there is no sync(at least head is not rendering any movements)

somehow i did manage to get audioplayer to load with one of my older usd-files, that did not work earlier.
so for now its all good, but I do look forward to future releases when this does not happen from time to time.

Thank you very much for the help. I think I'm more clueless that you might realize. Some questions:
1. Where can the audio player config page be found? In the Polyglot dashboard, in the UD Administrative console, or somewhere else?

Go to pg3 then click on audioplayer. Then click on Configuration. Scroll down until you come to custom configuration. At that point you will click on add custom parameter then fill in key and value. Save.

Not able to play sound from Bluetooth connection. I'm paired to a Bose Bluetooth speaker. Is there another command that I need in the program? Also, not showing the AudioPlayer custom configurations in drop down, only mp3's for different sounds. If I restart the AudioPlayer, I do hear 2 click on speaker for the stop and start of the plugin.

I attempted to use an Amazon Echo Show. After a dozen failed attempts to get it to pair, it finally did. Not sure what I did differently. While it was working, sounds were glitched and sometimes had static. Other times, sounds were cut off at the end. It quit working spontaneously and I couldn't get it to work after that.

The announcement I received via e-mail only mentions needing eisy firmware 5.8.0 and above, however it sounds like it may not actually be fully baked quite yet...
In this announcement for AudioPlayer Version 1.1.0 - Professional, @Michel Kohanim mentions the following:

This plugin requires the latest udx which is not in production yet (waiting for isy release in order to reduce the number of upgrades). Please follow the instructions here to install 3.5.5_6 before installing the plugins.

@chris.com if you read some of the other posts in this area you'd see what others have been doing with this plugin and perhaps the steps you were asking about for setting it up. As you mentioned though, seems like the latest version has some options that aren't (or weren't) fully available at least until the UDX system is updated.

Version 3.5.6 was installed on Sunday morning at 7:07:29. That's interesting since I was asleep at that time. Also, 3.5.6 seems to exceed the "3.5.5_6" version mentioned as a requirement. In @Michel Kohanim's post he also says this version must be installed before installing the plugins. Not sure if I was on 3.5.6 before attempting to install the plugins. Perhaps I shall uninstall them and reinstall them and see what happens.

audioplayer is under MIT license. It can be reused within proprietary software provided that all copies of the licensed software include a copy of the MIT License terms and the copyright notice.

A couple of months ago I built a jQuery plugin that replaces element with a little of custom HTML code. By adding some CSS you get a whole new player which looks the way you want and has the same functionality as the default player. There is no direct way to style the element. But the HTML5 DOM has methods, properties, and events for the element and thus makes it quite easily manipulable.

A couple of weeks ago I wrote an in-depth article about the plugin for Codrops, which I recommend for people who think of themselves as less experienced in the field. Receiving some helpful feedback there, helped me to improve the player. Obviously, this is not the end and I will be looking for your feedback here as well.

To achieve this, full responsibility falls on your CSS. My example is responsive. You can have a non-responsive player as well, but that is not recommended. Responsiveness is an important sign of a good web experience.

When the browser does not support the audio element entirely or any of the provided audio files, the player then gracefully degrades to a one-button (Play/Pause buttons only) element based player which will use a third party plugin (mostly Quick Time on Mac, Windows Media Player on Windows) to play the audio file. Another possible scenario: JavaScript disabled in the browser. Browser's default player takes action then. And that is totally fine.

The player is in no way directly native. The plugin accepts audio element's attributes (src, autoplay, loop, preoload) and tags (). Besides that, autoplay and loop attributes are inherited on the previously mentioned fallback case.

Add the audio element, set the attributes you need and add source(s). The more different sources you add, the more users will be able to listen to your audio (because none of the audio formats are supported across all browsers). Three examples:

Mystic controls? It is a boolean attribute which does not influence the plugin in any way, but ensures that browser's default player is displayed and displayed with controls when JavaScript is disabled.

The plugin has some optional parameters. The most important one is called classPrefix. The passed value becomes a class name for the parent element and class name prefix for child elements. Other options may only be advantageous for languages other than English. Example with default values:

Important: when the audio element is not supported or none of the given audio files are compatible with the browser, the player switches to Mini mode, which basically reduces the player to Play/Pause button (because "embed" element is limited in terms of manipulation):

Reminder: using classPrefix options on the initiation of the plugin you can replace every audioplayer occurrence with your own value in the HTML and so to have different looks of multiple players on the same website.

I tested the player and it works fine on the latest Safari, Chrome, Firefox, Opera both Mac and Windows versions. The player works well on Internet Explorer 9, 10 and gracefully degrades to mini mode on earlier versions. I have also been lucky with iOS 6, Windows Phone 7 and Android 4.2 default browsers. However, the earlier Android versions does not support "audio" nor "embed" elements, so the player won't work there at all.

The following methods are used to create and use audioplayerobjects. These objects can be used to play back audio data stored inOctave matrices and arrays. The audioplayer object supports playbackfrom various devices available to the system, blocking and non-blockingplayback, convenient pausing and resuming and much more.

Fs is the sampling rate in Hz to use for playback. Valid values for Fs depend on the specific audio hardware installed. Typical values supported by most sound cards are 8000, 11025, 22050, and 44100 Hz.

y = audioplayer(x,Fs,nbits) returns a handle to an audio player object where nbits is the bit quantization to use for single or double data types. This is an optional parameter with a default value of 16. Valid values for nbits are 8 and 16 (and 24, if a 24-bit device is installed). You do not need to specify nbits for int8, uint8 or int16 data because the quantization is set automatically to 8 or 16, respectively.

Example
Load a sample audio file, create an audio player object, and play the audio at a higher sampling rate. x contains the audio samples and Fs is the sampling rate. You can use any of the audioplayer functions listed above on the player.

I've created a list widget that displays podcast episodes from my api with a button underneath. Currently, when the button is clicked, it updates the base audioplayer widget's title & audio file, how can I also have it start playing the audio file? I'm thinking I need to turn the audio player into a custom component, and add a custom function that inits the callback?

c80f0f1006
Reply all
Reply to author
Forward
0 new messages