serverside generated audio playback in Vaadin 10

Hi,
Using Vaadin 8 I was playing back an audio file, which was generated by the server using this:

	   Audio tempAudio;
       StreamResource resource = new StreamResource(
                new StreamResource.StreamSource() {
                    public InputStream getStream() {
                            byte[] ab = ... // generated array of bytes;
							return new ByteArrayInputStream(ab);
                    }
                }, "") {
            @Override
            public String getMIMEType() {
                return "audio/mp3";
            }
        };

        if (tempAudio != null)
            layoutMain.removeComponent(tempAudio);
        tempAudio = new Audio(null, resource);
        layoutMain.addComponent(tempAudio);
        tempAudio.play();

What is the suggested way to do the same in Vaadin 10? I would really appreciate a code snippet, for example. similar to the above
Thanks!

this worked for me:

                StreamResource resource = new StreamResource("audio.wav",
                        () -> getAudioStream());   // audio generated here  
                Element element = new Element("audio");
                element.setAttribute("type", "audio/wav");
                element.setAttribute("autoplay", true);
                element.getStyle().set("display", "block");
                element.setAttribute("src", resource);
                UI.getCurrent().getElement().appendChild(element);